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;
|
gsize pid_str_len;
|
||||||
char event_str[STR_BUFFER_SIZE] = {0};
|
char event_str[STR_BUFFER_SIZE] = {0};
|
||||||
gsize event_str_len;
|
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[G_N_ELEMENTS (pid_str) - 1] = 0;
|
||||||
pid_str_len = strlen (pid_str);
|
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[G_N_ELEMENTS (pid_str) - 1] = 0;
|
||||||
event_str_len = strlen (event_str);
|
event_str_len = strlen (event_str);
|
||||||
|
#undef STR_BUFFER_SIZE
|
||||||
|
|
||||||
while (cmdline[i] != 0 && dbg_i < debugger_size)
|
while (cmdline[i] != 0 && dbg_i < debugger_size)
|
||||||
{
|
{
|
||||||
|
@ -1120,35 +1120,35 @@ g_win32_veh_handler (PEXCEPTION_POINTERS ExceptionInfo)
|
|||||||
return EXCEPTION_CONTINUE_EXECUTION;
|
return EXCEPTION_CONTINUE_EXECUTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf (stderr,
|
fprintf_s (stderr,
|
||||||
"Exception code=0x%lx flags=0x%lx at 0x%p",
|
"Exception code=0x%lx flags=0x%lx at 0x%p",
|
||||||
er->ExceptionCode,
|
er->ExceptionCode,
|
||||||
er->ExceptionFlags,
|
er->ExceptionFlags,
|
||||||
er->ExceptionAddress);
|
er->ExceptionAddress);
|
||||||
|
|
||||||
switch (er->ExceptionCode)
|
switch (er->ExceptionCode)
|
||||||
{
|
{
|
||||||
case EXCEPTION_ACCESS_VIOLATION:
|
case EXCEPTION_ACCESS_VIOLATION:
|
||||||
fprintf (stderr,
|
fprintf_s (stderr,
|
||||||
". Access violation - attempting to %s at address 0x%p\n",
|
". Access violation - attempting to %s at address 0x%p\n",
|
||||||
er->ExceptionInformation[0] == 0 ? "read data" :
|
er->ExceptionInformation[0] == 0 ? "read data" :
|
||||||
er->ExceptionInformation[0] == 1 ? "write data" :
|
er->ExceptionInformation[0] == 1 ? "write data" :
|
||||||
er->ExceptionInformation[0] == 8 ? "execute data" :
|
er->ExceptionInformation[0] == 8 ? "execute data" :
|
||||||
"do something bad",
|
"do something bad",
|
||||||
(void *) er->ExceptionInformation[1]);
|
(void *) er->ExceptionInformation[1]);
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_IN_PAGE_ERROR:
|
case EXCEPTION_IN_PAGE_ERROR:
|
||||||
fprintf (stderr,
|
fprintf_s (stderr,
|
||||||
". Page access violation - attempting to %s at address 0x%p with status %Ix\n",
|
". 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] == 0 ? "read from an inaccessible page" :
|
||||||
er->ExceptionInformation[0] == 1 ? "write to an inaccessible page" :
|
er->ExceptionInformation[0] == 1 ? "write to an inaccessible page" :
|
||||||
er->ExceptionInformation[0] == 8 ? "execute data in page" :
|
er->ExceptionInformation[0] == 8 ? "execute data in page" :
|
||||||
"do something bad with a page",
|
"do something bad with a page",
|
||||||
(void *) er->ExceptionInformation[1],
|
(void *) er->ExceptionInformation[1],
|
||||||
er->ExceptionInformation[2]);
|
er->ExceptionInformation[2]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf (stderr, "\n");
|
fprintf_s (stderr, "\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,6 +123,7 @@ main (int argc,
|
|||||||
#ifndef G_OS_WIN32
|
#ifndef G_OS_WIN32
|
||||||
# define SCAN_FORMAT64 FORMAT64
|
# define SCAN_FORMAT64 FORMAT64
|
||||||
#else
|
#else
|
||||||
|
# define sscanf sscanf_s
|
||||||
# define SCAN_FORMAT64 "%I64d %I64u\n"
|
# define SCAN_FORMAT64 "%I64d %I64u\n"
|
||||||
#endif
|
#endif
|
||||||
string = g_strdup_printf (FORMAT64, gi64t1, gu64t1);
|
string = g_strdup_printf (FORMAT64, gi64t1, gu64t1);
|
||||||
@ -138,6 +139,7 @@ main (int argc,
|
|||||||
#ifndef G_OS_WIN32
|
#ifndef G_OS_WIN32
|
||||||
# define SCAN_FORMATSIZE FORMATSIZE
|
# define SCAN_FORMATSIZE FORMATSIZE
|
||||||
#else
|
#else
|
||||||
|
# define sscanf sscanf_s
|
||||||
# define SCAN_FORMATSIZE "%Id %Iu\n"
|
# define SCAN_FORMATSIZE "%Id %Iu\n"
|
||||||
#endif
|
#endif
|
||||||
string = g_strdup_printf (FORMATSIZE, gsst1, gst1);
|
string = g_strdup_printf (FORMATSIZE, gsst1, gst1);
|
||||||
|
Loading…
Reference in New Issue
Block a user