[vlc-devel] [PATCH] opensles_android: fix integer print format

Alexandre Janniaux ajanni at videolabs.io
Thu Mar 26 11:22:05 CET 2020


SLresult is defined as an SLuint32 and might not be represented as an
unsigned long int. It is raising warnings when compiling for android
aarch64, so display it as uint32 instead.

block_t->i_buffer is size_t too and must be displayed with %zu.
---
 modules/audio_output/opensles_android.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/modules/audio_output/opensles_android.c b/modules/audio_output/opensles_android.c
index 424baf2b04..a600b2238b 100644
--- a/modules/audio_output/opensles_android.c
+++ b/modules/audio_output/opensles_android.c
@@ -51,11 +51,11 @@ JNIEnv *android_getEnv(vlc_object_t *p_obj, const char *psz_thread_name);
  * with 255 buffers we can buffer 2.55s of audio.
  */
 
-#define CHECK_OPENSL_ERROR(msg)                \
+#define CHECK_OPENSL_ERROR(msg) \
     if (unlikely(result != SL_RESULT_SUCCESS)) \
-    {                                          \
-        msg_Err(aout, msg" (%lu)", result);    \
-        goto error;                            \
+    { \
+        msg_Err(aout, msg" (%" PRIu32 ")", result); \
+        goto error; \
     }
 
 typedef SLresult (*slCreateEngine_t)(
@@ -157,7 +157,7 @@ static int TimeGet(audio_output_t* aout, vlc_tick_t* restrict drift)
     SLAndroidSimpleBufferQueueState st;
     SLresult res = GetState(sys->playerBufferQueue, &st);
     if (unlikely(res != SL_RESULT_SUCCESS)) {
-        msg_Err(aout, "Could not query buffer queue state in TimeGet (%lu)", res);
+        msg_Err(aout, "Could not query buffer queue state in TimeGet (%" PRIu32 ")", res);
         return -1;
     }
 
@@ -262,7 +262,7 @@ static int WriteBuffer(audio_output_t *aout)
     SLAndroidSimpleBufferQueueState st;
     SLresult res = GetState(sys->playerBufferQueue, &st);
     if (unlikely(res != SL_RESULT_SUCCESS)) {
-        msg_Err(aout, "Could not query buffer queue state in %s (%lu)", __func__, res);
+        msg_Err(aout, "Could not query buffer queue state in %s (%" PRIu32 ")", __func__, res);
         return false;
     }
 
@@ -307,7 +307,7 @@ static int WriteBuffer(audio_output_t *aout)
         return true;
     } else {
         /* XXX : if writing fails, we don't retry */
-        msg_Err(aout, "error %lu when writing %d bytes %s",
+        msg_Err(aout, "error %" PRIu32 " when writing %zu bytes %s",
                 r, b->i_buffer,
                 (r == SL_RESULT_BUFFER_INSUFFICIENT) ? " (buffer insufficient)" : "");
         return false;
-- 
2.26.0



More information about the vlc-devel mailing list