From 2cdc410a7d0506f78d6dffd01afbb0a73dcd3ec8 Mon Sep 17 00:00:00 2001 From: "dmitry.glazunov" Date: Tue, 24 Dec 2024 15:14:44 +0300 Subject: [PATCH 1/2] Fix linux warnings Wformat --- src/include/fb_types.h | 2 ++ src/yvalve/gds.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/include/fb_types.h b/src/include/fb_types.h index 19ee4cf3e69..80b3a3f148d 100644 --- a/src/include/fb_types.h +++ b/src/include/fb_types.h @@ -41,11 +41,13 @@ typedef unsigned int ULONG; const SLONG SLONG_MIN = INT_MIN; const SLONG SLONG_MAX = INT_MAX; + #define SLONG_STR_FORMAT "%d" #elif SIZEOF_LONG == 4 typedef long SLONG; typedef unsigned long ULONG; const SLONG SLONG_MIN = LONG_MIN; const SLONG SLONG_MAX = LONG_MAX; + #define SLONG_STR_FORMAT "%ld" #else #error compile_time_failure: SIZEOF_LONG not specified #endif diff --git a/src/yvalve/gds.cpp b/src/yvalve/gds.cpp index 765b36d5850..32a755bde72 100644 --- a/src/yvalve/gds.cpp +++ b/src/yvalve/gds.cpp @@ -975,7 +975,7 @@ static SLONG safe_interpret(char* const s, const FB_SIZE_T bufsize, } if (!found) { - sprintf(s, "unknown ISC error %ld", (SLONG) code); // TXNN + sprintf(s, "unknown ISC error " SLONG_STR_FORMAT, (SLONG) code); // TXNN } } } @@ -1000,11 +1000,11 @@ static SLONG safe_interpret(char* const s, const FB_SIZE_T bufsize, break; case isc_arg_dos: - sprintf(s, "unknown dos error %ld", (SLONG) code); // TXNN + sprintf(s, "unknown dos error " SLONG_STR_FORMAT, (SLONG) code); // TXNN break; case isc_arg_next_mach: - sprintf(s, "next/mach error %ld", (SLONG) code); // AP + sprintf(s, "next/mach error " SLONG_STR_FORMAT, (SLONG) code); // AP break; case isc_arg_win32: @@ -1016,7 +1016,7 @@ static SLONG safe_interpret(char* const s, const FB_SIZE_T bufsize, s, bufsize, NULL)) #endif { - sprintf(s, "unknown Win32 error %ld", (SLONG) code); // TXNN + sprintf(s, "unknown Win32 error " SLONG_STR_FORMAT, (SLONG) code); // TXNN } break; From c4bd0e382aebfba9e8e8dff954d9611ccf87b90c Mon Sep 17 00:00:00 2001 From: "dmitry.glazunov" Date: Tue, 24 Dec 2024 17:47:04 +0300 Subject: [PATCH 2/2] Remove duplication defines --- src/include/fb_types.h | 2 -- src/yvalve/gds.cpp | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/include/fb_types.h b/src/include/fb_types.h index 80b3a3f148d..19ee4cf3e69 100644 --- a/src/include/fb_types.h +++ b/src/include/fb_types.h @@ -41,13 +41,11 @@ typedef unsigned int ULONG; const SLONG SLONG_MIN = INT_MIN; const SLONG SLONG_MAX = INT_MAX; - #define SLONG_STR_FORMAT "%d" #elif SIZEOF_LONG == 4 typedef long SLONG; typedef unsigned long ULONG; const SLONG SLONG_MIN = LONG_MIN; const SLONG SLONG_MAX = LONG_MAX; - #define SLONG_STR_FORMAT "%ld" #else #error compile_time_failure: SIZEOF_LONG not specified #endif diff --git a/src/yvalve/gds.cpp b/src/yvalve/gds.cpp index 32a755bde72..e7732e11092 100644 --- a/src/yvalve/gds.cpp +++ b/src/yvalve/gds.cpp @@ -975,7 +975,7 @@ static SLONG safe_interpret(char* const s, const FB_SIZE_T bufsize, } if (!found) { - sprintf(s, "unknown ISC error " SLONG_STR_FORMAT, (SLONG) code); // TXNN + sprintf(s, "unknown ISC error %" SLONGFORMAT, (SLONG) code); // TXNN } } } @@ -1000,11 +1000,11 @@ static SLONG safe_interpret(char* const s, const FB_SIZE_T bufsize, break; case isc_arg_dos: - sprintf(s, "unknown dos error " SLONG_STR_FORMAT, (SLONG) code); // TXNN + sprintf(s, "unknown dos error %" SLONGFORMAT, (SLONG) code); // TXNN break; case isc_arg_next_mach: - sprintf(s, "next/mach error " SLONG_STR_FORMAT, (SLONG) code); // AP + sprintf(s, "next/mach error %" SLONGFORMAT, (SLONG) code); // AP break; case isc_arg_win32: @@ -1016,7 +1016,7 @@ static SLONG safe_interpret(char* const s, const FB_SIZE_T bufsize, s, bufsize, NULL)) #endif { - sprintf(s, "unknown Win32 error " SLONG_STR_FORMAT, (SLONG) code); // TXNN + sprintf(s, "unknown Win32 error %" SLONGFORMAT, (SLONG) code); // TXNN } break;