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

login
register
mail settings
Submitter Andreas Färber
Date June 23, 2011, 2:24 p.m.
Message ID <1308839086-29122-1-git-send-email-andreas.faerber@web.de>
Download mbox | patch
Permalink /patch/101644/
State New
Headers show

Comments

Andreas Färber - June 23, 2011, 2:24 p.m.
OSStatus type is defined as SInt32. That's signed int on __LP64__ and
signed long otherwise.
Since it is an explicit 32-bit-width type, cast to corresponsing POSIX type
and use PRId32 format specifier. This avoids a warning on ppc64.

Cc: malc <av1474@comtv.ru>
Signed-off-by: Andreas Faerber <andreas.faerber@web.de>
---
 audio/coreaudio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
malc - June 23, 2011, 2:58 p.m.
On Thu, 23 Jun 2011, Andreas F?rber wrote:

> OSStatus type is defined as SInt32. That's signed int on __LP64__ and
> signed long otherwise.
> Since it is an explicit 32-bit-width type, cast to corresponsing POSIX type
> and use PRId32 format specifier. This avoids a warning on ppc64.
> 

[..snip..]

Applied thanks (ditto UInt32 patch).
Alexandre Raymond - June 29, 2011, 3:08 a.m.
Sorry for the delay.

Commit 744d3644181ddb16ef5944a0f9217e46961c8c84 works fine on OSX 10.6.

Alexandre

On Thu, Jun 23, 2011 at 10:58 AM, malc <av1474@comtv.ru> wrote:
> On Thu, 23 Jun 2011, Andreas F?rber wrote:
>
>> OSStatus type is defined as SInt32. That's signed int on __LP64__ and
>> signed long otherwise.
>> Since it is an explicit 32-bit-width type, cast to corresponsing POSIX type
>> and use PRId32 format specifier. This avoids a warning on ppc64.
>>
>
> [..snip..]
>
> Applied thanks (ditto UInt32 patch).
>
> --
> mailto:av1474@comtv.ru
>

Patch

diff --git a/audio/coreaudio.c b/audio/coreaudio.c
index 3bd75cd..508bcbe 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 %" PRId32 "\n", (int32_t)status);
         return;
     }