Commit 59c01e6539ae6b325c3739dc8d872c3f7ac0a8ae

Authored by Perry Werneck
1 parent 1e6e062f

Removing warnings.

src/lib3270/linux/connect.c
... ... @@ -58,8 +58,7 @@
58 58 /*---[ Implement ]-------------------------------------------------------------------------------*/
59 59  
60 60  
61   -//static void net_connected(H3270 *hSession)
62   -static void net_connected(H3270 *hSession, int fd unused, LIB3270_IO_FLAG flag unused, void *dunno unused)
  61 +static void net_connected(H3270 *hSession, int GNUC_UNUSED(fd), LIB3270_IO_FLAG GNUC_UNUSED(flag), void GNUC_UNUSED(*dunno))
63 62 {
64 63 int err;
65 64 socklen_t len = sizeof(err);
... ...
src/lib3270/private.h
... ... @@ -86,16 +86,24 @@
86 86 #define BLOCKING_CONNECT_ONLY 1
87 87 #endif /*]*/
88 88  
89   -/*
90   - * Compiler-specific #defines.
91   - */
  89 +//
  90 +// Compiler-specific #defines.
  91 +//
  92 +// Reference: GLIBC gmacros.h
  93 +//
  94 +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
92 95  
93   -/* 'unused' explicitly flags an unused parameter */
94   -#if defined(__GNUC__)
95 96 #define unused __attribute__((__unused__))
  97 +
  98 + #define GNUC_UNUSED \
  99 + __attribute__((__unused__))
  100 +
96 101 #else
  102 +
97 103 #define unused
  104 + #define GNUC_UNUSED
98 105 #define printflike(s, f)
  106 +
99 107 #endif
100 108  
101 109  
... ...
src/lib3270/see.c
... ... @@ -369,43 +369,43 @@ static const char * see_input_control(unsigned char setting)
369 369  
370 370 const char * see_efa(unsigned char efa, unsigned char value)
371 371 {
372   - static char buf[64];
  372 + static char buf[80];
373 373  
374 374 switch (efa) {
375 375 case XA_ALL:
376   - (void) sprintf(buf, " all(%x)", value);
  376 + (void) snprintf(buf, sizeof(buf), " all(%x)", value);
377 377 break;
378 378 case XA_3270:
379   - (void) sprintf(buf, " 3270%s", see_attr(value));
  379 + (void) snprintf(buf, sizeof(buf), " 3270%s", see_attr(value));
380 380 break;
381 381 case XA_VALIDATION:
382   - (void) sprintf(buf, " validation%s", see_validation(value));
  382 + (void) snprintf(buf, sizeof(buf), " validation%s", see_validation(value));
383 383 break;
384 384 case XA_OUTLINING:
385   - (void) sprintf(buf, " outlining(%s)", see_outline(value));
  385 + (void) snprintf(buf, sizeof(buf), " outlining(%s)", see_outline(value));
386 386 break;
387 387 case XA_HIGHLIGHTING:
388   - (void) sprintf(buf, " highlighting(%s)", see_highlight(value));
  388 + (void) snprintf(buf, sizeof(buf), " highlighting(%s)", see_highlight(value));
389 389 break;
390 390 case XA_FOREGROUND:
391   - (void) sprintf(buf, " foreground(%s)", see_color(value));
  391 + (void) snprintf(buf, sizeof(buf), " foreground(%s)", see_color(value));
392 392 break;
393 393 case XA_CHARSET:
394   - (void) sprintf(buf, " charset(%x)", value);
  394 + (void) snprintf(buf, sizeof(buf), " charset(%x)", value);
395 395 break;
396 396 case XA_BACKGROUND:
397 397 (void) sprintf(buf, " background(%s)", see_color(value));
398 398 break;
399 399 case XA_TRANSPARENCY:
400   - (void) sprintf(buf, " transparency(%s)",
  400 + (void) snprintf(buf, sizeof(buf), " transparency(%s)",
401 401 see_transparency(value));
402 402 break;
403 403 case XA_INPUT_CONTROL:
404   - (void) sprintf(buf, " input-control(%s)",
  404 + (void) snprintf(buf, sizeof(buf), " input-control(%s)",
405 405 see_input_control(value));
406 406 break;
407 407 default:
408   - (void) sprintf(buf, " %s[0x%x]", unknown(efa), value);
  408 + (void) snprintf(buf, sizeof(buf), " %s[0x%x]", unknown(efa), value);
409 409 break;
410 410 }
411 411 return buf;
... ...
src/lib3270/trace_ds.c
... ... @@ -76,8 +76,8 @@ static void wtrace(H3270 *session, const char *fmt, ...);
76 76 /* display a (row,col) */
77 77 const char * rcba(H3270 *hSession, int baddr)
78 78 {
79   - static char buf[16];
80   - (void) sprintf(buf, "(%d,%d)", baddr/hSession->cols + 1, baddr%hSession->cols + 1);
  79 + static char buf[48];
  80 + (void) snprintf(buf, 48, "(%d,%d)", baddr/hSession->cols + 1, baddr%hSession->cols + 1);
81 81 return buf;
82 82 }
83 83  
... ...