From: Jonathan Pryor Date: Tue, 26 Aug 2014 02:43:48 +0000 (-0400) Subject: [eglib] Fix compilation on PLATFORM_ANDROID. X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=9e7713121b36cf961c4ccd596c57734eaac6e911;p=mono.git [eglib] Fix compilation on PLATFORM_ANDROID. Compilation of eglib/src/goutput.c was broken in commit 989165e1: mono/eglib/src/goutput.c: In function 'monoeg_log_default_handler': mono/eglib/src/goutput.c:159:75: error: 'args' undeclared (first use in this function) __android_log_vprint (to_android_priority (log_level), log_domain, "%s", args); ^ mono/eglib/src/goutput.c:159:75: note: each undeclared identifier is reported only once for each function it appears in mono/eglib/src/goutput.c: In function 'default_stdout_handler': mono/eglib/src/goutput.c:168:2: error: incompatible type for argument 4 of '__android_log_vprint' __android_log_vprint (ANDROID_LOG_ERROR, "mono", "%s", message); ^ mono/eglib/src/goutput.c:139:0: $ANDROID_NDK_PATH/platforms/android-4/arch-arm/usr/include/android/log.h:109:5: note: expected 'va_list' but argument is of type 'const gchar *' int __android_log_vprint(int prio, const char *tag, ^ mono/eglib/src/goutput.c: In function 'default_stderr_handler': mono/eglib/src/goutput.c:175:2: error: incompatible type for argument 4 of '__android_log_vprint' __android_log_vprint (ANDROID_LOG_ERROR, "mono", "%s", message); ^ (The cause of the breakage is that __android_log_vprint() takes a va_args parameter, which is no longer present in 989165e1.) Use __android_log_write() instead of __android_log_vprint(). Note: __android_log_write() writes a "simple string" to `adb logcat`, meaning there is no printf(3)-style formatting applied. --- diff --git a/eglib/src/goutput.c b/eglib/src/goutput.c index d59c4cc8f83..a3cf1f64db4 100644 --- a/eglib/src/goutput.c +++ b/eglib/src/goutput.c @@ -156,7 +156,7 @@ to_android_priority (GLogLevelFlags log_level) void g_log_default_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer unused_data) { - __android_log_vprint (to_android_priority (log_level), log_domain, "%s", args); + __android_log_write (to_android_priority (log_level), log_domain, message); if (log_level & fatal) abort (); } @@ -165,14 +165,14 @@ static void default_stdout_handler (const gchar *message) { /* TODO: provide a proper app name */ - __android_log_vprint (ANDROID_LOG_ERROR, "mono", "%s", message); + __android_log_write (ANDROID_LOG_ERROR, "mono", message); } static void default_stderr_handler (const gchar *message) { /* TODO: provide a proper app name */ - __android_log_vprint (ANDROID_LOG_ERROR, "mono", "%s", message); + __android_log_write (ANDROID_LOG_ERROR, "mono", message); }