diff --git a/src/lib3270/linux/connect.c b/src/lib3270/linux/connect.c index 4c3817c..5a1879f 100644 --- a/src/lib3270/linux/connect.c +++ b/src/lib3270/linux/connect.c @@ -58,8 +58,7 @@ /*---[ Implement ]-------------------------------------------------------------------------------*/ -//static void net_connected(H3270 *hSession) -static void net_connected(H3270 *hSession, int fd unused, LIB3270_IO_FLAG flag unused, void *dunno unused) +static void net_connected(H3270 *hSession, int GNUC_UNUSED(fd), LIB3270_IO_FLAG GNUC_UNUSED(flag), void GNUC_UNUSED(*dunno)) { int err; socklen_t len = sizeof(err); diff --git a/src/lib3270/private.h b/src/lib3270/private.h index 57ebbbf..ebed83a 100644 --- a/src/lib3270/private.h +++ b/src/lib3270/private.h @@ -86,16 +86,24 @@ #define BLOCKING_CONNECT_ONLY 1 #endif /*]*/ -/* - * Compiler-specific #defines. - */ +// +// Compiler-specific #defines. +// +// Reference: GLIBC gmacros.h +// +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) -/* 'unused' explicitly flags an unused parameter */ -#if defined(__GNUC__) #define unused __attribute__((__unused__)) + + #define GNUC_UNUSED \ + __attribute__((__unused__)) + #else + #define unused + #define GNUC_UNUSED #define printflike(s, f) + #endif diff --git a/src/lib3270/see.c b/src/lib3270/see.c index 4154009..5d8e280 100644 --- a/src/lib3270/see.c +++ b/src/lib3270/see.c @@ -369,43 +369,43 @@ static const char * see_input_control(unsigned char setting) const char * see_efa(unsigned char efa, unsigned char value) { - static char buf[64]; + static char buf[80]; switch (efa) { case XA_ALL: - (void) sprintf(buf, " all(%x)", value); + (void) snprintf(buf, sizeof(buf), " all(%x)", value); break; case XA_3270: - (void) sprintf(buf, " 3270%s", see_attr(value)); + (void) snprintf(buf, sizeof(buf), " 3270%s", see_attr(value)); break; case XA_VALIDATION: - (void) sprintf(buf, " validation%s", see_validation(value)); + (void) snprintf(buf, sizeof(buf), " validation%s", see_validation(value)); break; case XA_OUTLINING: - (void) sprintf(buf, " outlining(%s)", see_outline(value)); + (void) snprintf(buf, sizeof(buf), " outlining(%s)", see_outline(value)); break; case XA_HIGHLIGHTING: - (void) sprintf(buf, " highlighting(%s)", see_highlight(value)); + (void) snprintf(buf, sizeof(buf), " highlighting(%s)", see_highlight(value)); break; case XA_FOREGROUND: - (void) sprintf(buf, " foreground(%s)", see_color(value)); + (void) snprintf(buf, sizeof(buf), " foreground(%s)", see_color(value)); break; case XA_CHARSET: - (void) sprintf(buf, " charset(%x)", value); + (void) snprintf(buf, sizeof(buf), " charset(%x)", value); break; case XA_BACKGROUND: (void) sprintf(buf, " background(%s)", see_color(value)); break; case XA_TRANSPARENCY: - (void) sprintf(buf, " transparency(%s)", + (void) snprintf(buf, sizeof(buf), " transparency(%s)", see_transparency(value)); break; case XA_INPUT_CONTROL: - (void) sprintf(buf, " input-control(%s)", + (void) snprintf(buf, sizeof(buf), " input-control(%s)", see_input_control(value)); break; default: - (void) sprintf(buf, " %s[0x%x]", unknown(efa), value); + (void) snprintf(buf, sizeof(buf), " %s[0x%x]", unknown(efa), value); break; } return buf; diff --git a/src/lib3270/trace_ds.c b/src/lib3270/trace_ds.c index f1840ad..3484bba 100644 --- a/src/lib3270/trace_ds.c +++ b/src/lib3270/trace_ds.c @@ -76,8 +76,8 @@ static void wtrace(H3270 *session, const char *fmt, ...); /* display a (row,col) */ const char * rcba(H3270 *hSession, int baddr) { - static char buf[16]; - (void) sprintf(buf, "(%d,%d)", baddr/hSession->cols + 1, baddr%hSession->cols + 1); + static char buf[48]; + (void) snprintf(buf, 48, "(%d,%d)", baddr/hSession->cols + 1, baddr%hSession->cols + 1); return buf; } -- libgit2 0.21.2