From af663bc5e7b82ef847028a6c40760569e2dd11ad Mon Sep 17 00:00:00 2001 From: Mattias Ellert Date: Sun, 3 Feb 2008 10:34:20 +0000 Subject: [PATCH] Fix format warnings --- ChangeLog | 5 +++++ backend/dc25.c | 2 +- backend/epson2-commands.c | 29 +++++++++++++++-------------- backend/epson2-io.c | 13 +++++++------ backend/epson2.c | 12 ++++++------ backend/epson2_net.c | 23 +++++++++++++---------- backend/genesys.c | 4 ++-- backend/genesys_gl841.c | 15 +++++++++------ backend/hp3900_usb.c | 4 ++-- backend/lexmark_low.c | 16 ++++++++-------- backend/pixma.c | 3 +++ backend/plustek-usbhw.c | 2 +- backend/sm3840.c | 4 ++-- 13 files changed, 74 insertions(+), 58 deletions(-) diff --git a/ChangeLog b/ChangeLog index e80df123e..8160db407 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,11 @@ Fix warnings about ignored --datarootdir * backend/hp5590_low.c: Fix incompatible pointer type warning * backend/genesys_gl646.c: Fix incompatible pointer type warning + * backend/dc25.c, backend/epson2.c, backend/epson2-commands.c, + backend/epson2-io.c, backend/epson2_net.c, backend/genesys.c, + backend/genesys_gl841.c, backend/hp3900_usb.c, backend/lexmark_low.c, + backend/plustek-usbhw.c, backend/sm3840.c: Fix format warnings + * backend/pixma.c: Add missing #include 2008-02-02 Mattias Ellert diff --git a/backend/dc25.c b/backend/dc25.c index 14505d721..d431319a0 100644 --- a/backend/dc25.c +++ b/backend/dc25.c @@ -1907,7 +1907,7 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback UNUSEDARG authorize) tty_baud = DEFAULT_TTY_BAUD; break; } - DBG (20, "Config file baud=%d\n", tty_baud); + DBG (20, "Config file baud=%lu\n", (u_long) tty_baud); } else if (strcmp (dev_name, "dumpinquiry") == 0) { diff --git a/backend/epson2-commands.c b/backend/epson2-commands.c index 7928d40ce..626893ca7 100644 --- a/backend/epson2-commands.c +++ b/backend/epson2-commands.c @@ -335,17 +335,17 @@ esci_request_extended_identity(SANE_Handle handle, unsigned char *buf) return status; DBG(1, " command level : %c%c\n", buf[0], buf[1]); - DBG(1, " basic resolution: %d\n", le32atoh(&buf[4])); - DBG(1, " min resolution : %d\n", le32atoh(&buf[8])); - DBG(1, " max resolution : %d\n", le32atoh(&buf[12])); - DBG(1, " max pixel num : %d\n", le32atoh(&buf[16])); - DBG(1, " scan area : %dx%d\n", + DBG(1, " basic resolution: %lu\n", le32atoh(&buf[4])); + DBG(1, " min resolution : %lu\n", le32atoh(&buf[8])); + DBG(1, " max resolution : %lu\n", le32atoh(&buf[12])); + DBG(1, " max pixel num : %lu\n", le32atoh(&buf[16])); + DBG(1, " scan area : %lux%lu\n", le32atoh(&buf[20]), le32atoh(&buf[24])); - DBG(1, " adf area : %dx%d\n", + DBG(1, " adf area : %lux%lu\n", le32atoh(&buf[28]), le32atoh(&buf[32])); - DBG(1, " tpu area : %dx%d\n", + DBG(1, " tpu area : %lux%lu\n", le32atoh(&buf[36]), le32atoh(&buf[40])); DBG(1, " main status : 0x%02x\n", buf[44]); @@ -507,12 +507,12 @@ esci_set_scanning_parameter(SANE_Handle handle, unsigned char *buf) params[0] = FS; params[1] = 'W'; - DBG(10, "resolution of main scan : %d\n", le32atoh(&buf[0])); - DBG(10, "resolution of sub scan : %d\n", le32atoh(&buf[4])); - DBG(10, "offset length of main scan : %d\n", le32atoh(&buf[8])); - DBG(10, "offset length of sub scan : %d\n", le32atoh(&buf[12])); - DBG(10, "scanning length of main scan: %d\n", le32atoh(&buf[16])); - DBG(10, "scanning length of sub scan : %d\n", le32atoh(&buf[20])); + DBG(10, "resolution of main scan : %lu\n", le32atoh(&buf[0])); + DBG(10, "resolution of sub scan : %lu\n", le32atoh(&buf[4])); + DBG(10, "offset length of main scan : %lu\n", le32atoh(&buf[8])); + DBG(10, "offset length of sub scan : %lu\n", le32atoh(&buf[12])); + DBG(10, "scanning length of main scan: %lu\n", le32atoh(&buf[16])); + DBG(10, "scanning length of sub scan : %lu\n", le32atoh(&buf[20])); DBG(10, "scanning color : %d\n", buf[24]); DBG(10, "data format : %d\n", buf[25]); DBG(10, "option control : %d\n", buf[26]); @@ -803,7 +803,8 @@ esci_request_extended_status(SANE_Handle handle, unsigned char **data, case 42: break; default: - DBG(1, "%s: unknown reply length (%d)\n", __func__, buf_len); + DBG(1, "%s: unknown reply length (%lu)\n", __func__, + (u_long) buf_len); break; } diff --git a/backend/epson2-io.c b/backend/epson2-io.c index fe8730c19..2276cb629 100644 --- a/backend/epson2-io.c +++ b/backend/epson2-io.c @@ -195,7 +195,7 @@ e2_cmd_simple(Epson_Scanner * s, void *buf, size_t buf_size) unsigned char result; SANE_Status status; - DBG(12, "%s: size = %d\n", __func__, buf_size); + DBG(12, "%s: size = %lu\n", __func__, (u_long) buf_size); status = e2_txrx(s, buf, buf_size, &result, 1); if (status != SANE_STATUS_GOOD) { @@ -261,7 +261,8 @@ e2_recv_info_block(Epson_Scanner * s, unsigned char *scanner_status, if (info_size == 6) *payload_size *= le16atoh(&info[4]); - DBG(14, "%s: payload length: %d\n", __func__, *payload_size); + DBG(14, "%s: payload length: %lu\n", __func__, + (u_long) *payload_size); } return SANE_STATUS_GOOD; @@ -283,8 +284,8 @@ e2_cmd_info_block(SANE_Handle handle, unsigned char *params, Epson_Scanner *s = (Epson_Scanner *) handle; size_t len; - DBG(13, "%s, params len = %d, reply len = %d, buf = %p\n", - __func__, params_len, reply_len, (void *) buf); + DBG(13, "%s, params len = %d, reply len = %lu, buf = %p\n", + __func__, params_len, (u_long) reply_len, (void *) buf); if (buf == NULL) return SANE_STATUS_INVAL; @@ -315,8 +316,8 @@ e2_cmd_info_block(SANE_Handle handle, unsigned char *params, * length differs, throw a warning */ if (reply_len && (len != reply_len)) { - DBG(1, "%s: mismatched len - expected %d, got %d\n", - __func__, reply_len, len); + DBG(1, "%s: mismatched len - expected %lu, got %lu\n", + __func__, (u_long) reply_len, (u_long) len); } /* allocate and receive the payload */ diff --git a/backend/epson2.c b/backend/epson2.c index 36727040b..1bb2d03b2 100644 --- a/backend/epson2.c +++ b/backend/epson2.c @@ -3817,9 +3817,9 @@ e2_start_ext_scan(Epson_Scanner * s) s->ext_counter = 0; DBG(5, " status : 0x%02x\n", buf[1]); - DBG(5, " block size : %d\n", le32atoh(&buf[2])); - DBG(5, " block count : %d\n", le32atoh(&buf[6])); - DBG(5, " last block size: %d\n", le32atoh(&buf[10])); + DBG(5, " block size : %lu\n", le32atoh(&buf[2])); + DBG(5, " block count : %lu\n", le32atoh(&buf[6])); + DBG(5, " last block size: %lu\n", le32atoh(&buf[10])); if (s->ext_last_len) { s->ext_blocks++; @@ -4190,13 +4190,13 @@ e2_ext_sane_read(SANE_Handle handle) if (s->ext_counter == s->ext_blocks && s->ext_last_len) buf_len = s->ext_last_len; - DBG(18, "%s: block %d, size %d\n", __func__, s->ext_counter, - buf_len); + DBG(18, "%s: block %d, size %lu\n", __func__, s->ext_counter, + (u_long) buf_len); /* receive image data + error code */ read = e2_recv(s, s->buf, buf_len + 1, &status); - DBG(18, "%s: read %d bytes\n", __func__, read); + DBG(18, "%s: read %lu bytes\n", __func__, (u_long) read); if (read != buf_len + 1) return SANE_STATUS_IO_ERROR; diff --git a/backend/epson2_net.c b/backend/epson2_net.c index fe483a233..9ead4b343 100644 --- a/backend/epson2_net.c +++ b/backend/epson2_net.c @@ -77,8 +77,8 @@ sanei_epson_net_read(Epson_Scanner *s, unsigned char *buf, size_t wanted, /* read from buffer, if available */ if (s->netptr != s->netbuf) { - DBG(4, "reading %d from buffer at %p, %d available\n", - wanted, s->netptr, s->netlen); + DBG(4, "reading %lu from buffer at %p, %lu available\n", + (u_long) wanted, s->netptr, (u_long) s->netlen); memcpy(buf, s->netptr, wanted); read = wanted; @@ -105,7 +105,8 @@ sanei_epson_net_read(Epson_Scanner *s, unsigned char *buf, size_t wanted, } size = be32atoh(&header[6]); - DBG(4, "%s: wanted = %d, available = %d\n", __FUNCTION__, wanted, size); + DBG(4, "%s: wanted = %lu, available = %lu\n", __FUNCTION__, + (u_long) wanted, (u_long) size); *status = SANE_STATUS_GOOD; @@ -128,8 +129,8 @@ sanei_epson_net_read(Epson_Scanner *s, unsigned char *buf, size_t wanted, read = wanted; DBG(4, "0,4 %02x %02x\n", s->netbuf[0], s->netbuf[4]); - DBG(4, "storing %d to buffer at %p, next read at %p, %d bytes left\n", - size, s->netbuf, s->netptr, s->netlen); + DBG(4, "storing %lu to buffer at %p, next read at %p, %lu bytes left\n", + (u_long) size, s->netbuf, s->netptr, (u_long) s->netlen); memcpy(buf, s->netbuf, wanted); } @@ -154,10 +155,12 @@ sanei_epson_net_write(Epson_Scanner *s, unsigned int cmd, const unsigned char *b if (reply_len) { s->netbuf = s->netptr = malloc(reply_len); s->netlen = reply_len; - DBG(8, "allocated %d bytes at %p\n", reply_len, s->netbuf); + DBG(8, "allocated %lu bytes at %p\n", + (u_long) reply_len, s->netbuf); } - DBG(2, "%s: cmd = %04x, buf = %p, buf_size = %d, reply_len = %d\n", __FUNCTION__, cmd, buf, buf_size, reply_len); + DBG(2, "%s: cmd = %04x, buf = %p, buf_size = %lu, reply_len = %lu\n", + __FUNCTION__, cmd, buf, (u_long) buf_size, (u_long) reply_len); memset(h1, 0x00, 12); memset(h2, 0x00, 8); @@ -179,9 +182,9 @@ sanei_epson_net_write(Epson_Scanner *s, unsigned int cmd, const unsigned char *b htobe32a(&h2[0], buf_size); htobe32a(&h2[4], reply_len); - DBG(9, "H1[6]: %02x %02x %02x %02x (%d)\n", h1[6], h1[7], h1[8], h1[9], buf_size + 8); - DBG(9, "H2[0]: %02x %02x %02x %02x (%d)\n", h2[0], h2[1], h2[2], h2[3], buf_size); - DBG(9, "H2[4]: %02x %02x %02x %02x (%d)\n", h2[4], h2[5], h2[6], h2[7], reply_len); + DBG(9, "H1[6]: %02x %02x %02x %02x (%lu)\n", h1[6], h1[7], h1[8], h1[9], (u_long) (buf_size + 8)); + DBG(9, "H2[0]: %02x %02x %02x %02x (%lu)\n", h2[0], h2[1], h2[2], h2[3], (u_long) buf_size); + DBG(9, "H2[4]: %02x %02x %02x %02x (%lu)\n", h2[4], h2[5], h2[6], h2[7], (u_long) reply_len); } if ((cmd >> 8) == 0x20 && (buf_size || reply_len)) { diff --git a/backend/genesys.c b/backend/genesys.c index a86a5bedf..48919d6c3 100644 --- a/backend/genesys.c +++ b/backend/genesys.c @@ -4045,10 +4045,10 @@ genesys_read_ordered_data (Genesys_Device * dev, SANE_Byte * destination, } #endif - DBG (DBG_info, "genesys_read_ordered_data: %d lines left by output\n", + DBG (DBG_info, "genesys_read_ordered_data: %lu lines left by output\n", ((dev->total_bytes_to_read - dev->total_bytes_read) * 8) / (dev->settings.pixels * channels * depth)); - DBG (DBG_info, "genesys_read_ordered_data: %d lines left by input\n", + DBG (DBG_info, "genesys_read_ordered_data: %lu lines left by input\n", ((dev->read_bytes_left + dev->read_buffer.avail) * 8) / (src_pixels * channels * depth)); diff --git a/backend/genesys_gl841.c b/backend/genesys_gl841.c index e6856539e..3977ffec0 100644 --- a/backend/genesys_gl841.c +++ b/backend/genesys_gl841.c @@ -420,7 +420,8 @@ gl841_bulk_write_register (Genesys_Device * dev, } - DBG (DBG_io, "gl841_bulk_write_register: wrote %d registers\n", elems); + DBG (DBG_io, "gl841_bulk_write_register: wrote %lu registers\n", + (u_long) elems); return status; } @@ -640,7 +641,8 @@ gl841_bulk_write_data_gamma (Genesys_Device * dev, u_int8_t addr, size_t size; u_int8_t outdata[8]; - DBG (DBG_io, "gl841_bulk_write_data_gamma writing %d bytes\n", len); + DBG (DBG_io, "gl841_bulk_write_data_gamma writing %lu bytes\n", + (u_long) len); status = sanei_usb_control_msg (dev->dn, REQUEST_TYPE_OUT, REQUEST_REGISTER, @@ -690,8 +692,9 @@ gl841_bulk_write_data_gamma (Genesys_Device * dev, u_int8_t addr, return status; } - DBG (DBG_io2, "genesys_bulk_write_data:gamma wrote %d bytes, %d remaining\n", - size, (len - size)); + DBG (DBG_io2, + "genesys_bulk_write_data:gamma wrote %lu bytes, %lu remaining\n", + (u_long) size, (u_long) (len - size)); len -= size; data += size; @@ -2981,8 +2984,8 @@ dummy \ scanned lines dev->read_bytes_left = bytes_per_line * lincnt; DBG (DBG_info, - "gl841_init_scan_regs: physical bytes to read = %d\n", - dev->read_bytes_left); + "gl841_init_scan_regs: physical bytes to read = %lu\n", + (u_long) dev->read_bytes_left); dev->read_active = SANE_TRUE; diff --git a/backend/hp3900_usb.c b/backend/hp3900_usb.c index b38ce8d3d..dba317fc7 100644 --- a/backend/hp3900_usb.c +++ b/backend/hp3900_usb.c @@ -331,8 +331,8 @@ Read_Bulk (USB_Handle usb_handle, SANE_Byte * buffer, size_t size) if (buffer != NULL) { dataline_count++; - DBG (DBG_CTL, "%06i BLK DI: Buffer length = %u. bytes\n", - dataline_count, size); + DBG (DBG_CTL, "%06i BLK DI: Buffer length = %lu bytes\n", + dataline_count, (u_long) size); #ifdef STANDALONE if (usb_handle != NULL) diff --git a/backend/lexmark_low.c b/backend/lexmark_low.c index 8f12d252a..29ae2009f 100644 --- a/backend/lexmark_low.c +++ b/backend/lexmark_low.c @@ -826,8 +826,8 @@ low_usb_bulk_write (SANE_Int devnum, SANE_Byte * cmd, size_t * size) if (status != SANE_STATUS_GOOD) { DBG (5, - "low_usb_bulk_write: returned %s (size = %ld, expected %d)\n", - sane_strstatus (status), (long int) *size, cmd_size); + "low_usb_bulk_write: returned %s (size = %lu, expected %lu)\n", + sane_strstatus (status), (u_long) *size, (u_long) cmd_size); /* F.O. should reset the pipe here... */ } return status; @@ -848,12 +848,12 @@ low_usb_bulk_read (SANE_Int devnum, SANE_Byte * buf, size_t * size) if (status != SANE_STATUS_GOOD) { DBG (5, - "low_usb_bulk_read: returned %s (size = %ld, expected %d)\n", - sane_strstatus (status), (long int) *size, exp_size); + "low_usb_bulk_read: returned %s (size = %lu, expected %lu)\n", + sane_strstatus (status), (u_long) *size, (u_long) exp_size); /* F.O. should reset the pipe here... */ } - DBG (7, "low_usb_bulk_read: returned size = %ld (required %d)\n", - (long int) *size, exp_size); + DBG (7, "low_usb_bulk_read: returned size = %lu (required %lu)\n", + (u_long) *size, (u_long) exp_size); return status; } @@ -1059,8 +1059,8 @@ low_simple_scan (Lexmark_Device * dev, SANE_Byte * regs, int xoffset, /* data reading loop */ needed = bpl * lines; - DBG (1, "low_simple_scan: bpl=%d, lines=%d, needed=%d.\n", bpl, lines, - needed); + DBG (1, "low_simple_scan: bpl=%d, lines=%d, needed=%lu.\n", bpl, lines, + (u_long) needed); read = 0; do { diff --git a/backend/pixma.c b/backend/pixma.c index dd22f04b0..35616ed0d 100644 --- a/backend/pixma.c +++ b/backend/pixma.c @@ -45,6 +45,9 @@ #include #include #include +#ifdef USE_PTHREAD +# include +#endif #include /* sigaction(POSIX) */ #include /* POSIX: write read close pipe */ #ifdef HAVE_FCNTL_H diff --git a/backend/plustek-usbhw.c b/backend/plustek-usbhw.c index 49e91fbb4..a89bc590b 100644 --- a/backend/plustek-usbhw.c +++ b/backend/plustek-usbhw.c @@ -1380,7 +1380,7 @@ usb_ResetRegisters( Plustek_Device *dev ) u_char *regs = dev->usbDev.a_bRegs; DBG( _DBG_INFO, "RESETTING REGISTERS(%i) - 0x%02x\n", - dev->initialized,sizeof(dev->usbDev.a_bRegs)); + dev->initialized, (int) sizeof(dev->usbDev.a_bRegs)); memset( regs, 0, sizeof(dev->usbDev.a_bRegs)); memcpy( regs+0x0b, &hw->bSensorConfiguration, 4 ); diff --git a/backend/sm3840.c b/backend/sm3840.c index 6f8abecc3..8a0f42d16 100755 --- a/backend/sm3840.c +++ b/backend/sm3840.c @@ -148,8 +148,8 @@ sane_read (SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len, DBG (2, "+sane-read:%p %p %d %p\n", (unsigned char *) s, buf, max_len, (unsigned char *) len); DBG (2, - "+sane-read:remain:%d offset:%d linesleft:%d linebuff:%p linesread:%d\n", - s->remaining, s->offset, s->linesleft, s->line_buffer, s->linesread); + "+sane-read:remain:%lu offset:%lu linesleft:%d linebuff:%p linesread:%d\n", + (u_long)s->remaining, (u_long)s->offset, s->linesleft, s->line_buffer, s->linesread); if (!s->scanning) return SANE_STATUS_INVAL;