mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 15:03:39 +02:00
win32: don't assume the format specifier for the stdlib printf/scanf like functions
When using the mingw printf shims for C99 compat the msvc format specifiers don't work and the build fails. Ideally we would use glib functions which abstract this away, but in the error handler context we shouldn't call back into glib. And for scanf we don't have a glib wrapper. Instead call the "secure" versions provided by the win32 API (_snprintf_s/fprintf_s/sscanf_s) which mingw doesn't replace.
This commit is contained in:
@@ -123,6 +123,7 @@ main (int argc,
|
||||
#ifndef G_OS_WIN32
|
||||
# define SCAN_FORMAT64 FORMAT64
|
||||
#else
|
||||
# define sscanf sscanf_s
|
||||
# define SCAN_FORMAT64 "%I64d %I64u\n"
|
||||
#endif
|
||||
string = g_strdup_printf (FORMAT64, gi64t1, gu64t1);
|
||||
@@ -138,6 +139,7 @@ main (int argc,
|
||||
#ifndef G_OS_WIN32
|
||||
# define SCAN_FORMATSIZE FORMATSIZE
|
||||
#else
|
||||
# define sscanf sscanf_s
|
||||
# define SCAN_FORMATSIZE "%Id %Iu\n"
|
||||
#endif
|
||||
string = g_strdup_printf (FORMATSIZE, gsst1, gst1);
|
||||
|
Reference in New Issue
Block a user