Patchwork [RFT,1/2] coreaudio: Fix OSStatus format specifier

login
register
mail settings
Submitter Andreas Färber
Date June 23, 2011, 11:43 a.m.
Message ID <1308829383-11282-2-git-send-email-andreas.faerber@web.de>
Download mbox | patch
Permalink /patch/101624/
State New
Headers show

Comments

Andreas Färber - June 23, 2011, 11:43 a.m.
OSStatus type is defined as SInt32.
Use %d format instead of %ld to avoid a warning on ppc64.

Cc: Alexandre Raymond <cerbere@gmail.com>
Cc: malc <av1474@comtv.ru>
Signed-off-by: Andreas Faerber <andreas.faerber@web.de>
---
 Alexandre, Could you please test this on v10.6? Thanks!
 
 audio/coreaudio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
malc - June 23, 2011, 12:54 p.m.
On Thu, 23 Jun 2011, Andreas F?rber wrote:

> OSStatus type is defined as SInt32.
> Use %d format instead of %ld to avoid a warning on ppc64.

Which itself is defined as

typedef signed long        SInt32;

(here on ppc32 inside:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/libkern/OSTypes.h)

So i'd suggest to just cast the thing to appropriate long type
and be done with it.

> 
> Cc: Alexandre Raymond <cerbere@gmail.com>
> Cc: malc <av1474@comtv.ru>
> Signed-off-by: Andreas Faerber <andreas.faerber@web.de>
> ---
>  Alexandre, Could you please test this on v10.6? Thanks!
>  
>  audio/coreaudio.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/audio/coreaudio.c b/audio/coreaudio.c
> index 3bd75cd..d2b9248 100644
> --- a/audio/coreaudio.c
> +++ b/audio/coreaudio.c
> @@ -104,7 +104,7 @@ static void coreaudio_logstatus (OSStatus status)
>          break;
>  
>      default:
> -        AUD_log (AUDIO_CAP, "Reason: status code %ld\n", status);
> +        AUD_log (AUDIO_CAP, "Reason: status code %d\n", status);
>          return;
>      }
>  
>
Andreas Färber - June 23, 2011, 2:29 p.m.
Am 23.06.2011 um 14:54 schrieb malc:

> On Thu, 23 Jun 2011, Andreas F?rber wrote:
>
>> OSStatus type is defined as SInt32.
>> Use %d format instead of %ld to avoid a warning on ppc64.
>
> Which itself is defined as
>
> typedef signed long        SInt32;
>
> (here on ppc32 inside:
> /Developer/SDKs/MacOSX10.4u.sdk/usr/include/libkern/OSTypes.h)

Thanks for the pointer! Here it's:

#if __LP64__
typedef signed int  SInt32;
#else
typedef signed long SInt32;
#endif

> So i'd suggest to just cast the thing to appropriate long type
> and be done with it.

I posted a different solution to avoid unnecessary 64-bit width on  
ppc64/x86_64.

Andreas

Patch

diff --git a/audio/coreaudio.c b/audio/coreaudio.c
index 3bd75cd..d2b9248 100644
--- a/audio/coreaudio.c
+++ b/audio/coreaudio.c
@@ -104,7 +104,7 @@  static void coreaudio_logstatus (OSStatus status)
         break;
 
     default:
-        AUD_log (AUDIO_CAP, "Reason: status code %ld\n", status);
+        AUD_log (AUDIO_CAP, "Reason: status code %d\n", status);
         return;
     }