Commit 59c01e6539ae6b325c3739dc8d872c3f7ac0a8ae

Authored by Perry Werneck
1 parent 1e6e062f

Removing warnings.

src/lib3270/linux/connect.c
@@ -58,8 +58,7 @@ @@ -58,8 +58,7 @@
58 /*---[ Implement ]-------------------------------------------------------------------------------*/ 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 int err; 63 int err;
65 socklen_t len = sizeof(err); 64 socklen_t len = sizeof(err);
src/lib3270/private.h
@@ -86,16 +86,24 @@ @@ -86,16 +86,24 @@
86 #define BLOCKING_CONNECT_ONLY 1 86 #define BLOCKING_CONNECT_ONLY 1
87 #endif /*]*/ 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 #define unused __attribute__((__unused__)) 96 #define unused __attribute__((__unused__))
  97 +
  98 + #define GNUC_UNUSED \
  99 + __attribute__((__unused__))
  100 +
96 #else 101 #else
  102 +
97 #define unused 103 #define unused
  104 + #define GNUC_UNUSED
98 #define printflike(s, f) 105 #define printflike(s, f)
  106 +
99 #endif 107 #endif
100 108
101 109
src/lib3270/see.c
@@ -369,43 +369,43 @@ static const char * see_input_control(unsigned char setting) @@ -369,43 +369,43 @@ static const char * see_input_control(unsigned char setting)
369 369
370 const char * see_efa(unsigned char efa, unsigned char value) 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 switch (efa) { 374 switch (efa) {
375 case XA_ALL: 375 case XA_ALL:
376 - (void) sprintf(buf, " all(%x)", value); 376 + (void) snprintf(buf, sizeof(buf), " all(%x)", value);
377 break; 377 break;
378 case XA_3270: 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 break; 380 break;
381 case XA_VALIDATION: 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 break; 383 break;
384 case XA_OUTLINING: 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 break; 386 break;
387 case XA_HIGHLIGHTING: 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 break; 389 break;
390 case XA_FOREGROUND: 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 break; 392 break;
393 case XA_CHARSET: 393 case XA_CHARSET:
394 - (void) sprintf(buf, " charset(%x)", value); 394 + (void) snprintf(buf, sizeof(buf), " charset(%x)", value);
395 break; 395 break;
396 case XA_BACKGROUND: 396 case XA_BACKGROUND:
397 (void) sprintf(buf, " background(%s)", see_color(value)); 397 (void) sprintf(buf, " background(%s)", see_color(value));
398 break; 398 break;
399 case XA_TRANSPARENCY: 399 case XA_TRANSPARENCY:
400 - (void) sprintf(buf, " transparency(%s)", 400 + (void) snprintf(buf, sizeof(buf), " transparency(%s)",
401 see_transparency(value)); 401 see_transparency(value));
402 break; 402 break;
403 case XA_INPUT_CONTROL: 403 case XA_INPUT_CONTROL:
404 - (void) sprintf(buf, " input-control(%s)", 404 + (void) snprintf(buf, sizeof(buf), " input-control(%s)",
405 see_input_control(value)); 405 see_input_control(value));
406 break; 406 break;
407 default: 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 break; 409 break;
410 } 410 }
411 return buf; 411 return buf;
src/lib3270/trace_ds.c
@@ -76,8 +76,8 @@ static void wtrace(H3270 *session, const char *fmt, ...); @@ -76,8 +76,8 @@ static void wtrace(H3270 *session, const char *fmt, ...);
76 /* display a (row,col) */ 76 /* display a (row,col) */
77 const char * rcba(H3270 *hSession, int baddr) 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 return buf; 81 return buf;
82 } 82 }
83 83