mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-27 07:56:14 +01:00
Merge branch 'win32-no-sys-printf' into 'master'
win32: don't assume the format specifier for the stdlib printf/scanf like functions See merge request GNOME/glib!1033
This commit is contained in:
commit
a5f0e648d3
@ -39,13 +39,14 @@ _g_win32_subst_pid_and_event (char *debugger,
|
||||
gsize pid_str_len;
|
||||
char event_str[STR_BUFFER_SIZE] = {0};
|
||||
gsize event_str_len;
|
||||
#undef STR_BUFFER_SIZE
|
||||
snprintf (pid_str, G_N_ELEMENTS (pid_str), "%lu", pid);
|
||||
|
||||
_snprintf_s (pid_str, STR_BUFFER_SIZE, G_N_ELEMENTS (pid_str), "%lu", pid);
|
||||
pid_str[G_N_ELEMENTS (pid_str) - 1] = 0;
|
||||
pid_str_len = strlen (pid_str);
|
||||
snprintf (event_str, G_N_ELEMENTS (pid_str), "%Iu", event);
|
||||
_snprintf_s (event_str, STR_BUFFER_SIZE, G_N_ELEMENTS (pid_str), "%Iu", event);
|
||||
event_str[G_N_ELEMENTS (pid_str) - 1] = 0;
|
||||
event_str_len = strlen (event_str);
|
||||
#undef STR_BUFFER_SIZE
|
||||
|
||||
while (cmdline[i] != 0 && dbg_i < debugger_size)
|
||||
{
|
||||
|
@ -1120,7 +1120,7 @@ g_win32_veh_handler (PEXCEPTION_POINTERS ExceptionInfo)
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
}
|
||||
|
||||
fprintf (stderr,
|
||||
fprintf_s (stderr,
|
||||
"Exception code=0x%lx flags=0x%lx at 0x%p",
|
||||
er->ExceptionCode,
|
||||
er->ExceptionFlags,
|
||||
@ -1129,7 +1129,7 @@ g_win32_veh_handler (PEXCEPTION_POINTERS ExceptionInfo)
|
||||
switch (er->ExceptionCode)
|
||||
{
|
||||
case EXCEPTION_ACCESS_VIOLATION:
|
||||
fprintf (stderr,
|
||||
fprintf_s (stderr,
|
||||
". Access violation - attempting to %s at address 0x%p\n",
|
||||
er->ExceptionInformation[0] == 0 ? "read data" :
|
||||
er->ExceptionInformation[0] == 1 ? "write data" :
|
||||
@ -1138,7 +1138,7 @@ g_win32_veh_handler (PEXCEPTION_POINTERS ExceptionInfo)
|
||||
(void *) er->ExceptionInformation[1]);
|
||||
break;
|
||||
case EXCEPTION_IN_PAGE_ERROR:
|
||||
fprintf (stderr,
|
||||
fprintf_s (stderr,
|
||||
". Page access violation - attempting to %s at address 0x%p with status %Ix\n",
|
||||
er->ExceptionInformation[0] == 0 ? "read from an inaccessible page" :
|
||||
er->ExceptionInformation[0] == 1 ? "write to an inaccessible page" :
|
||||
@ -1148,7 +1148,7 @@ g_win32_veh_handler (PEXCEPTION_POINTERS ExceptionInfo)
|
||||
er->ExceptionInformation[2]);
|
||||
break;
|
||||
default:
|
||||
fprintf (stderr, "\n");
|
||||
fprintf_s (stderr, "\n");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user