osx_output: always pass OS X result code to g_set_error().

Should be safe on OS X 10.4 (32-bit), since Apple's OSStatus boils
down to "signed long", and g_set_error() takes gint, which is really
just "int".  Assigning "signed long" to "int" on 32-bit Unix should be
just fine, since both are signed 32-bit ints.

No idea if this is safe on 64-bit OS X.
This commit is contained in:
Greg Ward 2010-12-20 22:21:47 -05:00 committed by Max Kellermann
parent 80dc602193
commit 9cb4aaf3c2

View File

@ -199,7 +199,7 @@ osx_output_set_device(struct osx_output *oo, GError **error)
&size,
NULL);
if (status != noErr) {
g_set_error(error, osx_output_quark(), 0,
g_set_error(error, osx_output_quark(), status,
"Unable to determine number of OS X audio devices: %s",
GetMacOSStatusCommentString(status));
ret = false;
@ -213,7 +213,7 @@ osx_output_set_device(struct osx_output *oo, GError **error)
&size,
deviceids);
if (status != noErr) {
g_set_error(error, osx_output_quark(), 0,
g_set_error(error, osx_output_quark(), status,
"Unable to determine OS X audio device IDs: %s",
GetMacOSStatusCommentString(status));
ret = false;
@ -227,7 +227,7 @@ osx_output_set_device(struct osx_output *oo, GError **error)
kAudioDevicePropertyDeviceName,
&size, name);
if (status != noErr) {
g_set_error(error, osx_output_quark(), 0,
g_set_error(error, osx_output_quark(), status,
"Unable to determine OS X device name "
"(device %u): %s",
(unsigned int) deviceids[i],
@ -255,7 +255,7 @@ osx_output_set_device(struct osx_output *oo, GError **error)
&(deviceids[i]),
sizeof(AudioDeviceID));
if (status != noErr) {
g_set_error(error, osx_output_quark(), 0,
g_set_error(error, osx_output_quark(), status,
"Unable to set OS X audio output device: %s",
GetMacOSStatusCommentString(status));
ret = false;
@ -296,7 +296,7 @@ osx_output_open(void *data, struct audio_format *audio_format, GError **error)
status = OpenAComponent(comp, &od->au);
if (status != noErr) {
g_set_error(error, osx_output_quark(), 0,
g_set_error(error, osx_output_quark(), status,
"Unable to open OS X component: %s",
GetMacOSStatusCommentString(status));
return false;
@ -305,7 +305,7 @@ osx_output_open(void *data, struct audio_format *audio_format, GError **error)
status = AudioUnitInitialize(od->au);
if (status != noErr) {
CloseComponent(od->au);
g_set_error(error, osx_output_quark(), 0,
g_set_error(error, osx_output_quark(), status,
"Unable to initialize OS X audio unit: %s",
GetMacOSStatusCommentString(status));
return false;
@ -324,7 +324,7 @@ osx_output_open(void *data, struct audio_format *audio_format, GError **error)
if (result != noErr) {
AudioUnitUninitialize(od->au);
CloseComponent(od->au);
g_set_error(error, osx_output_quark(), 0,
g_set_error(error, osx_output_quark(), result,
"unable to set callback for OS X audio unit");
return false;
}
@ -364,7 +364,7 @@ osx_output_open(void *data, struct audio_format *audio_format, GError **error)
if (result != noErr) {
AudioUnitUninitialize(od->au);
CloseComponent(od->au);
g_set_error(error, osx_output_quark(), 0,
g_set_error(error, osx_output_quark(), result,
"Unable to set format on OS X device");
return false;
}
@ -379,7 +379,7 @@ osx_output_open(void *data, struct audio_format *audio_format, GError **error)
status = AudioOutputUnitStart(od->au);
if (status != 0) {
g_set_error(error, osx_output_quark(), 0,
g_set_error(error, osx_output_quark(), status,
"unable to start audio output: %s",
GetMacOSStatusCommentString(status));
return false;