]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
mprintf: fix format prefix I32/I64 for windows compilers
authorJay Satiro <raysatiro@yahoo.com>
Fri, 16 Feb 2024 21:02:19 +0000 (16:02 -0500)
committerJay Satiro <raysatiro@yahoo.com>
Sat, 24 Feb 2024 05:51:20 +0000 (00:51 -0500)
- Support I32 & I64 (eg: %I64d) for all Win32 builds.

Prior to this change mprintf support for the I format prefix, which is a
Microsoft extension, was dependent on the compiler used.

When Borland compiler support was removed in fd7ef00f the prefix was
then no longer supported for that compiler; however since it's still
possible to build with Borland I'm restoring support for the prefix in
this way.

Reported-by: Paweł Witas
Fixes https://github.com/curl/curl/issues/12944
Closes https://github.com/curl/curl/pull/12950

lib/mprintf.c

index 63f7f2409ec95bbb775793ec2e51270a6c832b68..5695253eb3babfc61236feab81b9cd29aa8584de 100644 (file)
 #  endif
 #endif
 
-/*
- * Non-ANSI integer extensions
- */
-
-#if (defined(_WIN32_WCE)) || \
-    (defined(__MINGW32__)) || \
-    (defined(_MSC_VER) && (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64))
-#  define MP_HAVE_INT_EXTENSIONS
-#endif
-
 /*
  * Max integer data types that mprintf.c is capable
  */
@@ -349,8 +339,9 @@ static int parsefmt(const char *format,
         case 'h':
           flags |= FLAGS_SHORT;
           break;
-#if defined(MP_HAVE_INT_EXTENSIONS)
+#if defined(_WIN32) || defined(_WIN32_WCE)
         case 'I':
+          /* Non-ANSI integer extensions I32 I64 */
           if((fmt[0] == '3') && (fmt[1] == '2')) {
             flags |= FLAGS_LONG;
             fmt += 2;
@@ -367,7 +358,7 @@ static int parsefmt(const char *format,
 #endif
           }
           break;
-#endif
+#endif /* _WIN32 || _WIN32_WCE */
         case 'l':
           if(flags & FLAGS_LONG)
             flags |= FLAGS_LONGLONG;