[eglib] Fix compilation on PLATFORM_ANDROID.
authorJonathan Pryor <jonpryor@vt.edu>
Tue, 26 Aug 2014 02:43:48 +0000 (22:43 -0400)
committerJonathan Pryor <jonpryor@vt.edu>
Tue, 26 Aug 2014 02:58:30 +0000 (22:58 -0400)
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.

eglib/src/goutput.c

index d59c4cc8f8342608d5b4669754278ed87243f43a..a3cf1f64db43ce4ed05b10ee9e9b2210f38de684 100644 (file)
@@ -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);
 }