From: SeokYeon Hwang Date: Mon, 16 Jun 2014 07:16:12 +0000 (+0900) Subject: emulator: revert SDL_init() routes stdout and stderr in win32 X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~228^2^2~141 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F03%2F23003%2F3;p=sdk%2Femulator%2Fqemu.git emulator: revert SDL_init() routes stdout and stderr in win32 SDL_init() routes stdout and stderr to the respective files in win32. So we revert it. Prevent NULL dereferencing in g_ascii_strtoull(). Change-Id: I0e540f83a7701968746310035a580eadd8160ce6 Signed-off-by: SeokYeon Hwang --- diff --git a/tizen/src/emulator.c b/tizen/src/emulator.c index 66919d3227..c7efcc2313 100644 --- a/tizen/src/emulator.c +++ b/tizen/src/emulator.c @@ -303,6 +303,13 @@ static int emulator_main(int argc, char *argv[], char **envp) } #endif +#ifdef CONFIG_WIN32 + // SDL_init() routes stdout and stderr to the respective files in win32. + // So we revert it. + freopen("CON", "w", stdout); + freopen("CON", "w", stderr); +#endif + gchar *profile = NULL; int c = 0; @@ -364,13 +371,18 @@ static int emulator_main(int argc, char *argv[], char **envp) char *resolution = get_variable("resolution"); if (!resolution) { fprintf(stderr, "[resolution] is required.\n"); + return -1; } char **splitted = g_strsplit(resolution, "x", 2); if (!splitted[0] || !splitted[1]) { fprintf(stderr, "resolution value [%s] is weird. Please use format \"WIDTHxHEIGHT\"\n", resolution); + g_strfreev(splitted); + return -1; } - set_emul_resolution(g_ascii_strtoull(splitted[0], NULL, 0), + else { + set_emul_resolution(g_ascii_strtoull(splitted[0], NULL, 0), g_ascii_strtoull(splitted[1], NULL, 0)); + } g_strfreev(splitted); }