GithubHelp home page GithubHelp logo

Comments (3)

Mis012 avatar Mis012 commented on June 18, 2024

this fixes the issue, though it may be cleaner to have a wrapper function for __android_log_vprint to reduce duplication

diff --git a/src/libmatrix/log.cc b/src/libmatrix/log.cc
index d203c6d..b4384f6 100644
--- a/src/libmatrix/log.cc
+++ b/src/libmatrix/log.cc
@@ -109,6 +109,9 @@ Log::info(const char *fmt, ...)
     static const string infoprefix("Info");
     const string& prefix(do_debug_ ? infoprefix : empty);
     va_list ap;
+#ifdef ANDROID
+    va_list aq;
+#endif
     va_start(ap, fmt);
 
 #ifndef ANDROID
@@ -116,7 +119,9 @@ Log::info(const char *fmt, ...)
     const string& color(do_debug_ ? infocolor : empty);
     print_prefixed_message(std::cout, color, prefix, fmt, ap);
 #else
-    __android_log_vprint(ANDROID_LOG_INFO, appname_.c_str(), fmt, ap);
+    va_copy(aq, ap);
+    __android_log_vprint(ANDROID_LOG_INFO, appname_.c_str(), fmt, aq);
+    va_end(aq);
 #endif
 
     if (extra_out_)
@@ -132,13 +137,18 @@ Log::debug(const char *fmt, ...)
     if (!do_debug_)
         return;
     va_list ap;
+#ifdef ANDROID
+    va_list aq;
+#endif
     va_start(ap, fmt);
 
 #ifndef ANDROID
     static const string& dbgcolor(isatty(fileno(stdout)) ? terminal_color_yellow : empty);
     print_prefixed_message(std::cout, dbgcolor, dbgprefix, fmt, ap);
 #else
-    __android_log_vprint(ANDROID_LOG_DEBUG, appname_.c_str(), fmt, ap);
+    va_copy(aq, ap);
+    __android_log_vprint(ANDROID_LOG_DEBUG, appname_.c_str(), fmt, aq);
+    va_end(aq);
 #endif
 
     if (extra_out_)
@@ -152,13 +162,18 @@ Log::error(const char *fmt, ...)
 {
     static const string errprefix("Error");
     va_list ap;
+#ifdef ANDROID
+    va_list aq;
+#endif
     va_start(ap, fmt);
 
 #ifndef ANDROID
     static const string& errcolor(isatty(fileno(stderr)) ? terminal_color_red : empty);
     print_prefixed_message(std::cerr, errcolor, errprefix, fmt, ap);
 #else
-    __android_log_vprint(ANDROID_LOG_ERROR, appname_.c_str(), fmt, ap);
+    va_copy(aq, ap);
+    __android_log_vprint(ANDROID_LOG_ERROR, appname_.c_str(), fmt, aq);
+    va_end(aq);
 #endif
 
     if (extra_out_)

from glmark2.

afrantzis avatar afrantzis commented on June 18, 2024

Thanks for the report and fix. Could you try the proposed MR at #225 and let me know if it works well for you?

from glmark2.

Mis012 avatar Mis012 commented on June 18, 2024

seems to work 👍

from glmark2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.