Darwin CoreAudio warning fixes
cover Darwin CoreAudio warning fixes
Hello,
These patches fix two format related warnings noticed on Darwin/ppc64 host (LP64). They will probably affect Darwin/x86_64, too.
Three warnings remain: 1x CoreAudioAddIOProc, 2x CoreAudioRemoveIOProc being deprecated.
Regards,
Andreas
Andreas Färber (2):
coreaudio: Fix OSStatus format specifier
coreaudio: Fix format for UInt32 type
audio/coreaudio.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.5.3
PATCH 1/2 coreaudio: Fix OSStatus format specifier
OSStatus type is defined as SInt32.
Use %d format instead of %ld to avoid a warning on ppc64.
---
Alexandre, Could you please test this on v10.6? Thanks!
audio/coreaudio.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
audio/coreaudio.c +1 -1
@@ -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 ; }
Signature · 1 line
1.7.5.3
PATCH 2/2 coreaudio: Fix format for UInt32 type
coreaudioVoiceOut's audioDevicePropertyBufferFrameSize is defined as UInt32. Use %u instead of %ld to avoid a warning on ppc64.
--- audio/coreaudio.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
audio/coreaudio.c +1 -1
@@ -360,7 +360,7 @@ static int coreaudio_init_out (HWVoiceOut *hw, struct audsettings *as) &core->audioDevicePropertyBufferFrameSize);if (status != kAudioHardwareNoError) {coreaudio_logerr2 (status, typ, -"Could not set device buffer frame size %ld\n" , +"Could not set device buffer frame size %u\n" , core->audioDevicePropertyBufferFrameSize);return -1 ; }
Signature · 1 line
1.7.5.3
Re: [Qemu-devel] [PATCH RFT 1/2] coreaudio: Fix OSStatus format specifier
In reply to Andreas FärberQuoted 2 lines · Andreas F?rber
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.
Quoted 24 lines
Cc Alexandre Raymond <[email protected]>Cc malc <[email protected]>Signed-off-by Andreas Faerber <[email protected]>---
Alexandre, Could you please test this on v10.6? Thanks!audio/coreaudio.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)audio/coreaudio.c +1
-1@@ -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 ; }
Signature · 1 line
mailto:[email protected]
PATCH v2 1/2 coreaudio: Fix OSStatus format specifier
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.
--- audio/coreaudio.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
audio/coreaudio.c +1 -1
@@ -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 ; }
Signature · 1 line
1.7.5.3
PATCH 2/2 coreaudio: Avoid formatting UInt32 type
coreaudioVoiceOut's audioDevicePropertyBufferFrameSize is defined as UInt32 and is being used by reference for AudioDevice{Get,Set}Property(). UInt32 is unsigned int on __LP64__ but unsigned long otherwise.
Cast to POSIX type and use PRIu32 format specifier to hide the details. This avoids a warning on ppc64.
--- audio/coreaudio.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
audio/coreaudio.c +2 -2
@@ -360,8 +360,8 @@ static int coreaudio_init_out (HWVoiceOut *hw, struct audsettings *as) &core->audioDevicePropertyBufferFrameSize);if (status != kAudioHardwareNoError) {coreaudio_logerr2 (status, typ, -"Could not set device buffer frame size %ld\n" , - core->audioDevicePropertyBufferFrameSize); +"Could not set device buffer frame size %" PRIu32"\n" , + (uint32_t )core->audioDevicePropertyBufferFrameSize);return -1 ; }
Signature · 1 line
1.7.5.3
Re: [Qemu-devel] [PATCH 2/2] coreaudio: Avoid formatting UInt32 type
$subject missing v2
Am 23.06.2011 um 16:24 schrieb Andreas Färber:
Quoted 36 lines
coreaudioVoiceOut's audioDevicePropertyBufferFrameSize is defined as UInt32 and is being used by reference for AudioDevice{Get,Set}Property(). UInt32 is unsigned int on
__LP64__but unsigned long otherwise.Cast to POSIX type and use PRIu32 format specifier to hide the details. This avoids a warning on ppc64.
Cc malc <[email protected]>Signed-off-by Andreas Faerber <[email protected]>---
audio/coreaudio.c| 4 ++--1 files changed, 2 insertions(+), 2 deletions(-)audio/coreaudio.c +2
-2@@ -360,8 +360,8 @@ static int coreaudio_init_out (HWVoiceOut *hw, struct audsettings *as) &core->audioDevicePropertyBufferFrameSize);if (status != kAudioHardwareNoError) { coreaudio_logerr2 (status, typ, - "Could not set device buffer frame size %ld\n", - core->audioDevicePropertyBufferFrameSize); + "Could not set device buffer frame size %" PRIu32 "\n", + (uint32_t)core-Quoted 1 line
audioDevicePropertyBufferFrameSize);
return -1; }Signature · 1 line
1.7.5.3
Re: [Qemu-devel] [PATCH v2 1/2] coreaudio: Fix OSStatus format specifier
In reply to Andreas FärberQuoted 5 lines · Andreas F?rber
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).
Signature · 1 line
mailto:[email protected]
Re: [Qemu-devel] [PATCH v2 1/2] coreaudio: Fix OSStatus format specifier
Sorry for the delay.
Commit 744d3644181ddb16ef5944a0f9217e46961c8c84 works fine on OSX 10.6.
Alexandre
Quoted 15 lines · malc
Quoted 5 lines · Andreas F?rber
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:[email protected]
Re: [Qemu-devel] [PATCH RFT 1/2] coreaudio: Fix OSStatus format specifier
In reply to malcAm 23.06.2011 um 14:54 schrieb malc:
Quoted 11 lines · Andreas F?rber
Quoted 3 lines
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
Quoted 2 lines
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
Am 23.06.2011 um 13:43 schrieb Andreas Färber:
Quoted 6 lines
Hello,
These patches fix two format related warnings noticed on Darwin/ppc64 host (LP64). They will probably affect Darwin/x86_64, too.
Three warnings remain: 1x CoreAudioAddIOProc, 2x CoreAudioRemoveIOProc being deprecated.
Erm, AudioDevice{Add,Remove}IOProc.
Quoted 13 lines
Regards,
AndreasAndreas Färber (2):
coreaudio: Fix OSStatus format specifier
coreaudio: Fix format for UInt32 type
audio/coreaudio.c| 4 ++--1 files changed, 2 insertions(+), 2 deletions(-)Signature · 1 line
1.7.5.3