First pass of fixes for warnings.

merge-requests/14/head
Ralph Little 2021-08-19 19:57:08 -07:00
rodzic 0d96bd19fb
commit 34a0ebb0b5
6 zmienionych plików z 71 dodań i 65 usunięć

Wyświetl plik

@ -100,7 +100,8 @@ sanei_debug_msg
if (max_level >= level) if (max_level >= level)
{ {
if ( 1 == isfdtype(fileno(stderr), S_IFSOCK) ) struct stat statbuf;
if ((0 == fstat (fileno (stderr), &statbuf)) && S_ISSOCK(statbuf.st_mode))
{ {
msg = (char *)malloc (sizeof(char) * (strlen(be) + strlen(fmt) + 4)); msg = (char *)malloc (sizeof(char) * (strlen(be) + strlen(fmt) + 4));
if (msg == NULL) if (msg == NULL)

Wyświetl plik

@ -114,7 +114,7 @@ progress_update (Progress_t * p, gfloat newval)
#ifdef HAVE_SYS_TIME_H #ifdef HAVE_SYS_TIME_H
struct timeval tv; struct timeval tv;
int now; int now;
char buff[40]; char buff[100];
int remaining; int remaining;
#endif #endif
@ -126,6 +126,8 @@ progress_update (Progress_t * p, gfloat newval)
gtk_progress_bar_update (GTK_PROGRESS_BAR (p->pbar), newval); gtk_progress_bar_update (GTK_PROGRESS_BAR (p->pbar), newval);
#ifdef HAVE_SYS_TIME_H #ifdef HAVE_SYS_TIME_H
fprintf(stderr, "Hello!!!!!!!\n");
gettimeofday (&tv, NULL); gettimeofday (&tv, NULL);
now = tv.tv_sec * 1000 + tv.tv_usec / 1000; now = tv.tv_sec * 1000 + tv.tv_usec / 1000;
@ -138,6 +140,7 @@ progress_update (Progress_t * p, gfloat newval)
if (newval > p->firstVal && now - p->lastTime > 1000) if (newval > p->firstVal && now - p->lastTime > 1000)
{ {
fprintf(stderr, "Hello2!!!!!!!\n");
remaining = remaining =
(int) ((now - p->firstTime) * (1.0 - newval) / (newval - (int) ((now - p->firstTime) * (1.0 - newval) / (newval -
p->firstVal) / p->firstVal) /

Wyświetl plik

@ -1715,4 +1715,3 @@ List of available devices:", prog_name);
return (status == SANE_STATUS_GOOD) ? 0 : 1; return (status == SANE_STATUS_GOOD) ? 0 : 1;
} }

Wyświetl plik

@ -326,9 +326,9 @@ save_settings (const char *filename)
} }
#define MSG_MAXLEN 45 #define MSG_MAXLEN 45
#define CHAR_HEIGHT 11 #define TEXT_HEIGHT 11
#define CHAR_WIDTH 6 #define TEXT_WIDTH 6
#define CHAR_START 4 #define TEXT_START 4
static SANE_Status static SANE_Status
xcam_add_text (SANE_Byte * image, int width, int height, char *txt) xcam_add_text (SANE_Byte * image, int width, int height, char *txt)
@ -359,16 +359,16 @@ xcam_add_text (SANE_Byte * image, int width, int height, char *txt)
{ {
case SANE_FRAME_RGB: case SANE_FRAME_RGB:
for (y = 0; y < CHAR_HEIGHT; y++) for (y = 0; y < TEXT_HEIGHT; y++)
{ {
ptr = image + 3 * width * (height - CHAR_HEIGHT - 2 + y) + 12; ptr = image + 3 * width * (height - TEXT_HEIGHT - 2 + y) + 12;
for (x = 0; x < len; x++) for (x = 0; x < len; x++)
{ {
f = fontdata[line[x] * CHAR_HEIGHT + y]; f = fontdata[line[x] * TEXT_HEIGHT + y];
for (i = CHAR_WIDTH - 1; i >= 0; i--) for (i = TEXT_WIDTH - 1; i >= 0; i--)
{ {
if (f & (CHAR_START << i)) if (f & (TEXT_START << i))
{ {
ptr[0] = 255; ptr[0] = 255;
ptr[1] = 255; ptr[1] = 255;
@ -381,29 +381,32 @@ xcam_add_text (SANE_Byte * image, int width, int height, char *txt)
break; break;
case SANE_FRAME_GRAY: case SANE_FRAME_GRAY:
for (y = 0; y < CHAR_HEIGHT; y++) for (y = 0; y < TEXT_HEIGHT; y++)
{ {
ptr = image + width * (height - CHAR_HEIGHT - 2 + y) + 12; ptr = image + width * (height - TEXT_HEIGHT - 2 + y) + 12;
for (x = 0; x < len; x++) for (x = 0; x < len; x++)
{ {
f = fontdata[line[x] * CHAR_HEIGHT + y]; f = fontdata[line[x] * TEXT_HEIGHT + y];
for (i = CHAR_WIDTH - 1; i >= 0; i--) for (i = TEXT_WIDTH - 1; i >= 0; i--)
{ {
if (f & (CHAR_START << i)) if (f & (TEXT_START << i))
{ {
ptr[0] = 255; ptr[0] = 255;
} }
ptr += 1; ptr += 1;
} /* for i */ } /* for i */
} /* for x */ } /* for x */
} /* for y */ } /* for y */
break;
case SANE_FRAME_RED: case SANE_FRAME_RED:
case SANE_FRAME_GREEN: case SANE_FRAME_GREEN:
case SANE_FRAME_BLUE: case SANE_FRAME_BLUE:
snprintf (buf, sizeof (buf), snprintf (buf, sizeof (buf),
"Time stamp for separate channel transfers are not supported"); "Time stamp for separate channel transfers are not supported");
break; break;
default: default:
snprintf (buf, sizeof (buf), snprintf (buf, sizeof (buf),
"Unsupported image format %d", win.params.format); "Unsupported image format %d", win.params.format);