kopia lustrzana https://gitlab.com/sane-project/backends
Fixed some warnings.
rodzic
e7bc636c3d
commit
2efe9ab441
|
@ -8,7 +8,8 @@
|
||||||
* backend/as6e.c: Fixed some warnings.
|
* backend/as6e.c: Fixed some warnings.
|
||||||
* backend/coolscan.c backend/coolscan-scsi.h: Fixed a bunch of
|
* backend/coolscan.c backend/coolscan-scsi.h: Fixed a bunch of
|
||||||
compilation warnings.
|
compilation warnings.
|
||||||
* backend/djpeg.c: Fixed some warnings.
|
* backend/djpeg.c: Fixed some warnings.
|
||||||
|
* backend/dmc.c: Fixed some warnings.
|
||||||
|
|
||||||
2003-04-03 Eddy De Greef <eddy_de_greef at tiscali dot be>
|
2003-04-03 Eddy De Greef <eddy_de_greef at tiscali dot be>
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,8 @@ typedef ppm_dest_struct *ppm_dest_ptr;
|
||||||
METHODDEF (void)
|
METHODDEF (void)
|
||||||
sanei_jpeg_start_output_ppm (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
|
sanei_jpeg_start_output_ppm (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
|
||||||
{
|
{
|
||||||
|
cinfo = cinfo;
|
||||||
|
dinfo = dinfo;
|
||||||
/* header image is supplied for us */
|
/* header image is supplied for us */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -61,6 +62,8 @@ sanei_jpeg_start_output_ppm (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
|
||||||
METHODDEF (void)
|
METHODDEF (void)
|
||||||
sanei_jpeg_finish_output_ppm (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
|
sanei_jpeg_finish_output_ppm (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
|
||||||
{
|
{
|
||||||
|
cinfo = cinfo;
|
||||||
|
dinfo = dinfo;
|
||||||
|
|
||||||
/* nothing to do */
|
/* nothing to do */
|
||||||
}
|
}
|
||||||
|
@ -77,8 +80,10 @@ METHODDEF (void)
|
||||||
sanei_jpeg_put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
|
sanei_jpeg_put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
|
||||||
JDIMENSION rows_supplied, char *data)
|
JDIMENSION rows_supplied, char *data)
|
||||||
{
|
{
|
||||||
|
|
||||||
ppm_dest_ptr dest = (ppm_dest_ptr) dinfo;
|
ppm_dest_ptr dest = (ppm_dest_ptr) dinfo;
|
||||||
|
cinfo = cinfo;
|
||||||
|
dinfo = dinfo;
|
||||||
|
rows_supplied = rows_supplied;
|
||||||
|
|
||||||
memcpy (data, dest->iobuffer, dest->buffer_width);
|
memcpy (data, dest->iobuffer, dest->buffer_width);
|
||||||
}
|
}
|
||||||
|
@ -93,12 +98,15 @@ METHODDEF (void)
|
||||||
sanei_jpeg_copy_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
|
sanei_jpeg_copy_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
|
||||||
JDIMENSION rows_supplied, char *data)
|
JDIMENSION rows_supplied, char *data)
|
||||||
{
|
{
|
||||||
|
|
||||||
ppm_dest_ptr dest = (ppm_dest_ptr) dinfo;
|
ppm_dest_ptr dest = (ppm_dest_ptr) dinfo;
|
||||||
register char *bufferptr;
|
register char *bufferptr;
|
||||||
register JSAMPROW ptr;
|
register JSAMPROW ptr;
|
||||||
register JDIMENSION col;
|
register JDIMENSION col;
|
||||||
|
|
||||||
|
cinfo = cinfo;
|
||||||
|
dinfo = dinfo;
|
||||||
|
rows_supplied = rows_supplied;
|
||||||
|
|
||||||
ptr = dest->pub.buffer[0];
|
ptr = dest->pub.buffer[0];
|
||||||
bufferptr = dest->iobuffer;
|
bufferptr = dest->iobuffer;
|
||||||
for (col = dest->samples_per_row; col > 0; col--)
|
for (col = dest->samples_per_row; col > 0; col--)
|
||||||
|
@ -128,6 +136,8 @@ sanei_jpeg_put_demapped_rgb (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
|
||||||
register JSAMPROW color_map2 = cinfo->colormap[2];
|
register JSAMPROW color_map2 = cinfo->colormap[2];
|
||||||
register JDIMENSION col;
|
register JDIMENSION col;
|
||||||
|
|
||||||
|
rows_supplied = rows_supplied;
|
||||||
|
|
||||||
ptr = dest->pub.buffer[0];
|
ptr = dest->pub.buffer[0];
|
||||||
bufferptr = dest->iobuffer;
|
bufferptr = dest->iobuffer;
|
||||||
for (col = cinfo->output_width; col > 0; col--)
|
for (col = cinfo->output_width; col > 0; col--)
|
||||||
|
@ -151,6 +161,8 @@ sanei_jpeg_put_demapped_gray (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
|
||||||
register JSAMPROW color_map = cinfo->colormap[0];
|
register JSAMPROW color_map = cinfo->colormap[0];
|
||||||
register JDIMENSION col;
|
register JDIMENSION col;
|
||||||
|
|
||||||
|
rows_supplied = rows_supplied;
|
||||||
|
|
||||||
ptr = dest->pub.buffer[0];
|
ptr = dest->pub.buffer[0];
|
||||||
bufferptr = dest->iobuffer;
|
bufferptr = dest->iobuffer;
|
||||||
for (col = cinfo->output_width; col > 0; col--)
|
for (col = cinfo->output_width; col > 0; col--)
|
||||||
|
|
|
@ -609,7 +609,7 @@ DMCSetASA(int fd, unsigned int asa)
|
||||||
|
|
||||||
DBG(3, "DMCSetAsa: %d\n", asa);
|
DBG(3, "DMCSetAsa: %d\n", asa);
|
||||||
for (i=1; i<=ASA_100+1; i++) {
|
for (i=1; i<=ASA_100+1; i++) {
|
||||||
if (asa == ValidASAs[i]) break;
|
if (asa == (unsigned int) ValidASAs[i]) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i > ASA_100+1) return SANE_STATUS_INVAL;
|
if (i > ASA_100+1) return SANE_STATUS_INVAL;
|
||||||
|
@ -806,6 +806,8 @@ sane_init(SANE_Int *version_code, SANE_Auth_Callback authorize)
|
||||||
size_t len;
|
size_t len;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
|
authorize = authorize;
|
||||||
|
|
||||||
DBG_INIT();
|
DBG_INIT();
|
||||||
if (version_code) {
|
if (version_code) {
|
||||||
*version_code = SANE_VERSION_CODE (V_MAJOR, V_MINOR, 0);
|
*version_code = SANE_VERSION_CODE (V_MAJOR, V_MINOR, 0);
|
||||||
|
@ -881,6 +883,8 @@ sane_get_devices(SANE_Device const ***device_list, SANE_Bool local_only)
|
||||||
DMC_Device *dev;
|
DMC_Device *dev;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
|
local_only = local_only;
|
||||||
|
|
||||||
if (devlist) free(devlist);
|
if (devlist) free(devlist);
|
||||||
devlist = malloc((NumDevices+1) * sizeof(devlist[0]));
|
devlist = malloc((NumDevices+1) * sizeof(devlist[0]));
|
||||||
if (!devlist) return SANE_STATUS_NO_MEM;
|
if (!devlist) return SANE_STATUS_NO_MEM;
|
||||||
|
@ -1210,7 +1214,7 @@ sane_start(SANE_Handle handle)
|
||||||
c->hw->asa = c->val[OPT_ASA].w;
|
c->hw->asa = c->val[OPT_ASA].w;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c->val[OPT_SHUTTER_SPEED].w != c->hw->shutterSpeed) {
|
if ((unsigned int) c->val[OPT_SHUTTER_SPEED].w != c->hw->shutterSpeed) {
|
||||||
status = DMCSetShutterSpeed(c->fd, c->val[OPT_SHUTTER_SPEED].w);
|
status = DMCSetShutterSpeed(c->fd, c->val[OPT_SHUTTER_SPEED].w);
|
||||||
if (status != SANE_STATUS_GOOD) {
|
if (status != SANE_STATUS_GOOD) {
|
||||||
DMCCancel(c);
|
DMCCancel(c);
|
||||||
|
@ -1309,7 +1313,7 @@ sane_read(SANE_Handle handle, SANE_Byte *buf, SANE_Int max_len, SANE_Int *len)
|
||||||
(2*c->params.bytes_per_line);
|
(2*c->params.bytes_per_line);
|
||||||
/* If user is trying to read less than two complete lines, fail */
|
/* If user is trying to read less than two complete lines, fail */
|
||||||
if (max_len == 0) return SANE_STATUS_INVAL;
|
if (max_len == 0) return SANE_STATUS_INVAL;
|
||||||
if (max_len > c->bytes_to_read) max_len = c->bytes_to_read;
|
if ((unsigned int) max_len > c->bytes_to_read) max_len = c->bytes_to_read;
|
||||||
for (i=0; i<max_len; i += 2*c->params.bytes_per_line) {
|
for (i=0; i<max_len; i += 2*c->params.bytes_per_line) {
|
||||||
c->bytes_to_read -= 2*c->params.bytes_per_line;
|
c->bytes_to_read -= 2*c->params.bytes_per_line;
|
||||||
status = DMCReadTwoSuperResolutionLines(c, buf+i,
|
status = DMCReadTwoSuperResolutionLines(c, buf+i,
|
||||||
|
@ -1326,14 +1330,14 @@ sane_read(SANE_Handle handle, SANE_Byte *buf, SANE_Int max_len, SANE_Int *len)
|
||||||
|
|
||||||
/* If user is trying to read less than one complete row, fail */
|
/* If user is trying to read less than one complete row, fail */
|
||||||
if (max_len == 0) return SANE_STATUS_INVAL;
|
if (max_len == 0) return SANE_STATUS_INVAL;
|
||||||
if (max_len > c->bytes_to_read) max_len = c->bytes_to_read;
|
if ((unsigned int) max_len > c->bytes_to_read) max_len = c->bytes_to_read;
|
||||||
c->bytes_to_read -= max_len;
|
c->bytes_to_read -= (unsigned int) max_len;
|
||||||
status = DMCRead(c->fd, 0x00, c->imageMode, buf, max_len, &size);
|
status = DMCRead(c->fd, 0x00, c->imageMode, buf, max_len, &size);
|
||||||
*len = size;
|
*len = size;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (max_len > c->bytes_to_read) max_len = c->bytes_to_read;
|
if ((unsigned int) max_len > c->bytes_to_read) max_len = c->bytes_to_read;
|
||||||
if (c->readPtr) {
|
if (c->readPtr) {
|
||||||
*len = max_len;
|
*len = max_len;
|
||||||
memcpy(buf, c->readPtr, max_len);
|
memcpy(buf, c->readPtr, max_len);
|
||||||
|
@ -1346,11 +1350,11 @@ sane_read(SANE_Handle handle, SANE_Byte *buf, SANE_Int max_len, SANE_Int *len)
|
||||||
c->readBuffer = malloc(c->bytes_to_read);
|
c->readBuffer = malloc(c->bytes_to_read);
|
||||||
if (!c->readBuffer) return SANE_STATUS_NO_MEM;
|
if (!c->readBuffer) return SANE_STATUS_NO_MEM;
|
||||||
c->readPtr = c->readBuffer;
|
c->readPtr = c->readBuffer;
|
||||||
status = DMCRead(c->fd, 0x00, c->imageMode, c->readBuffer,
|
status = DMCRead(c->fd, 0x00, c->imageMode, (SANE_Byte *) c->readBuffer,
|
||||||
c->bytes_to_read, &size);
|
c->bytes_to_read, &size);
|
||||||
*len = size;
|
*len = size;
|
||||||
if (status != SANE_STATUS_GOOD) return status;
|
if (status != SANE_STATUS_GOOD) return status;
|
||||||
if (*len != c->bytes_to_read) return SANE_STATUS_IO_ERROR;
|
if ((unsigned int) *len != c->bytes_to_read) return SANE_STATUS_IO_ERROR;
|
||||||
|
|
||||||
/* Now copy */
|
/* Now copy */
|
||||||
*len = max_len;
|
*len = max_len;
|
||||||
|
@ -1381,11 +1385,17 @@ sane_cancel (SANE_Handle handle)
|
||||||
SANE_Status
|
SANE_Status
|
||||||
sane_set_io_mode (SANE_Handle handle, SANE_Bool non_blocking)
|
sane_set_io_mode (SANE_Handle handle, SANE_Bool non_blocking)
|
||||||
{
|
{
|
||||||
|
handle = handle;
|
||||||
|
non_blocking = non_blocking;
|
||||||
|
|
||||||
return SANE_STATUS_UNSUPPORTED;
|
return SANE_STATUS_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
SANE_Status
|
SANE_Status
|
||||||
sane_get_select_fd (SANE_Handle handle, SANE_Int *fd)
|
sane_get_select_fd (SANE_Handle handle, SANE_Int *fd)
|
||||||
{
|
{
|
||||||
|
handle = handle;
|
||||||
|
fd = fd;
|
||||||
|
|
||||||
return SANE_STATUS_UNSUPPORTED;
|
return SANE_STATUS_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue