summaryrefslogtreecommitdiff
path: root/backend/lexmark_low.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2023-02-12 17:36:29 +0100
committerJörg Frings-Fürst <debian@jff.email>2023-02-12 17:36:29 +0100
commit882fd010527b8d8823f09e19edbed3746265fa08 (patch)
treebe5c7cace6697afc753c152d13ad5145d0884a42 /backend/lexmark_low.c
parent527bedac30eb120915718eb7997e6dacd583512e (diff)
parente0d94cf4d39395df1e2c6bb4d967200298c13881 (diff)
Merge branch 'feature/upstream' into develop
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