From 1687222e1b9e74c89cafbb5910e72d8ec7bfd40f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 31 Jul 2019 16:59:49 +0200 Subject: New upstream version 1.0.28 --- backend/ricoh.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'backend/ricoh.c') diff --git a/backend/ricoh.c b/backend/ricoh.c index 88f33d1..58b3a53 100644 --- a/backend/ricoh.c +++ b/backend/ricoh.c @@ -41,7 +41,7 @@ /* $Id$ - This file implements a SANE backend for Ricoh flatbed scanners. + This file implements a SANE backend for Ricoh flatbed scanners. */ #include "../include/sane/config.h" @@ -187,7 +187,7 @@ attach (const char *devnam, Ricoh_Device ** devp) DBG (1, "attach: MODE_SELECT failed\n"); sanei_scsi_close (fd); return (SANE_STATUS_INVAL); - } + } #endif #if 0 @@ -510,7 +510,7 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) if (line[0] == '#') /* ignore line comments */ continue; len = strlen (line); - + if (!len) continue; /* ignore empty lines */ @@ -538,7 +538,7 @@ sane_exit (void) free ((void *) dev->sane.model); free (dev); } - + if (devlist) free (devlist); @@ -824,7 +824,7 @@ sane_start (SANE_Handle handle) s->brightness = s->val[OPT_BRIGHTNESS].w; s->contrast = s->val[OPT_CONTRAST].w; s->bpp = s->params.depth; - if (strcmp (mode_str, SANE_VALUE_SCAN_MODE_LINEART) == 0) + if (strcmp (mode_str, SANE_VALUE_SCAN_MODE_LINEART) == 0) { s->image_composition = RICOH_BINARY_MONOCHROME; } @@ -849,11 +849,11 @@ sane_start (SANE_Handle handle) wbuf.image_comp = s->image_composition; /* if you throw the MRIF bit the brighness control reverses too */ /* so I reverse the reversal in software for symmetry's sake */ - if (wbuf.image_comp == RICOH_GRAYSCALE || wbuf.image_comp == RICOH_DITHERED_MONOCHROME) + if (wbuf.image_comp == RICOH_GRAYSCALE || wbuf.image_comp == RICOH_DITHERED_MONOCHROME) { - if (wbuf.image_comp == RICOH_GRAYSCALE) + if (wbuf.image_comp == RICOH_GRAYSCALE) wbuf.mrif_filtering_gamma_id = (SANE_Byte) 0x90; - if (wbuf.image_comp == RICOH_DITHERED_MONOCHROME) + if (wbuf.image_comp == RICOH_DITHERED_MONOCHROME) wbuf.mrif_filtering_gamma_id = (SANE_Byte) 0x10; wbuf.brightness = 256 - (SANE_Byte) s->brightness; if (is50) @@ -899,7 +899,7 @@ sane_start (SANE_Handle handle) if (status != SANE_STATUS_GOOD) { DBG (1, "GET WINDOW failed: %s\n", sane_strstatus (status)); - return (status); + return (status); } DBG (5, "xres=%d\n", _2btol(wbuf.x_res)); DBG (5, "yres=%d\n", _2btol(wbuf.y_res)); @@ -937,18 +937,18 @@ sane_start (SANE_Handle handle) { DBG (1, "GET DATA STATUS failed: %s\n", sane_strstatus (status)); return (status); - } + } s->bytes_to_read = s->params.bytes_per_line * s->params.lines; DBG (1, "%d pixels per line, %d bytes, %d lines high, total %lu bytes, " "dpi=%d\n", s->params.pixels_per_line, s->params.bytes_per_line, s->params.lines, (u_long) s->bytes_to_read, s->val[OPT_Y_RESOLUTION].w); - + s->scanning = SANE_TRUE; - DBG (11, "<< sane_start\n"); - return (SANE_STATUS_GOOD); + DBG (11, "<< sane_start\n"); + return (SANE_STATUS_GOOD); } SANE_Status @@ -963,7 +963,7 @@ sane_read (SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len, *len = 0; DBG (11, "sane_read: bytes left to read: %ld\n", (u_long) s->bytes_to_read); - + if (s->bytes_to_read == 0) { do_cancel (s); @@ -973,7 +973,7 @@ sane_read (SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len, if (!s->scanning) { DBG (11, "sane_read: scanning is false!\n"); return (do_cancel (s)); - } + } nread = max_len; if (nread > s->bytes_to_read) -- cgit v1.2.3 From ffa8801644a7d53cc1c785e3450f794c07a14eb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 2 Feb 2020 17:13:01 +0100 Subject: New upstream version 1.0.29 --- backend/ricoh.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'backend/ricoh.c') diff --git a/backend/ricoh.c b/backend/ricoh.c index 58b3a53..fbe5c58 100644 --- a/backend/ricoh.c +++ b/backend/ricoh.c @@ -222,12 +222,14 @@ attach (const char *devnam, Ricoh_Device ** devp) dev->sane.name = strdup (devnam); dev->sane.vendor = "RICOH"; - str = malloc (sizeof(ibuf.product) + sizeof(ibuf.revision) + 1); + + size_t prod_rev_size = sizeof(ibuf.product) + sizeof(ibuf.revision) + 1; + str = malloc (prod_rev_size); if (str) { - str[0] = '\0'; - strncat (str, (char *)ibuf.product, sizeof(ibuf.product)); - strncat (str, (char *)ibuf.revision, sizeof(ibuf.revision)); + snprintf (str, prod_rev_size, "%.*s%.*s", + (int) sizeof(ibuf.product), (const char *) ibuf.product, + (int) sizeof(ibuf.revision), (const char *) ibuf.revision); } dev->sane.model = str; dev->sane.type = "flatbed scanner"; -- cgit v1.2.3