diff --git a/ChangeLog b/ChangeLog index 6413ad32d..f3342d211 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,19 @@ (bug #300823). Fixed Microtek Phantom C6 scanning on big endian platforms. Based on patch from Matijs van Zuijlen in Debian bug tracking system (#274523). + * sanei/sanei_auth.c sanei/sanei_lm983x.c sanei/sanei_wire.c + backend/artec.c backend/artec_eplus48u.c backend/as6e.c + backend/avision.c backend/canon-sane.c backend/canon-scsi.c + backend/canon.c backend/canon630u-common.c backend/dc25.c + backend/epson.c backend/fujitsu.c backend/gt68xx_low.c + backend/hp5400_internal.c backend/hp5400_sanei.c + backend/ma1509.c backend/microtek.c backend/microtek2.c + backend/mustek.c backend/mustek_scsi_pp.c backend/nec.c + backend/net.c backend/pie.c backend/sharp.c + backend/snapscan-scsi.c backend/snapscan-sources.c + backend/snapscan-usb.c backend/snapscan.c backend/teco3.c + backend/test.c backend/umax-usb.c backend/umax1220u-common.c: + 64 bit platform fixes (bug #300799). 2004-10-02 Thomas Soumarmon diff --git a/backend/artec.c b/backend/artec.c index 4649184b4..cbfa71695 100644 --- a/backend/artec.c +++ b/backend/artec.c @@ -3505,8 +3505,8 @@ artec_sane_read (SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len, SANE_Int bytes_read = 0; while ((rows_read < max_ret_rows) && (rows_read < remaining_rows)) { - DBG (50, "top of while loop, rr = %d, mrr = %d, rem = %d\n", - rows_read, max_ret_rows, remaining_rows); + DBG (50, "top of while loop, rr = %lu, mrr = %lu, rem = %lu\n", + (u_long) rows_read, (u_long) max_ret_rows, (u_long) remaining_rows); if (s->bytes_to_read - bytes_read <= s->params.bytes_per_line * max_read_rows) { @@ -3549,12 +3549,12 @@ artec_sane_read (SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len, SANE_Int lread = 1; } - DBG (50, "rows_available = %d, params.lines = %d, bytes_per_line = %d\n", - rows_available, s->params.lines, s->params.bytes_per_line); - DBG (50, "bytes_to_read = %lu, max_len = %d, max_rows = %d\n", - (u_long) s->bytes_to_read, max_len, max_ret_rows); - DBG (50, "nread = %lu, lread = %lu, bytes_read = %d, rows_read = %d\n", - (u_long) nread, (u_long) lread, bytes_read, rows_read); + DBG (50, "rows_available = %lu, params.lines = %d, bytes_per_line = %d\n", + (u_long) rows_available, s->params.lines, s->params.bytes_per_line); + DBG (50, "bytes_to_read = %lu, max_len = %d, max_rows = %lu\n", + (u_long) s->bytes_to_read, max_len, (u_long) max_ret_rows); + DBG (50, "nread = %lu, lread = %lu, bytes_read = %lu, rows_read = %lu\n", + (u_long) nread, (u_long) lread, (u_long) bytes_read, (u_long) rows_read); status = read_data (s->fd, ARTEC_DATA_IMAGE, temp_buf, &nread); diff --git a/backend/artec_eplus48u.c b/backend/artec_eplus48u.c index 3a7150769..014a517f5 100644 --- a/backend/artec_eplus48u.c +++ b/backend/artec_eplus48u.c @@ -1470,8 +1470,8 @@ artec48u_device_new (Artec48U_Device ** dev_return) if (!dev) { - XDBG ((3, "%s: couldn't malloc %d bytes for device\n", - function_name, sizeof (Artec48U_Device))); + XDBG ((3, "%s: couldn't malloc %lu bytes for device\n", + function_name, (u_long) sizeof (Artec48U_Device))); *dev_return = 0; return SANE_STATUS_NO_MEM; } @@ -3718,7 +3718,7 @@ save_calibration_data (Artec48U_Scanner * s) /*read values */ cnt = fwrite (s->shading_buffer_b, sizeof (unsigned char), 30720*s->dev->epro_mult, f); /*epro*/ - XDBG ((1, "Wrote %i bytes to black shading buffer \n", cnt)); + XDBG ((1, "Wrote %li bytes to black shading buffer \n", (u_long) cnt)); if (cnt != (30720*s->dev->epro_mult))/*epro*/ { fclose (f); diff --git a/backend/as6e.c b/backend/as6e.c index 6a5d77889..65cc95f86 100644 --- a/backend/as6e.c +++ b/backend/as6e.c @@ -271,8 +271,8 @@ sane_read (SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len, } } /*while there's space in the buffer */ s->image_counter += *len; - DBG (3, "image ctr = %d bytes_to_read = %d returning %d\n", - s->image_counter, s->bytes_to_read, *len); + DBG (3, "image ctr = %d bytes_to_read = %lu returning %d\n", + s->image_counter, (u_long) s->bytes_to_read, *len); return SANE_STATUS_GOOD; } diff --git a/backend/avision.c b/backend/avision.c index 75949c2c4..f2c140e70 100644 --- a/backend/avision.c +++ b/backend/avision.c @@ -1168,8 +1168,8 @@ static void debug_print_raw (int dbg_level, char* info, const u_int8_t* data, DBG (dbg_level, info); for (i = 0; i < count; ++ i) { - DBG (dbg_level, " [%d] %1d%1d%1d%1d%1d%1d%1d%1db %3oo %3dd %2xx\n", - i, + DBG (dbg_level, " [%lu] %1d%1d%1d%1d%1d%1d%1d%1db %3oo %3dd %2xx\n", + (u_long) i, BIT(data[i],7), BIT(data[i],6), BIT(data[i],5), BIT(data[i],4), BIT(data[i],3), BIT(data[i],2), BIT(data[i],1), BIT(data[i],0), data[i], data[i], data[i]); @@ -1493,7 +1493,7 @@ avision_usb_status (Avision_Connection* av_con) status = sanei_usb_read_int (av_con->usb_dn, &usb_status, &count); - DBG (3, "(pseudo interrupt) got: %d, status: %d\n", count, usb_status); + DBG (3, "(pseudo interrupt) got: %lu, status: %d\n", (u_long) count, usb_status); if (status != SANE_STATUS_GOOD) return status; @@ -1601,7 +1601,7 @@ static SANE_Status avision_cmd (Avision_Connection* av_con, (if we do not transfer additional data) ... */ u_int8_t enlarged_cmd [min_usb_size]; if (cmd_size < min_usb_size && !src_size) { - DBG (1, "filling command to have a length of 10, was: %u\n", cmd_size); + DBG (1, "filling command to have a length of 10, was: %lu\n", (u_long) cmd_size); memcpy (enlarged_cmd, m_cmd, cmd_size); memset (enlarged_cmd + cmd_size, 0, min_usb_size - cmd_size); m_cmd = enlarged_cmd; @@ -1612,10 +1612,10 @@ static SANE_Status avision_cmd (Avision_Connection* av_con, if (count > max_usb_size) count = max_usb_size; - DBG (8, "try to write cmd, count: %u.\n", count); + DBG (8, "try to write cmd, count: %lu.\n", (u_long) count); status = sanei_usb_write_bulk (av_con->usb_dn, &(m_cmd[i]), &count); - DBG (8, "wrote %u bytes\n", count); + DBG (8, "wrote %lu bytes\n", (u_long) count); if (status != SANE_STATUS_GOOD) break; i += count; @@ -1632,10 +1632,10 @@ static SANE_Status avision_cmd (Avision_Connection* av_con, if (count > max_usb_size) count = max_usb_size; - DBG (8, "try to write src, count: %u.\n", count); + DBG (8, "try to write src, count: %lu.\n", (u_long) count); status = sanei_usb_write_bulk (av_con->usb_dn, &(m_src[i]), &count); - DBG (8, "wrote %u bytes\n", count); + DBG (8, "wrote %lu bytes\n", (u_long) count); if (status != SANE_STATUS_GOOD) break; i += count; @@ -1647,10 +1647,10 @@ static SANE_Status avision_cmd (Avision_Connection* av_con, while (out_count < *dst_size) { count = (*dst_size - out_count); - DBG (8, "try to read %u bytes\n", count); + DBG (8, "try to read %lu bytes\n", (u_long) count); status = sanei_usb_read_bulk(av_con->usb_dn, &(m_dst[out_count]), &count); - DBG (8, "read %u bytes\n", count); + DBG (8, "read %lu bytes\n", (u_long) count); if (status != SANE_STATUS_GOOD) { DBG(3, "*** Got error %d trying to read\n", status); @@ -1683,9 +1683,9 @@ static SANE_Status avision_cmd (Avision_Connection* av_con, count = sizeof(sense_header); - DBG (8, "try to write %u bytes\n", count); + DBG (8, "try to write %lu bytes\n", (u_long) count); status = sanei_usb_write_bulk (av_con->usb_dn, (u_int8_t*) &sense_header, &count); - DBG (8, "wrote %u bytes\n", count); + DBG (8, "wrote %lu bytes\n", (u_long) count); if (status != SANE_STATUS_GOOD) { DBG (3, "*** Got error %d trying to request sense!\n", status); @@ -1693,9 +1693,9 @@ static SANE_Status avision_cmd (Avision_Connection* av_con, else { count = sizeof (sense_buffer); - DBG (8, "try to read %u bytes sense data\n", count); + DBG (8, "try to read %lu bytes sense data\n", (u_long) count); status = sanei_usb_read_bulk(av_con->usb_dn, sense_buffer, &count); - DBG (8, "read %u bytes sense data\n", count); + DBG (8, "read %lu bytes sense data\n", (u_long) count); if (status != SANE_STATUS_GOOD) DBG (3, "*** Got error %d trying to read sense!\n", status); @@ -1949,7 +1949,7 @@ wait_4_light (Avision_Scanner* s) for (try = 0; try < 18; ++ try) { - DBG (5, "wait_4_light: read bytes %d\n", size); + DBG (5, "wait_4_light: read bytes %lu\n", (u_long) size); status = avision_cmd (&s->av_con, &rcmd, sizeof (rcmd), 0, 0, &result, &size); if (status != SANE_STATUS_GOOD || size != sizeof (result)) { @@ -2915,7 +2915,7 @@ get_calib_format (Avision_Scanner* s, struct calibration_format* format) set_double (rcmd.datatypequal, s->hw->data_dq); set_triple (rcmd.transferlen, size); - DBG (3, "get_calib_format: read_data: %d bytes\n", size); + DBG (3, "get_calib_format: read_data: %lu bytes\n", (u_long) size); status = avision_cmd (&s->av_con, &rcmd, sizeof (rcmd), 0, 0, result, &size); if (status != SANE_STATUS_GOOD || size != sizeof (result) ) { DBG (1, "get_calib_format: read calib. info failt (%s)\n", @@ -2969,8 +2969,8 @@ get_calib_data (Avision_Scanner* s, u_int8_t data_type, struct command_read rcmd; - DBG (3, "get_calib_data: type %x, size %d, line_size: %d\n", - data_type, calib_size, line_size); + DBG (3, "get_calib_data: type %x, size %lu, line_size: %lu\n", + data_type, (u_long) calib_size, (u_long) line_size); memset (&rcmd, 0, sizeof (rcmd)); @@ -3061,7 +3061,7 @@ set_calib_data (Avision_Scanner* s, struct calibration_format* format, { size_t send_size = elements_per_line * 2; DBG (3, "set_calib_data: all channels in one command\n"); - DBG (3, "set_calib_data: send_size: %d\n", send_size); + DBG (3, "set_calib_data: send_size: %lu\n", (u_long) send_size); memset (&scmd, 0, sizeof (scmd) ); scmd.opc = AVISION_SCSI_SEND; @@ -3522,10 +3522,10 @@ send_gamma (Avision_Scanner* s) gamma_values = gamma_table_size / 256; - DBG (3, "send_gamma: table_raw_size: %d, table_size: %d\n", - gamma_table_raw_size, gamma_table_size); - DBG (3, "send_gamma: values: %d, invert_table: %d\n", - gamma_values, invert_table); + DBG (3, "send_gamma: table_raw_size: %lu, table_size: %lu\n", + (u_long) gamma_table_raw_size, (u_long) gamma_table_size); + DBG (3, "send_gamma: values: %lu, invert_table: %d\n", + (u_long) gamma_values, invert_table); /* prepare for emulating contrast, brightness ... via the gamma-table */ brightness = SANE_UNFIX (s->val[OPT_BRIGHTNESS].w); @@ -3618,8 +3618,8 @@ send_gamma (Avision_Scanner* s) } } - DBG (4, "send_gamma: sending %d bytes gamma table.\n", - gamma_table_raw_size); + DBG (4, "send_gamma: sending %lu bytes gamma table.\n", + (u_long) gamma_table_raw_size); status = avision_cmd (&s->av_con, &scmd, sizeof (scmd), gamma_data, gamma_table_raw_size, 0, 0); } @@ -3905,7 +3905,7 @@ start_scan (Avision_Scanner* s) cmd.bitset1 &= ~(0x01<<7); } - DBG (3, "start_scan: sending command. Bytes: %d\n", size); + DBG (3, "start_scan: sending command. Bytes: %lu\n", (u_long) size); return avision_cmd (&s->av_con, &cmd, size, 0, 0, 0, 0); } @@ -3957,7 +3957,7 @@ read_data (Avision_Scanner* s, SANE_Byte* buf, size_t* count) struct command_read rcmd; SANE_Status status; - DBG (9, "read_data: %d\n", *count); + DBG (9, "read_data: %lu\n", (u_long) *count); memset (&rcmd, 0, sizeof (rcmd)); @@ -4330,17 +4330,17 @@ reader_process (void *data) stripe_size = bytes_per_line * lines_per_stripe; out_size = bytes_per_line * lines_per_output; - DBG (3, "dev->scsi_buffer_size / 2: %d, half_inch_bytes: %d\n", - dev->scsi_buffer_size / 2, half_inch_bytes); + DBG (3, "dev->scsi_buffer_size / 2: %d, half_inch_bytes: %lu\n", + dev->scsi_buffer_size / 2, (u_long) half_inch_bytes); - DBG (3, "bytes_per_line: %d, pixels_per_line: %d\n", - bytes_per_line, pixels_per_line); + DBG (3, "bytes_per_line: %lu, pixels_per_line: %lu\n", + (u_long) bytes_per_line, (u_long) pixels_per_line); - DBG (3, "lines_per_stripe: %d, lines_per_output: %d\n", - lines_per_stripe, lines_per_output); + DBG (3, "lines_per_stripe: %lu, lines_per_output: %lu\n", + (u_long) lines_per_stripe, (u_long) lines_per_output); - DBG (3, "max_bytes_per_read: %d, stripe_size: %d, out_size: %d\n", - max_bytes_per_read, stripe_size, out_size); + DBG (3, "max_bytes_per_read: %lu, stripe_size: %lu, out_size: %lu\n", + (u_long) max_bytes_per_read, (u_long) stripe_size, (u_long) out_size); stripe_data = malloc (stripe_size); out_data = malloc (out_size); @@ -4349,7 +4349,7 @@ reader_process (void *data) /* calculate params for the simple reader */ total_size = bytes_per_line * (s->params.lines + s->avdimen.line_difference); - DBG (3, "reader_process: total_size: %d\n", total_size); + DBG (3, "reader_process: total_size: %lu\n", (u_long) total_size); processed_bytes = 0; stripe_fill = 0; @@ -4371,11 +4371,11 @@ reader_process (void *data) if (processed_bytes + this_read > total_size) this_read = total_size - processed_bytes; - DBG (5, "reader_process: processed_bytes: %d, total_size: %d\n", - processed_bytes, total_size); + DBG (5, "reader_process: processed_bytes: %lu, total_size: %lu\n", + (u_long) processed_bytes, (u_long) total_size); - DBG (5, "reader_process: this_read: %d\n", - this_read); + DBG (5, "reader_process: this_read: %lu\n", + (u_long) this_read); sigprocmask (SIG_BLOCK, &sigterm_set, 0); status = read_data (s, stripe_data + stripe_fill, &this_read); @@ -5495,7 +5495,7 @@ sane_read (SANE_Handle handle, SANE_Byte* buf, SANE_Int max_len, SANE_Int* len) *len = 0; nread = read (s->pipe, buf, max_len); - DBG (3, "sane_read: got %d bytes\n", nread); + DBG (3, "sane_read: got %ld bytes\n", (long) nread); if (!s->scanning) return SANE_STATUS_CANCELLED; diff --git a/backend/canon-sane.c b/backend/canon-sane.c index 112a4439b..533ad2315 100644 --- a/backend/canon-sane.c +++ b/backend/canon-sane.c @@ -917,10 +917,10 @@ sane_control_option (SANE_Handle handle, SANE_Int option, if (status == SANE_STATUS_GOOD) { time (&(s->time1)); - DBG (11, "time0 = %ld\n", s->time0); - DBG (11, "time1 = %ld\n", s->time1); + DBG (11, "time0 = %ld\n", (u_long) s->time0); + DBG (11, "time1 = %ld\n", (u_long) s->time1); dtime = (s->time1) - (s->time0); - DBG (11, "dtime = %ld\n", dtime); + DBG (11, "dtime = %ld\n", (u_long) dtime); DBG (11, "switch_preview = %d\n", s->switch_preview); if (s->switch_preview == 0) @@ -935,7 +935,7 @@ sane_control_option (SANE_Handle handle, SANE_Int option, DBG (11, "SANE_UNFIX(s->val[OPT_BR_Y].w) = %f\n", SANE_UNFIX (s->val[OPT_BR_Y].w)); - DBG (11, "rt = %ld\n", rt); + DBG (11, "rt = %ld\n", (u_long) rt); if (dtime < rt) { @@ -1295,7 +1295,7 @@ sane_start (SANE_Handle handle) } for (i = 0; i < buf_size; i++) { - DBG (3, "scan mode control byte[%d] = %d\n", i, ebuf[i]); + DBG (3, "scan mode control byte[%lu] = %d\n", (u_long) i, ebuf[i]); } if (s->hw->adf.Status != ADF_STAT_NONE) @@ -1313,7 +1313,7 @@ sane_start (SANE_Handle handle) } for (i = 0; i < buf_size; i++) { - DBG (3, "scan mode control byte[%d] = %d\n", i, ebuf[i]); + DBG (3, "scan mode control byte[%lu] = %d\n", (u_long) i, ebuf[i]); } } #endif @@ -1592,7 +1592,7 @@ NP=%d, Negative film type=%d\n", !s->RIF, s->negative_filmtype); } for (i = 0; i < buf_size; i++) { - DBG (3, "scan mode byte[%d] = %d\n", i, ebuf[i]); + DBG (3, "scan mode byte[%lu] = %d\n", (u_long) i, ebuf[i]); } #endif @@ -1753,8 +1753,8 @@ sane_read_direct (SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len, *len = 0; nread = max_len; - DBG (21, " sane_read: nread=%d, bytes_to_read=%d\n", nread, - s->bytes_to_read); + DBG (21, " sane_read: nread=%lu, bytes_to_read=%lu\n", (u_long) nread, + (u_long) s->bytes_to_read); if (s->bytes_to_read == 0) { do_cancel (s); @@ -1775,8 +1775,8 @@ sane_read_direct (SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len, *len = nread; s->bytes_to_read -= nread; - DBG (21, " sane_read: nread=%d, bytes_to_read=%d\n", nread, - s->bytes_to_read); + DBG (21, " sane_read: nread=%lu, bytes_to_read=%lu\n", (u_long) nread, + (u_long) s->bytes_to_read); DBG (21, "<< sane_read\n"); return (SANE_STATUS_GOOD); } @@ -1798,8 +1798,8 @@ read_fs2710 (SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len, *len = 0; nread = max_len; - DBG (21, " sane_read: nread=%d, bytes_to_read=%d\n", nread, - s->bytes_to_read); + DBG (21, " sane_read: nread=%lu, bytes_to_read=%lu\n", (u_long) nread, + (u_long) s->bytes_to_read); if (nread > s->bytes_to_read) nread = s->bytes_to_read; @@ -1868,8 +1868,8 @@ read_fs2710 (SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len, *len = nread; s->bytes_to_read -= nread; - DBG (21, " sane_read: nread=%d, bytes_to_read=%d\n", nread, - s->bytes_to_read); + DBG (21, " sane_read: nread=%lu, bytes_to_read=%lu\n", (u_long) nread, + (u_long) s->bytes_to_read); DBG (21, "<< sane_read\n"); return (SANE_STATUS_GOOD); } @@ -1891,8 +1891,8 @@ read_fb620 (SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len, *len = 0; - DBG (21, " read_fb620: nread=%d, bytes_to_read=%d\n", nread, - s->bytes_to_read); + DBG (21, " read_fb620: nread=%lu, bytes_to_read=%lu\n", (u_long) nread, + (u_long) s->bytes_to_read); if (s->bytes_to_read == 0 && s->buf_pos == s->buf_used) { @@ -2016,13 +2016,13 @@ SANE_Int * len) + (dbuf[22] << 8) + dbuf[23]); DBG (5, "Filled Data Buffer=%d\n", (dbuf[24] << 24) + (dbuf[25] << 16) + (dbuf[26] << 8) + dbuf[27]); - DBG (5, "temp file position:%u\n", lseek(s->tmpfile, 0, SEEK_CUR)); + DBG (5, "temp file position:%lu\n", (u_long) lseek(s->tmpfile, 0, SEEK_CUR)); DBG (5, "<< GET DATA STATUS\n"); *len = 0; - DBG (21, " read_fb1200: nread=%d, bytes_to_read=%d\n", nread, - s->bytes_to_read); + DBG (21, " read_fb1200: nread=%lu, bytes_to_read=%lu\n", (u_long) nread, + (u_long) s->bytes_to_read); if (s->bytes_to_read == 0 && s->buf_pos == s->buf_used) { @@ -2236,7 +2236,7 @@ sane_read (SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len, else time (&(s->time0)); - DBG (11, "sane_read: time0 = %ld\n", s->time0); + DBG (11, "sane_read: time0 = %ld\n", (u_long) s->time0); s->switch_preview = s->val[OPT_PREVIEW].w; return (status); } diff --git a/backend/canon-scsi.c b/backend/canon-scsi.c index 0c272c858..52a857423 100644 --- a/backend/canon-scsi.c +++ b/backend/canon-scsi.c @@ -411,12 +411,12 @@ define_scan_mode (int fd, u_char page, void *data) for (i = 0; i < sizeof (cmd); i++) { - DBG (31, "define scan mode: cmd[%d]='0x%0X'\n", i, cmd[i]); + DBG (31, "define scan mode: cmd[%lu]='0x%0X'\n", (u_long) i, cmd[i]); } for (i = 0; i < sizeof (pdata); i++) { - DBG (31, "define scan mode: pdata[%d]='0x%0X'\n", i, pdata[i]); + DBG (31, "define scan mode: pdata[%lu]='0x%0X'\n", (u_long) i, pdata[i]); } pdatalen = (page == TRANSPARENCY_UNIT) ? 12 : diff --git a/backend/canon.c b/backend/canon.c index 99a8c6107..6de74296c 100644 --- a/backend/canon.c +++ b/backend/canon.c @@ -243,7 +243,7 @@ get_tpu_stat (int fd, CANON_Device * dev) for (i = 0; i < buf_size; i++) { - DBG (3, "scan mode control byte[%d] = %d\n", i, tbuf[i]); + DBG (3, "scan mode control byte[%lu] = %d\n", (u_long) i, tbuf[i]); } dev->tpu.Status = (tbuf[2 + 4 + 5] >> 7) ? TPU_STAT_INACTIVE : TPU_STAT_NONE; @@ -290,7 +290,7 @@ get_adf_stat (int fd, CANON_Device * dev) for (i = 0; i < buf_size; i++) { - DBG (3, "scan mode control byte[%d] = %d\n", i, abuf[i]); + DBG (3, "scan mode control byte[%lu] = %d\n", (u_long) i, abuf[i]); } dev->adf.Status = (abuf[ADF_Status] & ADF_NOT_PRESENT) ? @@ -760,7 +760,7 @@ attach (const char *devnam, CANON_Device ** devp) } for (i = 0; i < buf_size; i++) { - DBG (3, "scan mode byte[%d] = %d\n", i, ebuf[i]); + DBG (3, "scan mode byte[%lu] = %d\n", (u_long) i, ebuf[i]); } DBG (3, "attach: sending (extended) INQUIRY\n"); @@ -1088,7 +1088,7 @@ do_cancel (CANON_Scanner * s) s->reset_flag = 0; DBG (21, "do_cancel: reset_flag = %d\n", s->reset_flag); s->time0 = -1; - DBG (21, "time0 = %ld\n", s->time0); + DBG (21, "time0 = %ld\n", (u_long) s->time0); } if (s->hw->info.model == FB1200) diff --git a/backend/canon630u-common.c b/backend/canon630u-common.c index 18b3dffc3..9ded468ee 100644 --- a/backend/canon630u-common.c +++ b/backend/canon630u-common.c @@ -237,7 +237,7 @@ write_bulk (int fd, unsigned int addr, void *src, size_t count) { SANE_Status status; - DBG (13, "write_bulk(fd, 0x%02x, buf, 0x%04x);\n", addr, count); + DBG (13, "write_bulk(fd, 0x%02x, buf, 0x%04lx);\n", addr, (u_long) count); if (!src) { @@ -259,7 +259,7 @@ read_bulk (int fd, unsigned int addr, void *dst, size_t count) { SANE_Status status; - DBG (13, "read_bulk(fd, 0x%02x, buf, 0x%04x);\n", addr, count); + DBG (13, "read_bulk(fd, 0x%02x, buf, 0x%04lx);\n", addr, (u_long) count); if (!dst) { @@ -300,10 +300,10 @@ write_many (int fd, unsigned int addr, void *src, size_t count) SANE_Status status; size_t i; - DBG (14, "multi write %d\n", count); + DBG (14, "multi write %lu\n", (u_long) count); for (i = 0; i < count; i++) { - DBG (15, " %04x:%02x", addr + i, ((byte *) src)[i]); + DBG (15, " %04lx:%02x", (u_long) (addr + i), ((byte *) src)[i]); status = write_byte (fd, addr + i, ((byte *) src)[i]); if (status != SANE_STATUS_GOOD) { @@ -324,12 +324,12 @@ read_many (int fd, unsigned int addr, void *dst, size_t count) size_t i; byte val; - DBG (14, "multi read %d\n", count); + DBG (14, "multi read %lu\n", (u_long) count); for (i = 0; i < count; i++) { status = read_byte (fd, addr + i, &val); ((byte *) dst)[i] = val; - DBG (15, " %04x:%02x", addr + i, ((byte *) dst)[i]); + DBG (15, " %04lx:%02x", (u_long) (addr + i), ((byte *) dst)[i]); /* on err, return number of success */ if (status != SANE_STATUS_GOOD) { diff --git a/backend/dc25.c b/backend/dc25.c index 5361bb0fd..14505d721 100644 --- a/backend/dc25.c +++ b/backend/dc25.c @@ -2337,7 +2337,7 @@ sane_start (SANE_Handle handle) int n, i; FILE *f; - DBG (127, "sane_start called, handle=%x\n",(unsigned int)handle); + DBG (127, "sane_start called, handle=%lx\n", (u_long) handle); if (handle != MAGIC || !is_open || (dc25_opt_image_number == 0 && dc25_opt_snap == SANE_FALSE)) diff --git a/backend/epson.c b/backend/epson.c index 434c8013c..a613c6f53 100644 --- a/backend/epson.c +++ b/backend/epson.c @@ -937,7 +937,7 @@ receive (Epson_Scanner * s, void *buf, ssize_t buf_size, SANE_Status * status) *status = SANE_STATUS_GOOD; } - DBG (7, "receive buf, expected = %lu, got = %d\n", (u_long) buf_size, n); + DBG (7, "receive buf, expected = %lu, got = %ld\n", (u_long) buf_size, (long) n); #if 1 if (n > 0) diff --git a/backend/fujitsu.c b/backend/fujitsu.c index 28007cd30..fadac931d 100644 --- a/backend/fujitsu.c +++ b/backend/fujitsu.c @@ -3118,9 +3118,9 @@ retry: /* All other URBs must be 64 bytes (max) per URB. */ if ( (j == 0) && (cnt > 31) ) cnt = 31; else if (cnt > 64) cnt = 64; hexdump (IO_CMD, "*** URB going out:", &buf[j], cnt); - DBG (10, "try to write %u bytes\n", cnt); + DBG (10, "try to write %lu bytes\n", (u_long) cnt); ret = sanei_usb_write_bulk(fd, &buf[j], &cnt); - DBG (10, "wrote %u bytes\n", cnt); + DBG (10, "wrote %lu bytes\n", (u_long) cnt); if (ret != SANE_STATUS_GOOD) break; w_cmd_count++; @@ -3135,7 +3135,7 @@ retry: if ( (out != NULL) && (req_out_len > 0) ) { /* while (ol < req_out_len) {*/ cnt = (size_t)(req_out_len-ol); - DBG (10, "try to read %u bytes\n", cnt); + DBG (10, "try to read %lu bytes\n", (u_long) cnt); ret = sanei_usb_read_bulk(fd, &out[ol], &cnt); /*flaming hack, count packets to fix data0/1 toggle issues*/ @@ -3143,7 +3143,7 @@ retry: if(cnt % 64) r_cmd_count++; - DBG (10, "read %u bytes\n", cnt); + DBG (10, "read %lu bytes\n", (u_long) cnt); if (cnt > 0) { hexdump (IO_CMD, "*** Data read:", &out[ol], cnt); } @@ -3165,12 +3165,12 @@ retry: if (status_byte != 0) { DBG (MSG_ERR, - "Got bad status: %2.2x op_code=%2.2x ret=%d req_out_len=%u ol=%u\n", + "Got bad status: %2.2x op_code=%2.2x ret=%d req_out_len=%lu ol=%lu\n", status_byte, op_code, ret, - req_out_len, - ol); + (u_long) req_out_len, + (u_long) ol); } } @@ -6766,14 +6766,14 @@ reader3091ColorSimplex (struct fujitsu *scanner, FILE * fp) #ifdef DEBUG redStart = - ((unsigned int) redSource - - (unsigned int) largeBuffer) / scanner->bytes_per_scan_line; + ((unsigned long int) redSource - + (unsigned long int) largeBuffer) / scanner->bytes_per_scan_line; greenStart = - ((unsigned int) greenSource - - (unsigned int) largeBuffer) / scanner->bytes_per_scan_line; + ((unsigned long int) greenSource - + (unsigned long int) largeBuffer) / scanner->bytes_per_scan_line; blueStart = - ((unsigned int) blueSource - - (unsigned int) largeBuffer) / scanner->bytes_per_scan_line; + ((unsigned long int) blueSource - + (unsigned long int) largeBuffer) / scanner->bytes_per_scan_line; redSum = 0; greenSum = 0; blueSum = 0; @@ -7008,14 +7008,14 @@ reader3091ColorDuplex (struct fujitsu *scanner, FILE * fp_front, FILE * fp_back) #ifdef DEBUG redStart = - ((unsigned int) redSource - - (unsigned int) largeBuffer) / scanner->bytes_per_scan_line; + ((unsigned long int) redSource - + (unsigned long int) largeBuffer) / scanner->bytes_per_scan_line; greenStart = - ((unsigned int) greenSource - - (unsigned int) largeBuffer) / scanner->bytes_per_scan_line; + ((unsigned long int) greenSource - + (unsigned long int) largeBuffer) / scanner->bytes_per_scan_line; blueStart = - ((unsigned int) blueSource - - (unsigned int) largeBuffer) / scanner->bytes_per_scan_line; + ((unsigned long int) blueSource - + (unsigned long int) largeBuffer) / scanner->bytes_per_scan_line; redSum = 0; greenSum = 0; blueSum = 0; diff --git a/backend/gt68xx_low.c b/backend/gt68xx_low.c index 999d56f0f..2c3a22234 100644 --- a/backend/gt68xx_low.c +++ b/backend/gt68xx_low.c @@ -156,8 +156,8 @@ gt68xx_device_new (GT68xx_Device ** dev_return) if (!dev) { - DBG (3, "gt68xx_device_new: couldn't malloc %d bytes for device\n", - sizeof (GT68xx_Device)); + DBG (3, "gt68xx_device_new: couldn't malloc %lu bytes for device\n", + (u_long) sizeof (GT68xx_Device)); *dev_return = 0; return SANE_STATUS_NO_MEM; } diff --git a/backend/hp5400_internal.c b/backend/hp5400_internal.c index 984f4fb2e..aa3caa9ba 100644 --- a/backend/hp5400_internal.c +++ b/backend/hp5400_internal.c @@ -979,7 +979,7 @@ InitScanner (int iHandle) if (hp5400_command_write (iHandle, 0xF10B, sizeof (UISetup1), UISetup1) < 0) { - HP5400_DBG (DBG_MSG, "failed to send UISetup1 (%d)\n", sizeof (UISetup1)); + HP5400_DBG (DBG_MSG, "failed to send UISetup1 (%lu)\n", (u_long) sizeof (UISetup1)); return -1; } diff --git a/backend/hp5400_sanei.c b/backend/hp5400_sanei.c index 97fada876..b1bc4a473 100644 --- a/backend/hp5400_sanei.c +++ b/backend/hp5400_sanei.c @@ -282,7 +282,8 @@ hp5400_bulk_read (int iHandle, size_t len, int block, FILE * file) sizeof (buf)); res = block; sanei_usb_read_bulk (fd, buffer, &res); - HP5400_DBG (DBG_MSG, "Read bulk returned %d, %d remain\n", res, len); + HP5400_DBG (DBG_MSG, "Read bulk returned %lu, %lu remain\n", + (u_long) res, (u_long) len); if (res > 0) { fwrite (buffer, (len < res) ? len : res, 1, file); @@ -312,7 +313,8 @@ hp5400_bulk_read_block (int iHandle, int iCmd, void *cmd, int cmdlen, _UsbWriteControl (fd, iCmd, 0, cmd, cmdlen); res = len; sanei_usb_read_bulk (fd, (SANE_Byte *) buffer, &res); - HP5400_DBG (DBG_MSG, "Read block returned %d when reading %d\n", res, len); + HP5400_DBG (DBG_MSG, "Read block returned %lu when reading %d\n", + (u_long) res, len); return res; } @@ -349,7 +351,7 @@ hp5400_bulk_command_write (int iHandle, int iCmd, void *cmd, int cmdlen, } res = (datalen < block) ? datalen : block; sanei_usb_write_bulk (fd, (SANE_Byte *) (data + offset), &res); - HP5400_DBG (DBG_MSG, "Write returned %d, %d remain\n", res, datalen); + HP5400_DBG (DBG_MSG, "Write returned %lu, %d remain\n", (u_long) res, datalen); datalen -= block; offset += block; } diff --git a/backend/ma1509.c b/backend/ma1509.c index 3c6a6bb9a..ef0ad6b00 100644 --- a/backend/ma1509.c +++ b/backend/ma1509.c @@ -822,8 +822,8 @@ calibration (Ma1509_Scanner * s) if (!buffer) { DBG (1, - "calibration: couldn't malloc %d bytes for calibration buffer\n", - total_size * 3); + "calibration: couldn't malloc %lu bytes for calibration buffer\n", + (u_long) (total_size * 3)); return SANE_STATUS_NO_MEM; } memset (buffer, 0x00, total_size); @@ -915,8 +915,8 @@ send_gamma (Ma1509_Scanner * s) buffer = malloc (total_size); if (!buffer) { - DBG (1, "send_gamma: couldn't malloc %d bytes for gamma buffer\n", - total_size); + DBG (1, "send_gamma: couldn't malloc %lu bytes for gamma buffer\n", + (u_long) total_size); return SANE_STATUS_NO_MEM; } diff --git a/backend/microtek.c b/backend/microtek.c index d757ed008..aed82abc0 100644 --- a/backend/microtek.c +++ b/backend/microtek.c @@ -2370,8 +2370,8 @@ static SANE_Status do_real_calibrate(Microtek_Scanner *s) nleft -= ntoget, spot += buffsize) { ntoget = (nleft > nmax) ? nmax : nleft; buffsize = ntoget * 3 * linewidth; - DBG(23, "...nleft %d toget %d size %d spot %d input+spot %p\n", - nleft, ntoget, buffsize, spot, input+spot); + DBG(23, "...nleft %d toget %d size %lu spot %d input+spot %p\n", + nleft, ntoget, (u_long) buffsize, spot, input+spot); if ((statusA = read_scan_data(s, ntoget, input+spot, &buffsize)) != SANE_STATUS_GOOD) { DBG(23, "...read scan failed\n"); diff --git a/backend/microtek2.c b/backend/microtek2.c index 6d7ccf168..b70576b35 100644 --- a/backend/microtek2.c +++ b/backend/microtek2.c @@ -257,8 +257,8 @@ sane_get_devices(const SANE_Device ***device_list, SANE_Bool local_only) sd_list = (const SANE_Device **) malloc( (md_num_devices + 1) * sizeof(SANE_Device **)); - DBG(100, "sane_get_devices: sd_list=%p, malloc'd %d bytes\n", - (void *) sd_list, (md_num_devices + 1) * sizeof(SANE_Device **)); + DBG(100, "sane_get_devices: sd_list=%p, malloc'd %lu bytes\n", + (void *) sd_list, (u_long) ((md_num_devices + 1) * sizeof(SANE_Device **))); if ( ! sd_list ) { @@ -540,8 +540,8 @@ sane_open(SANE_String_Const name, SANE_Handle *handle) return status; ms = malloc(sizeof(Microtek2_Scanner)); - DBG(100, "sane_open: ms=%p, malloc'd %d bytes\n", - (void *) ms, sizeof(Microtek2_Scanner)); + DBG(100, "sane_open: ms=%p, malloc'd %lu bytes\n", + (void *) ms, (u_long) sizeof(Microtek2_Scanner)); if ( ms == NULL ) { DBG(1, "sane_open: malloc() for ms failed\n"); @@ -718,8 +718,8 @@ add_device_list(SANE_String_Const dev_name, Microtek2_Device **mdev) } md = (Microtek2_Device *) malloc(sizeof(Microtek2_Device)); - DBG(100, "add_device_list: md=%p, malloc'd %d bytes\n", - (void *) md, sizeof(Microtek2_Device)); + DBG(100, "add_device_list: md=%p, malloc'd %lu bytes\n", + (void *) md, (u_long) sizeof(Microtek2_Device)); if ( md == NULL ) { DBG(1, "add_device_list: malloc() for md failed\n"); @@ -2230,8 +2230,8 @@ init_options(Microtek2_Scanner *ms, u_int8_t current_scan_source) free((void *) md->custom_gamma_table[color]); md->custom_gamma_table[color] = (SANE_Int *) malloc(tablesize * sizeof(SANE_Int)); - DBG(100, "init_options: md->custom_gamma_table[%d]=%p, malloc'd %d bytes\n", - color, (void *) md->custom_gamma_table[color],(tablesize * sizeof(SANE_Int))); + DBG(100, "init_options: md->custom_gamma_table[%d]=%p, malloc'd %lu bytes\n", + color, (void *) md->custom_gamma_table[color], (u_long) (tablesize * sizeof(SANE_Int))); if ( md->custom_gamma_table[color] == NULL ) { DBG(1, "init_options: malloc for custom gamma table failed\n"); @@ -4821,9 +4821,9 @@ scsi_read_shading(Microtek2_Scanner *ms, u_int8_t *buffer, u_int32_t length) if ( md_dump >= 2 ) dump_area2(cmd, RSI_CMD_L, "readshading"); - DBG(100, "scsi_read_shading: sfd=%d, cmd=%p, sizeofcmd=%d," - "dest=%p, destsize=%d\n", - ms->sfd, cmd, sizeof(cmd), buffer, size); + DBG(100, "scsi_read_shading: sfd=%d, cmd=%p, sizeofcmd=%lu," + "dest=%p, destsize=%lu\n", + ms->sfd, cmd, (u_long) sizeof(cmd), buffer, (u_long) size); status = sanei_scsi_cmd(ms->sfd, cmd, sizeof(cmd), buffer, &size); if ( status != SANE_STATUS_GOOD ) @@ -5281,8 +5281,8 @@ sane_start(SANE_Handle handle) { if (ms->control_bytes) free((void *)ms->control_bytes); ms->control_bytes = (u_int8_t *) malloc(ms->n_control_bytes); - DBG(100, "sane_start: ms->control_bytes=%p, malloc'd %d bytes\n", - ms->control_bytes, ms->n_control_bytes); + DBG(100, "sane_start: ms->control_bytes=%p, malloc'd %lu bytes\n", + ms->control_bytes, (u_long) ms->n_control_bytes); if ( ms->control_bytes == NULL ) { DBG(1, "sane_start: malloc() for control bits failed\n"); @@ -6660,8 +6660,8 @@ calc_cx_shading_line(Microtek2_Scanner *ms) status = SANE_STATUS_GOOD; sortbuf = malloc( md->shading_length * sizeof(float) ); - DBG(100, "calc_cx_shading: sortbuf= %p, malloc'd %d Bytes\n", - (void *) sortbuf, md->shading_length * sizeof(float)); + DBG(100, "calc_cx_shading: sortbuf= %p, malloc'd %lu Bytes\n", + (void *) sortbuf, (u_long) (md->shading_length * sizeof(float))); if ( sortbuf == NULL ) { DBG(1, "calc_cx_shading: malloc for sort buffer failed\n"); diff --git a/backend/mustek.c b/backend/mustek.c index da46075c8..04f9b1b6e 100644 --- a/backend/mustek.c +++ b/backend/mustek.c @@ -3707,8 +3707,8 @@ fix_line_distance_se (Mustek_Scanner * s, SANE_Int num_lines, SANE_Int bpl, } } DBG (5, "fix_line_distance_se: got saved line: %d; line: %d; " - "color: %d; raw bytes: %d; out bytes: %d\n", - s->ld.saved[color], lines[color], color, ptr - ptr_start, + "color: %d; raw bytes: %lu; out bytes: %d\n", + s->ld.saved[color], lines[color], color, (u_long) (ptr - ptr_start), s->params.pixels_per_line); ptr = ptr_start + bpc; } @@ -3783,8 +3783,8 @@ fix_line_distance_se (Mustek_Scanner * s, SANE_Int num_lines, SANE_Int bpl, } DBG (5, "fix_line_distance_se: got line: %d; color: %d; " - "raw bytes: %d; out bytes: %d\n", - lines[s->ld.color], s->ld.color, raw - raw_start, + "raw bytes: %lu; out bytes: %d\n", + lines[s->ld.color], s->ld.color, (u_long) (raw - raw_start), s->params.pixels_per_line); raw = raw_start + bpc; } diff --git a/backend/mustek_scsi_pp.c b/backend/mustek_scsi_pp.c index c43d6aa29..3dab544e8 100644 --- a/backend/mustek_scsi_pp.c +++ b/backend/mustek_scsi_pp.c @@ -787,7 +787,7 @@ mustek_scsi_pp_cmd (int fd, const void *src, size_t src_size, if (src_size < 6) { sanei_pa4s2_enable (fd, SANE_FALSE); - DBG (2, "mustek_scsi_pp_cmd: source size is only %d (<6)\n", src_size); + DBG (2, "mustek_scsi_pp_cmd: source size is only %lu (<6)\n", (u_long) src_size); return SANE_STATUS_INVAL; } @@ -811,8 +811,8 @@ mustek_scsi_pp_cmd (int fd, const void *src, size_t src_size, if (src_size > 6) { - DBG (5, "mustek_scsi_pp_cmd: sending data block of length %d\n", - src_size - 6); + DBG (5, "mustek_scsi_pp_cmd: sending data block of length %lu\n", + (u_long) (src_size - 6)); stat = mustek_scsi_pp_send_data_block (fd, ((const u_char *) src) + 6, @@ -839,8 +839,8 @@ mustek_scsi_pp_cmd (int fd, const void *src, size_t src_size, { sanei_pa4s2_enable (fd, SANE_FALSE); DBG (2, - "mustek_scsi_pp_cmd: buffer (size %d) not big enough for data (size %d)\n", - *dst_size, length); + "mustek_scsi_pp_cmd: buffer (size %lu) not big enough for data (size %d)\n", + (u_long) *dst_size, length); return SANE_STATUS_INVAL; } diff --git a/backend/nec.c b/backend/nec.c index 116830c3e..7b864e81a 100644 --- a/backend/nec.c +++ b/backend/nec.c @@ -3451,7 +3451,7 @@ sane_read_direct (SANE_Handle handle, SANE_Byte *dst_buf, SANE_Int max_len, DBG (20, "buffer_status: %i ", bs.fdb[0]*256*256 + bs.fdb[1]*256 + bs.fdb[2]); } #endif - DBG (20, "remaining: %i ", s->bytes_to_read); + DBG (20, "remaining: %lu ", (u_long) s->bytes_to_read); *len = 0; if (s->bytes_to_read == 0) @@ -3483,7 +3483,7 @@ sane_read_direct (SANE_Handle handle, SANE_Byte *dst_buf, SANE_Int max_len, } *len = nread; s->bytes_to_read -= nread; - DBG (20, "remaining: %i ", s->bytes_to_read); + DBG (20, "remaining: %lu ", (u_long) s->bytes_to_read); DBG (10, ">>\n"); return (SANE_STATUS_GOOD); diff --git a/backend/net.c b/backend/net.c index 2988b5f2a..0aadbbbed 100644 --- a/backend/net.c +++ b/backend/net.c @@ -1774,7 +1774,7 @@ sane_read (SANE_Handle handle, SANE_Byte * data, SANE_Int max_length, return SANE_STATUS_IO_ERROR; } } - DBG (4, "sane_read: read %d bytes, %d from 4 total\n", nread, + DBG (4, "sane_read: read %lu bytes, %d from 4 total\n", (u_long) nread, s->reclen_buf_offset); s->reclen_buf_offset += nread; if (s->reclen_buf_offset < 4) @@ -1918,8 +1918,8 @@ sane_read (SANE_Handle handle, SANE_Byte * data, SANE_Int max_length, *(data + cnt + 1) = swap_buf; } } - DBG (3, "sane_read: %d bytes read, %d remaining\n", nread, - s->bytes_remaining); + DBG (3, "sane_read: %lu bytes read, %lu remaining\n", (u_long) nread, + (u_long) s->bytes_remaining); return SANE_STATUS_GOOD; } diff --git a/backend/pie.c b/backend/pie.c index 8ccbaa28d..9a95717a1 100644 --- a/backend/pie.c +++ b/backend/pie.c @@ -1728,7 +1728,7 @@ pie_perform_cal (Pie_Scanner * scanner, int cal_index) set_read_length (sread.cmd, 1); size = rcv_length; - DBG (DBG_info, "pie_perform_cal: reading 1 line (%d bytes)\n", size); + DBG (DBG_info, "pie_perform_cal: reading 1 line (%lu bytes)\n", (u_long) size); status = sanei_scsi_cmd (scanner->sfd, sread.cmd, sread.size, rcv_buffer, @@ -1902,7 +1902,7 @@ pie_perform_cal (Pie_Scanner * scanner, int cal_index) return status; } - DBG (DBG_info, "pie_perform_cal: sending cal data (%d bytes)\n", size); + DBG (DBG_info, "pie_perform_cal: sending cal data (%lu bytes)\n", (u_long) size); DBG_DUMP (DBG_dump, send_buffer, 64); status = @@ -2691,7 +2691,7 @@ pie_reader_process_indexed (Pie_Scanner * scanner, FILE * fp) else { DBG (DBG_info2, - "pie_reader_process_indexed: got a line (%d bytes)\n", size); + "pie_reader_process_indexed: got a line (%lu bytes)\n", (u_long) size); /* just send the data on, assume filter bytes not present as per calibration case */ fwrite (buffer, 1, scanner->params.bytes_per_line, fp); diff --git a/backend/sharp.c b/backend/sharp.c index f5c39ee94..d95b2fac2 100644 --- a/backend/sharp.c +++ b/backend/sharp.c @@ -3388,7 +3388,7 @@ sane_start (SANE_Handle handle) return SANE_STATUS_NO_MEM; } s->rdr_ctl = (SHARP_rdr_ctl*) shmat(s->shmid, 0, 0); - if ((int)s->rdr_ctl == -1) + if (s->rdr_ctl == (void *) -1) { shmctl(s->shmid, IPC_RMID, &ds); free(s->buffer); @@ -3956,7 +3956,7 @@ sane_read_direct (SANE_Handle handle, SANE_Byte *dst_buf, SANE_Int max_len, size_t nread; DBG (10, "<< sane_read_direct "); - DBG (20, "remaining: %i ", s->bytes_to_read); + DBG (20, "remaining: %lu ", (u_long) s->bytes_to_read); *len = 0; if (s->bytes_to_read == 0) @@ -3985,7 +3985,7 @@ sane_read_direct (SANE_Handle handle, SANE_Byte *dst_buf, SANE_Int max_len, } *len = nread; s->bytes_to_read -= nread; - DBG (20, "remaining: %i ", s->bytes_to_read); + DBG (20, "remaining: %lu ", (u_long) s->bytes_to_read); DBG (10, ">>\n"); return (SANE_STATUS_GOOD); diff --git a/backend/snapscan-scsi.c b/backend/snapscan-scsi.c index d6d6d5a46..3801c260e 100644 --- a/backend/snapscan-scsi.c +++ b/backend/snapscan-scsi.c @@ -1063,7 +1063,7 @@ static SANE_Status read_calibration_data (SnapScan_Scanner *pss, void *buf, u_ch CHECK_STATUS (status, me, "snapscan_cmd"); if(read_bytes != expected_read_bytes) { - DBG (DL_MAJOR_ERROR, "%s: read %d of %d calibration data\n", me, read_bytes, expected_read_bytes); + DBG (DL_MAJOR_ERROR, "%s: read %lu of %lu calibration data\n", me, (u_long) read_bytes, (u_long) expected_read_bytes); return SANE_STATUS_IO_ERROR; } @@ -1203,7 +1203,7 @@ static SANE_Status download_firmware(SnapScan_Scanner * pss) break; } - DBG(DL_INFO, "Size of firmware: %d\n", bufLength); + DBG(DL_INFO, "Size of firmware: %lu\n", (u_long) bufLength); pCDB = (unsigned char *)malloc(bufLength + cdbLength); pFwBuf = pCDB + cdbLength; zero_buf (pCDB, cdbLength); @@ -1227,6 +1227,9 @@ static SANE_Status download_firmware(SnapScan_Scanner * pss) /* * $Log$ + * Revision 1.29 2004/10/03 17:34:36 hmg-guest + * 64 bit platform fixes (bug #300799). + * * Revision 1.28 2004/09/02 20:59:11 oliver-guest * Added support for Epson 2480 * diff --git a/backend/snapscan-sources.c b/backend/snapscan-sources.c index 17ae5e88c..6d3345920 100644 --- a/backend/snapscan-sources.c +++ b/backend/snapscan-sources.c @@ -192,9 +192,9 @@ static SANE_Status SCSISource_get (Source *pself, ps->scsi_buf_max = ps->pss->read_bytes; ndata = ps->pss->read_bytes; ps->pss->bytes_remaining -= ps->pss->read_bytes; - DBG (DL_DATA_TRACE, "%s: pos: %d; max: %d; expected: %d; read: %d\n", - me, ps->scsi_buf_pos, ps->scsi_buf_max, ps->pss->expected_read_bytes, - ps->pss->read_bytes); + DBG (DL_DATA_TRACE, "%s: pos: %d; max: %d; expected: %lu; read: %lu\n", + me, ps->scsi_buf_pos, ps->scsi_buf_max, (u_long) ps->pss->expected_read_bytes, + (u_long) ps->pss->read_bytes); } ndata = MIN(ndata, remaining); memcpy (pbuf, ps->pss->buf + ps->scsi_buf_pos, (size_t)ndata); @@ -766,13 +766,13 @@ static SANE_Status RGBRouter_get (Source *pself, } *plen -= remaining; DBG(DL_DATA_TRACE, - "%s: Request=%d, remaining=%d, read=%d, TXSource_rem=%d, bytes_rem=%d\n", + "%s: Request=%d, remaining=%d, read=%d, TXSource_rem=%d, bytes_rem=%lu\n", me, org_len, pself->remaining(pself), *plen, TxSource_remaining(pself), - ps->pss->bytes_remaining); + (u_long) ps->pss->bytes_remaining); return status; } @@ -962,6 +962,9 @@ static SANE_Status create_source_chain (SnapScan_Scanner *pss, /* * $Log$ + * Revision 1.10 2004/10/03 17:34:36 hmg-guest + * 64 bit platform fixes (bug #300799). + * * Revision 1.9 2004/04/09 16:18:37 oliver-guest * Fix initialization of FDSource.bytes_remaining * diff --git a/backend/snapscan-usb.c b/backend/snapscan-usb.c index 3db71bdc4..528517119 100644 --- a/backend/snapscan-usb.c +++ b/backend/snapscan-usb.c @@ -96,8 +96,8 @@ static SANE_Status snapscani_usb_cmd(int fd, const void *src, size_t src_size, static const char me[] = "snapscani_usb_cmd"; int status; - DBG (DL_CALL_TRACE, "%s(%d,0x%x,%d,0x%x,0x%x (%d))\n", me, - fd,(int)src,src_size,(int)dst,(int)dst_size,dst_size ? *dst_size : 0); + DBG (DL_CALL_TRACE, "%s(%d,0x%lx,%lu,0x%lx,0x%lx (%lu))\n", me, + fd, (u_long) src,(u_long) src_size,(u_long) dst, (u_long) dst_size,(u_long) (dst_size ? *dst_size : 0)); while(bqhead) { status = atomic_usb_cmd(fd, bqhead->src, bqhead->src_size, NULL, NULL); @@ -131,8 +131,8 @@ static SANE_Status atomic_usb_cmd(int fd, const void *src, size_t src_size, int status; sigset_t all,oldset; - DBG (DL_CALL_TRACE, "%s(%d,0x%x,%d,0x%x,0x%x (%d))\n", me, - fd,(int)src,src_size,(int)dst,(int)dst_size,dst_size ? *dst_size : 0); + DBG (DL_CALL_TRACE, "%s(%d,0x%lx,%lu,0x%lx,0x%lx (%lu))\n", me, + fd, (u_long) src,(u_long) src_size,(u_long) dst, (u_long) dst_size,(u_long) (dst_size ? *dst_size : 0)); /* Prevent the calling process from being killed */ sigfillset(&all); @@ -275,11 +275,11 @@ static SANE_Status usb_write(int fd, const void *buf, size_t n) { status = sanei_usb_write_bulk(fd, (const SANE_Byte*)buf, &bytes_written); if(bytes_written != n) { - DBG (DL_MAJOR_ERROR, "%s Only %d bytes written\n",me,bytes_written); + DBG (DL_MAJOR_ERROR, "%s Only %lu bytes written\n",me, (u_long) bytes_written); status = SANE_STATUS_IO_ERROR; } urb_counters->write_urbs += (bytes_written + 7) / 8; - DBG (DL_DATA_TRACE, "Written %d bytes\n", bytes_written); + DBG (DL_DATA_TRACE, "Written %lu bytes\n", (u_long) bytes_written); return status; } @@ -291,12 +291,12 @@ static SANE_Status usb_read(SANE_Int fd, void *buf, size_t n) { status = sanei_usb_read_bulk(fd, (SANE_Byte*)buf, &bytes_read); if (bytes_read != n) { - DBG (DL_MAJOR_ERROR, "%s Only %d bytes read\n",me,bytes_read); + DBG (DL_MAJOR_ERROR, "%s Only %lu bytes read\n",me, (u_long) bytes_read); status = SANE_STATUS_IO_ERROR; } urb_counters->read_urbs += ((63 + bytes_read) / 64); DBG(DL_DATA_TRACE, "%s: reading: %s\n",me,usb_debug_data(dbgmsg,buf,n)); - DBG(DL_DATA_TRACE, "Read %d bytes\n", bytes_read); + DBG(DL_DATA_TRACE, "Read %lu bytes\n", (u_long) bytes_read); return status; } @@ -344,9 +344,8 @@ static SANE_Status usb_cmd(int fd, const void *src, size_t src_size, int status,tstatus; int cmdlen,datalen; - DBG (DL_CALL_TRACE, "%s(%d,0x%x,%d,0x%x,0x%x (%d))\n", me, - fd,(int)src,src_size,(int)dst,(int)dst_size,dst_size ? *dst_size : 0); - + DBG (DL_CALL_TRACE, "%s(%d,0x%lx,%lu,0x%lx,0x%lx (%lu))\n", me, + fd, (u_long) src,(u_long) src_size,(u_long) dst, (u_long) dst_size,(u_long) (dst_size ? *dst_size : 0)); /* Since the "Send Diagnostic" command isn't supported by all Snapscan USB-scanners it's disabled . @@ -417,7 +416,7 @@ static int enqueue_bq(int fd,const void *src, size_t src_size) static const char me[] = "enqueue_bq"; struct usb_busy_queue *bqe; - DBG (DL_CALL_TRACE, "%s(%d,%p,%d)\n", me, fd,src,src_size); + DBG (DL_CALL_TRACE, "%s(%d,%p,%lu)\n", me, fd,src, (u_long) src_size); if((bqe = malloc(sizeof(struct usb_busy_queue))) == NULL) return -1; @@ -564,6 +563,9 @@ static void snapscani_usb_shm_exit(void) #endif /* * $Log$ + * Revision 1.19 2004/10/03 17:34:36 hmg-guest + * 64 bit platform fixes (bug #300799). + * * Revision 1.18 2004/06/16 19:52:26 oliver-guest * Don't enforce even number of URB packages on 1212u_2. Fixes bug #300753. * diff --git a/backend/snapscan.c b/backend/snapscan.c index 99aa8e8a1..cd3b0fafb 100644 --- a/backend/snapscan.c +++ b/backend/snapscan.c @@ -872,8 +872,8 @@ SANE_Status sane_open (SANE_String_Const name, SANE_Handle * h) pss->phys_buf_sz = sanei_scsi_max_request_size; } DBG (DL_DATA_TRACE, - "%s: Allocating %d bytes as scanner buffer.\n", - me, pss->phys_buf_sz); + "%s: Allocating %lu bytes as scanner buffer.\n", + me, (u_long) pss->phys_buf_sz); pss->buf = (u_char *) malloc(pss->phys_buf_sz); if (!pss->buf) { DBG (DL_MAJOR_ERROR, @@ -1837,6 +1837,9 @@ SANE_Status sane_get_select_fd (SANE_Handle h, SANE_Int * fd) /* * $Log$ + * Revision 1.45 2004/10/03 17:34:36 hmg-guest + * 64 bit platform fixes (bug #300799). + * * Revision 1.44 2004/09/02 20:59:12 oliver-guest * Added support for Epson 2480 * diff --git a/backend/teco3.c b/backend/teco3.c index a2398ec24..563126c55 100644 --- a/backend/teco3.c +++ b/backend/teco3.c @@ -1361,7 +1361,7 @@ teco_fill_image (Teco_Scanner * dev) MKSCSI_READ_10 (cdb, 0, 0, size); hexdump (DBG_info2, "teco_fill_image: READ_10 CDB", cdb.data, 10); - DBG (DBG_info, " image_end=%d\n", dev->image_end); + DBG (DBG_info, " image_end=%lu\n", (u_long) dev->image_end); if (dev->scan_mode == TECO_COLOR && dev->does_color_shift) { diff --git a/backend/test.c b/backend/test.c index 1af08ac61..b08bc62ca 100644 --- a/backend/test.c +++ b/backend/test.c @@ -1232,8 +1232,8 @@ reader_process (Test_Device * test_device, SANE_Int fd) if (status != SANE_STATUS_GOOD) return status; - DBG (2, "(child) reader_process: buffer=%p, buffersize=%d\n", - buffer, buffer_size); + DBG (2, "(child) reader_process: buffer=%p, buffersize=%lu\n", + buffer, (u_long) buffer_size); while (byte_count < bytes_total) { @@ -1254,8 +1254,8 @@ reader_process (Test_Device * test_device, SANE_Int fd) return SANE_STATUS_IO_ERROR; } byte_count += bytes_written; - DBG (4, "(child) reader_process: wrote %d bytes of %d (%d total)\n", - bytes_written, write_count, byte_count); + DBG (4, "(child) reader_process: wrote %ld bytes of %lu (%d total)\n", + (long) bytes_written, (u_long) write_count, byte_count); write_count -= bytes_written; } @@ -2653,7 +2653,7 @@ sane_read (SANE_Handle handle, SANE_Byte * data, *length = bytes_read; test_device->bytes_total += bytes_read; - DBG (2, "sane_read: read %d bytes of %d, total %d\n", bytes_read, + DBG (2, "sane_read: read %ld bytes of %d, total %d\n", (long) bytes_read, max_scan_length, test_device->bytes_total); return SANE_STATUS_GOOD; } diff --git a/backend/umax-usb.c b/backend/umax-usb.c index 70126d113..a125ac5c7 100644 --- a/backend/umax-usb.c +++ b/backend/umax-usb.c @@ -149,7 +149,7 @@ static SANE_Status sanei_umaxusb_cmd(int fd, const void *src, size_t src_size, v sanei_pv8630_prep_bulkread(fd, *dst_size); sanei_pv8630_bulkread(fd, dst, dst_size); - DBG(DBG_info, " SCSI cmd returned %d bytes\n", *dst_size); + DBG(DBG_info, " SCSI cmd returned %lu bytes\n", (u_long) *dst_size); sanei_pv8630_wait_byte(fd, PV8630_RSTATUS, 0xf8, 0xff, 1000); diff --git a/backend/umax1220u-common.c b/backend/umax1220u-common.c index 1d3abb25c..4ce62b7b6 100644 --- a/backend/umax1220u-common.c +++ b/backend/umax1220u-common.c @@ -370,7 +370,7 @@ cwrite (UMAX_Handle * scan, UMAX_Cmd cmd, size_t len, const unsigned char *data, static unsigned char *escaped = NULL; static size_t escaped_size = 0; - DBG (80, "cwrite: cmd = %d, len = %d\n", cmd, len); + DBG (80, "cwrite: cmd = %d, len = %lu\n", cmd, (u_long) len); CHK (usync (scan, cmd | CMD_WRITE, len)); @@ -414,7 +414,7 @@ cread (UMAX_Handle * scan, UMAX_Cmd cmd, size_t len, unsigned char *data, SANE_Status res; UMAX_Status_Byte s0, s4; - DBG (80, "cread: cmd = %d, len = %d\n", cmd, len); + DBG (80, "cread: cmd = %d, len = %lu\n", cmd, (u_long) len); CHK (usync (scan, cmd | CMD_READ, len)); @@ -433,7 +433,7 @@ cread (UMAX_Handle * scan, UMAX_Cmd cmd, size_t len, unsigned char *data, CHK (sanei_pv8630_bulkread (scan->fd, data, &n)); if (n < req) { - DBG (1, "qread: Expecting to read %d, only got %d\n", req, n); + DBG (1, "qread: Expecting to read %lu, only got %lu\n", (u_long) req, (u_long) n); return SANE_STATUS_IO_ERROR; } data += n; diff --git a/sanei/sanei_auth.c b/sanei/sanei_auth.c index a2afee779..cbba06c8b 100644 --- a/sanei/sanei_auth.c +++ b/sanei/sanei_auth.c @@ -228,7 +228,9 @@ sanei_authorize (const char *resource, } sprintf (md5resource, "%.128s$MD5$%x%lx%08lx", - resource, getpid (), time (NULL), randombits ()); + resource, getpid (), (long int) time (NULL), randombits ()); + + DBG(0, "resource=%s\n", md5resource); memset (username, 0, SANE_MAX_USERNAME_LEN); memset (password, 0, SANE_MAX_PASSWORD_LEN); diff --git a/sanei/sanei_lm983x.c b/sanei/sanei_lm983x.c index 81d4bea7a..5b41985c2 100644 --- a/sanei/sanei_lm983x.c +++ b/sanei/sanei_lm983x.c @@ -201,7 +201,7 @@ sanei_lm983x_read( SANE_Int fd, SANE_Byte reg, return result; read_bytes += size; - DBG( 15, "sanei_lm983x_read: read %d bytes\n", size ); + DBG( 15, "sanei_lm983x_read: read %lu bytes\n", (u_long) size ); if( read_bytes != max_len ) { DBG( 2, "sanei_lm983x_read: short read (%d/%d)\n", diff --git a/sanei/sanei_wire.c b/sanei/sanei_wire.c index 5baa080cc..d6f06182b 100644 --- a/sanei/sanei_wire.c +++ b/sanei/sanei_wire.c @@ -74,8 +74,8 @@ sanei_w_space (Wire * w, size_t howmuch) if (w->buffer.curr + howmuch > w->buffer.end) { - DBG (4, "sanei_w_space: free buffer size is %d\n", - w->buffer.end - w->buffer.curr); + DBG (4, "sanei_w_space: free buffer size is %lu\n", + (u_long) (w->buffer.end - w->buffer.curr)); switch (w->direction) { case WIRE_ENCODE: @@ -97,8 +97,8 @@ sanei_w_space (Wire * w, size_t howmuch) } w->buffer.curr = w->buffer.start; w->buffer.end = w->buffer.start + w->buffer.size; - DBG (4, "sanei_w_space: ENCODE: free buffer is now %d\n", - w->buffer.size); + DBG (4, "sanei_w_space: ENCODE: free buffer is now %lu\n", + (u_long) w->buffer.size); break; case WIRE_DECODE: @@ -137,8 +137,8 @@ sanei_w_space (Wire * w, size_t howmuch) w->buffer.end += nread; } while (left_over < howmuch); - DBG (4, "sanei_w_space: DECODE: %d bytes read\n", - w->buffer.end - w->buffer.start); + DBG (4, "sanei_w_space: DECODE: %lu bytes read\n", + (u_long) (w->buffer.end - w->buffer.start)); break; case WIRE_FREE: @@ -560,8 +560,8 @@ sanei_w_set_dir (Wire * w, WireDirection dir) w->direction == WIRE_ENCODE ? "ENCODE" : (w->direction == WIRE_DECODE ? "DECODE" : "FREE")); if (w->direction == WIRE_DECODE && w->buffer.curr != w->buffer.end) - DBG (1, "sanei_w_set_dir: WARNING: will delete %d bytes from buffer\n", - w->buffer.end - w->buffer.curr); + DBG (1, "sanei_w_set_dir: WARNING: will delete %lu bytes from buffer\n", + (u_long) (w->buffer.end - w->buffer.curr)); flush (w); w->direction = dir; DBG (4, "sanei_w_set_dir: direction changed\n");