summaryrefslogtreecommitdiff
path: root/backend/lexmark_low.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2023-02-16 10:20:08 +0100
committerJörg Frings-Fürst <debian@jff.email>2023-02-16 10:20:08 +0100
commit778ebf8ee9cb22ea5727844333bcd5a6ee6bc0de (patch)
treea754e785b286ed82b45fe4e50b980714ad80e0a7 /backend/lexmark_low.c
parent7d8aac1f3634dc58785bec7acf097dd6bac8c394 (diff)
parent32cb765f681299af226ca0520993cbe47ba5ecd0 (diff)
Merge branch 'release/debian/1.2.1-1'debian/1.2.1-1
Diffstat (limited to 'backend/lexmark_low.c')
-rw-r--r--backend/lexmark_low.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/backend/lexmark_low.c b/backend/lexmark_low.c
index 052ae4d..246455f 100644
--- a/backend/lexmark_low.c
+++ b/backend/lexmark_low.c
@@ -4994,14 +4994,14 @@ sanei_lexmark_low_read_scan_data (SANE_Byte * data, SANE_Int size,
DBG (2, " Filled a buffer from the scanner\n");
DBG (2, " bytes_remaining: %lu\n", (u_long) dev->bytes_remaining);
DBG (2, " bytes_in_buffer: %lu\n", (u_long) dev->bytes_in_buffer);
- DBG (2, " read_pointer: %p\n", dev->read_pointer);
+ DBG (2, " read_pointer: %p\n", (void *) dev->read_pointer);
}
}
DBG (5, "READ BUFFER INFO: \n");
- DBG (5, " write ptr: %p\n", dev->read_buffer->writeptr);
- DBG (5, " read ptr: %p\n", dev->read_buffer->readptr);
- DBG (5, " max write ptr: %p\n", dev->read_buffer->max_writeptr);
+ DBG (5, " write ptr: %p\n", (void *) dev->read_buffer->writeptr);
+ DBG (5, " read ptr: %p\n", (void *) dev->read_buffer->readptr);
+ DBG (5, " max write ptr: %p\n", (void *) dev->read_buffer->max_writeptr);
DBG (5, " buffer size: %lu\n", (u_long) dev->read_buffer->size);
DBG (5, " line size: %lu\n", (u_long) dev->read_buffer->linesize);
DBG (5, " empty: %d\n", dev->read_buffer->empty);
@@ -5059,9 +5059,9 @@ sanei_lexmark_low_read_scan_data (SANE_Byte * data, SANE_Int size,
}
DBG (5, "READ BUFFER INFO: \n");
- DBG (5, " write ptr: %p\n", dev->read_buffer->writeptr);
- DBG (5, " read ptr: %p\n", dev->read_buffer->readptr);
- DBG (5, " max write ptr: %p\n", dev->read_buffer->max_writeptr);
+ DBG (5, " write ptr: %p\n", (void *) dev->read_buffer->writeptr);
+ DBG (5, " read ptr: %p\n", (void *) dev->read_buffer->readptr);
+ DBG (5, " max write ptr: %p\n", (void *) dev->read_buffer->max_writeptr);
DBG (5, " buffer size: %lu\n", (u_long) dev->read_buffer->size);
DBG (5, " line size: %lu\n", (u_long) dev->read_buffer->linesize);
DBG (5, " empty: %d\n", dev->read_buffer->empty);
@@ -5074,7 +5074,7 @@ sanei_lexmark_low_read_scan_data (SANE_Byte * data, SANE_Int size,
DBG (2, " Copying lines from buffer to data\n");
DBG (2, " bytes_remaining: %lu\n", (u_long) dev->bytes_remaining);
DBG (2, " bytes_in_buffer: %lu\n", (u_long) dev->bytes_in_buffer);
- DBG (2, " read_pointer: %p\n", dev->read_buffer->readptr);
+ DBG (2, " read_pointer: %p\n", (void *) dev->read_buffer->readptr);
DBG (2, " bytes_read %lu\n", (u_long) bytes_read);
/* if no more bytes to xfer and read buffer empty we're at the end */
@@ -5252,12 +5252,12 @@ read_buffer_bytes_available (Read_Buffer * rb)
if (rb->empty)
return rb->size;
- else if ((size_t) abs (rb->writeptr - rb->readptr) < rb->linesize)
- return 0; /* ptrs are less than one line apart */
else if (rb->writeptr < rb->readptr)
- return (rb->readptr - rb->writeptr - rb->linesize);
+ return (size_t)(rb->readptr - rb->writeptr) < rb->linesize ? 0 :
+ (size_t)(rb->readptr - rb->writeptr) - rb->linesize;
else
- return (rb->size + rb->readptr - rb->writeptr - rb->linesize);
+ return (size_t)(rb->writeptr - rb->readptr) < rb->linesize ? 0 :
+ rb->size - (size_t)(rb->writeptr - rb->readptr) - rb->linesize;
}
SANE_Status