[vlc-devel] [PATCH] opensles_android: fix integer print format
Alexandre Janniaux
ajanni at videolabs.io
Fri Mar 27 09:41:20 CET 2020
Hi,
On Thu, Mar 26, 2020 at 11:38:32AM +0100, Romain Vimont wrote:
> On 3/26/20 11:22 AM, Alexandre Janniaux wrote:
> > 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.
>
> If the fact that SLresult is a SLuint32 is an implementation detail, then
> either it should expose some PRIslresult (I guess it does not), or IMO it
> should be casted for the printf:
>
> printf("%lu", (unsigned long) result);
>
> Otherwise, LGTM.
Actually, it's not an implementation detail as you can read
that in the specifications p.59 in 5.2:
https://www.khronos.org/registry/OpenSL-ES/specs/OpenSL_ES_Specification_1.0.1.pdf
Also there is no PRI* stuff defined in Opensles.
However, the fact SLuint32 would be a uint32_t is an
implementation detail, do you think it should have a cast
to uint32_t ?
Regards,
--
Alexandre Janniaux
Videolabs
>
> > 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;
> >
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list