kopia lustrzana https://gitlab.com/sane-project/backends
plustek: Fix [-Wformat-overflow=] compiler warnings on Debian 10
Also fixes a format truncation warning observed elsewhere.merge-requests/213/head
rodzic
3a4d5a002c
commit
790bdd822a
|
@ -193,6 +193,7 @@ usb_initDev( Plustek_Device *dev, int idx, int handle, int vendor )
|
|||
int i;
|
||||
ScanParam sParam;
|
||||
u_short tmp = 0;
|
||||
int ret = 0;
|
||||
|
||||
DBG( _DBG_INFO, "usb_initDev(%d,0x%04x,%i)\n",
|
||||
idx, vendor, dev->initialized );
|
||||
|
@ -305,11 +306,16 @@ usb_initDev( Plustek_Device *dev, int idx, int handle, int vendor )
|
|||
}
|
||||
|
||||
ptr = getenv ("HOME");
|
||||
if( NULL == ptr ) {
|
||||
sprintf( tmp_str2, "/tmp/%s", tmp_str1 );
|
||||
} else {
|
||||
sprintf( tmp_str2, "%s/.sane/%s", ptr, tmp_str1 );
|
||||
ret = ( NULL == ptr )?
|
||||
snprintf( tmp_str2, sizeof(tmp_str2), "/tmp/%s", tmp_str1 ):
|
||||
snprintf( tmp_str2, sizeof(tmp_str2), "%s/.sane/%s", ptr, tmp_str1 );
|
||||
|
||||
if ((ret < 0) || (ret > (int)sizeof(tmp_str2))) {
|
||||
DBG( _DBG_WARNING,
|
||||
"Failed to generate calibration file path. Default substituted.\n" );
|
||||
snprintf(tmp_str2, sizeof(tmp_str2), "/tmp/plustek-default");
|
||||
}
|
||||
|
||||
dev->calFile = strdup( tmp_str2 );
|
||||
DBG( _DBG_INFO, "Calibration file-names set to:\n" );
|
||||
DBG( _DBG_INFO, ">%s-coarse.cal<\n", dev->calFile );
|
||||
|
|
|
@ -1085,14 +1085,14 @@ init_options( Plustek_Scanner *s )
|
|||
/* scanner buttons */
|
||||
for( i = OPT_BUTTON_0; i <= OPT_BUTTON_LAST; i++ ) {
|
||||
|
||||
char name [12];
|
||||
char title [128];
|
||||
char buf [128];
|
||||
|
||||
sprintf (name, "button %d", i - OPT_BUTTON_0);
|
||||
sprintf (title, "Scanner button %d", i - OPT_BUTTON_0);
|
||||
snprintf (buf, sizeof(buf), "button %d", i - OPT_BUTTON_0);
|
||||
s->opt[i].name = strdup(buf);
|
||||
|
||||
snprintf (buf, sizeof(buf), "Scanner button %d", i - OPT_BUTTON_0);
|
||||
s->opt[i].title = strdup(buf);
|
||||
|
||||
s->opt[i].name = strdup(name);
|
||||
s->opt[i].title = strdup(title);
|
||||
s->opt[i].desc = SANE_I18N("This option reflects the status "
|
||||
"of the scanner buttons.");
|
||||
s->opt[i].type = SANE_TYPE_BOOL;
|
||||
|
|
Ładowanie…
Reference in New Issue