diff options
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/ALc.c | 19 | ||||
-rw-r--r-- | Alc/backends/alsa.c | 4 | ||||
-rw-r--r-- | Alc/backends/coreaudio.c | 4 | ||||
-rw-r--r-- | Alc/backends/dsound.c | 4 | ||||
-rw-r--r-- | Alc/backends/loopback.c | 2 | ||||
-rw-r--r-- | Alc/backends/mmdevapi.c | 9 | ||||
-rw-r--r-- | Alc/backends/null.c | 2 | ||||
-rw-r--r-- | Alc/backends/opensl.c | 2 | ||||
-rw-r--r-- | Alc/backends/oss.c | 4 | ||||
-rw-r--r-- | Alc/backends/portaudio.c | 4 | ||||
-rw-r--r-- | Alc/backends/pulseaudio.c | 6 | ||||
-rw-r--r-- | Alc/backends/qsa.c | 8 | ||||
-rw-r--r-- | Alc/backends/sndio.c | 2 | ||||
-rw-r--r-- | Alc/backends/solaris.c | 2 | ||||
-rw-r--r-- | Alc/backends/wave.c | 2 | ||||
-rw-r--r-- | Alc/backends/winmm.c | 4 |
16 files changed, 36 insertions, 42 deletions
@@ -2024,8 +2024,7 @@ static ALCvoid FreeDevice(ALCdevice *device) free(device->Bs2b); device->Bs2b = NULL; - free(device->DeviceName); - device->DeviceName = NULL; + AL_STRING_DEINIT(device->DeviceName); al_free(device); } @@ -2355,7 +2354,7 @@ ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *Device, ALCenum para case ALC_ALL_DEVICES_SPECIFIER: if(VerifyDevice(Device)) { - value = Device->DeviceName; + value = al_string_get_cstr(Device->DeviceName); ALCdevice_DecRef(Device); } else @@ -2368,7 +2367,7 @@ ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *Device, ALCenum para case ALC_CAPTURE_DEVICE_SPECIFIER: if(VerifyDevice(Device)) { - value = Device->DeviceName; + value = al_string_get_cstr(Device->DeviceName); ALCdevice_DecRef(Device); } else @@ -3069,7 +3068,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) device->Flags = 0; device->Bs2b = NULL; device->Bs2bLevel = 0; - device->DeviceName = NULL; + AL_STRING_INIT(device->DeviceName); device->ContextList = NULL; @@ -3285,7 +3284,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) device->next = DeviceList; } while(CompExchangePtr((XchgPtr*)&DeviceList, device->next, device) != device->next); - TRACE("Created device %p, \"%s\"\n", device, device->DeviceName); + TRACE("Created device %p, \"%s\"\n", device, al_string_get_cstr(device->DeviceName)); return device; } @@ -3365,6 +3364,8 @@ ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *deviceName, device->Connected = ALC_TRUE; device->Type = Capture; + AL_STRING_INIT(device->DeviceName); + InitUIntMap(&device->BufferMap, ~0); InitUIntMap(&device->EffectMap, ~0); InitUIntMap(&device->FilterMap, ~0); @@ -3372,8 +3373,6 @@ ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *deviceName, InitUIntMap(&device->PresetMap, ~0); InitUIntMap(&device->FontsoundMap, ~0); - device->DeviceName = NULL; - if(!CaptureBackend.getFactory) device->Backend = create_backend_wrapper(device, &CaptureBackend.Funcs, ALCbackend_Capture); @@ -3414,7 +3413,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *deviceName, device->next = DeviceList; } while(CompExchangePtr((XchgPtr*)&DeviceList, device->next, device) != device->next); - TRACE("Created device %p, \"%s\"\n", device, device->DeviceName); + TRACE("Created device %p, \"%s\"\n", device, al_string_get_cstr(device->DeviceName)); return device; } @@ -3535,7 +3534,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(const ALCchar *deviceN device->Flags = 0; device->Bs2b = NULL; device->Bs2bLevel = 0; - device->DeviceName = NULL; + AL_STRING_INIT(device->DeviceName); device->ContextList = NULL; diff --git a/Alc/backends/alsa.c b/Alc/backends/alsa.c index 51965cec..106e788e 100644 --- a/Alc/backends/alsa.c +++ b/Alc/backends/alsa.c @@ -647,7 +647,7 @@ static ALCenum ALCplaybackAlsa_open(ALCplaybackAlsa *self, const ALCchar *name) /* Free alsa's global config tree. Otherwise valgrind reports a ton of leaks. */ snd_config_update_free_global(); - device->DeviceName = strdup(name); + al_string_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } @@ -1052,7 +1052,7 @@ static ALCenum ALCcaptureAlsa_open(ALCcaptureAlsa *self, const ALCchar *name) } } - device->DeviceName = strdup(name); + al_string_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; diff --git a/Alc/backends/coreaudio.c b/Alc/backends/coreaudio.c index 5c9b69c8..8098f84a 100644 --- a/Alc/backends/coreaudio.c +++ b/Alc/backends/coreaudio.c @@ -180,7 +180,7 @@ static ALCenum ca_open_playback(ALCdevice *device, const ALCchar *deviceName) return ALC_INVALID_VALUE; } - device->DeviceName = strdup(deviceName); + al_string_copy_cstr(&device->DeviceName, deviceName); device->ExtraData = data; return ALC_NO_ERROR; } @@ -577,6 +577,8 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) if(data->ring == NULL) goto error; + al_string_copy_cstr(&device->DeviceName, deviceName); + return ALC_NO_ERROR; error: diff --git a/Alc/backends/dsound.c b/Alc/backends/dsound.c index b8fc02d6..079ed02d 100644 --- a/Alc/backends/dsound.c +++ b/Alc/backends/dsound.c @@ -411,7 +411,7 @@ static ALCenum DSoundOpenPlayback(ALCdevice *device, const ALCchar *deviceName) return ALC_INVALID_VALUE; } - device->DeviceName = strdup(deviceName); + al_string_copy_cstr(&device->DeviceName, deviceName); device->ExtraData = data; return ALC_NO_ERROR; } @@ -854,7 +854,7 @@ static ALCenum DSoundOpenCapture(ALCdevice *device, const ALCchar *deviceName) data->BufferBytes = DSCBDescription.dwBufferBytes; SetDefaultWFXChannelOrder(device); - device->DeviceName = strdup(deviceName); + al_string_copy_cstr(&device->DeviceName, deviceName); device->ExtraData = data; return ALC_NO_ERROR; diff --git a/Alc/backends/loopback.c b/Alc/backends/loopback.c index 053cfce4..d509313a 100644 --- a/Alc/backends/loopback.c +++ b/Alc/backends/loopback.c @@ -59,7 +59,7 @@ static ALCenum ALCloopback_open(ALCloopback *self, const ALCchar *name) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - device->DeviceName = strdup(name); + al_string_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } diff --git a/Alc/backends/mmdevapi.c b/Alc/backends/mmdevapi.c index 9933c873..b713e831 100644 --- a/Alc/backends/mmdevapi.c +++ b/Alc/backends/mmdevapi.c @@ -652,13 +652,8 @@ static DWORD CALLBACK MMDevApiMsgProc(void *ptr) hr = IMMDevice_Activate(data->mmdev, &IID_IAudioClient, CLSCTX_INPROC_SERVER, NULL, &ptr); if(SUCCEEDED(hr)) { - al_string str; - data->client = ptr; - AL_STRING_INIT(str); - get_device_name(data->mmdev, &str); - device->DeviceName = strdup(al_string_get_cstr(str)); - AL_STRING_DEINIT(str); + get_device_name(data->mmdev, &device->DeviceName); } if(FAILED(hr)) @@ -875,7 +870,7 @@ static ALCenum MMDevApiOpenPlayback(ALCdevice *device, const ALCchar *deviceName hr = E_FAIL; for(i = 0;i < NumPlaybackDevices;i++) { - if(strcmp(deviceName, al_string_get_cstr(PlaybackDeviceList[i].name)) == 0) + if(al_string_cmp_cstr(PlaybackDeviceList[i].name, deviceName) == 0) { data->devid = strdupW(PlaybackDeviceList[i].devid); hr = S_OK; diff --git a/Alc/backends/null.c b/Alc/backends/null.c index 59299dff..6b59ef7a 100644 --- a/Alc/backends/null.c +++ b/Alc/backends/null.c @@ -120,7 +120,7 @@ static ALCenum ALCnullBackend_open(ALCnullBackend *self, const ALCchar *name) return ALC_INVALID_VALUE; device = STATIC_CAST(ALCbackend, self)->mDevice; - device->DeviceName = strdup(name); + al_string_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } diff --git a/Alc/backends/opensl.c b/Alc/backends/opensl.c index 619c9847..220e6e5c 100644 --- a/Alc/backends/opensl.c +++ b/Alc/backends/opensl.c @@ -193,7 +193,7 @@ static ALCenum opensl_open_playback(ALCdevice *Device, const ALCchar *deviceName return ALC_INVALID_VALUE; } - Device->DeviceName = strdup(deviceName); + al_string_copy_cstr(&Device->DeviceName, deviceName); Device->ExtraData = data; return ALC_NO_ERROR; diff --git a/Alc/backends/oss.c b/Alc/backends/oss.c index 54c487a4..f0532cdf 100644 --- a/Alc/backends/oss.c +++ b/Alc/backends/oss.c @@ -168,7 +168,7 @@ static ALCenum ALCplaybackOSS_open(ALCplaybackOSS *self, const ALCchar *name) return ALC_INVALID_VALUE; } - device->DeviceName = strdup(name); + al_string_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } @@ -491,7 +491,7 @@ static ALCenum ALCcaptureOSS_open(ALCcaptureOSS *self, const ALCchar *name) return ALC_OUT_OF_MEMORY; } - device->DeviceName = strdup(name); + al_string_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } diff --git a/Alc/backends/portaudio.c b/Alc/backends/portaudio.c index 162788fc..0bb6372c 100644 --- a/Alc/backends/portaudio.c +++ b/Alc/backends/portaudio.c @@ -212,7 +212,7 @@ retry_open: } device->ExtraData = data; - device->DeviceName = strdup(deviceName); + al_string_copy_cstr(&device->DeviceName, deviceName); return ALC_NO_ERROR; } @@ -354,7 +354,7 @@ static ALCenum pa_open_capture(ALCdevice *device, const ALCchar *deviceName) goto error; } - device->DeviceName = strdup(deviceName); + al_string_copy_cstr(&device->DeviceName, deviceName); device->ExtraData = data; return ALC_NO_ERROR; diff --git a/Alc/backends/pulseaudio.c b/Alc/backends/pulseaudio.c index d2d5c9aa..bb371453 100644 --- a/Alc/backends/pulseaudio.c +++ b/Alc/backends/pulseaudio.c @@ -695,8 +695,7 @@ static void ALCpulsePlayback_sinkNameCallback(pa_context *UNUSED(context), const return; } - free(device->DeviceName); - device->DeviceName = strdup(info->description); + al_string_copy_cstr(&device->DeviceName, info->description); } @@ -1281,8 +1280,7 @@ static void ALCpulseCapture_sourceNameCallback(pa_context *UNUSED(context), cons return; } - free(device->DeviceName); - device->DeviceName = strdup(info->description); + al_string_copy_cstr(&device->DeviceName, info->description); } diff --git a/Alc/backends/qsa.c b/Alc/backends/qsa.c index c9762f85..d9d7c87b 100644 --- a/Alc/backends/qsa.c +++ b/Alc/backends/qsa.c @@ -343,8 +343,8 @@ static ALCenum qsa_open_playback(ALCdevice* device, const ALCchar* deviceName) return ALC_INVALID_DEVICE; } - device->DeviceName=strdup(deviceName); - device->ExtraData=data; + al_string_copy_cstr(&device->DeviceName, deviceName); + device->ExtraData = data; return ALC_NO_ERROR; } @@ -711,8 +711,8 @@ static ALCenum qsa_open_capture(ALCdevice* device, const ALCchar* deviceName) return ALC_INVALID_DEVICE; } - device->DeviceName=strdup(deviceName); - device->ExtraData=data; + al_string_copy_cstr(&device->DeviceName, deviceName); + device->ExtraData = data; switch (device->FmtType) { diff --git a/Alc/backends/sndio.c b/Alc/backends/sndio.c index 80aebfd1..9e43f08a 100644 --- a/Alc/backends/sndio.c +++ b/Alc/backends/sndio.c @@ -111,7 +111,7 @@ static ALCenum sndio_open_playback(ALCdevice *device, const ALCchar *deviceName) return ALC_INVALID_VALUE; } - device->DeviceName = strdup(deviceName); + al_string_copy_cstr(&device->DeviceName, deviceName); device->ExtraData = data; return ALC_NO_ERROR; diff --git a/Alc/backends/solaris.c b/Alc/backends/solaris.c index 700131c8..edd0e060 100644 --- a/Alc/backends/solaris.c +++ b/Alc/backends/solaris.c @@ -119,7 +119,7 @@ static ALCenum solaris_open_playback(ALCdevice *device, const ALCchar *deviceNam return ALC_INVALID_VALUE; } - device->DeviceName = strdup(deviceName); + al_string_copy_cstr(&device->DeviceName, deviceName); device->ExtraData = data; return ALC_NO_ERROR; } diff --git a/Alc/backends/wave.c b/Alc/backends/wave.c index 2209c798..f6bedc08 100644 --- a/Alc/backends/wave.c +++ b/Alc/backends/wave.c @@ -191,7 +191,7 @@ static ALCenum wave_open_playback(ALCdevice *device, const ALCchar *deviceName) return ALC_INVALID_VALUE; } - device->DeviceName = strdup(deviceName); + al_string_copy_cstr(&device->DeviceName, deviceName); device->ExtraData = data; return ALC_NO_ERROR; } diff --git a/Alc/backends/winmm.c b/Alc/backends/winmm.c index 7082a874..19cad879 100644 --- a/Alc/backends/winmm.c +++ b/Alc/backends/winmm.c @@ -336,7 +336,7 @@ retry_open: goto failure; } - Device->DeviceName = strdup(PlaybackDeviceList[DeviceID]); + al_string_copy_cstr(&Device->DeviceName, PlaybackDeviceList[DeviceID]); return ALC_NO_ERROR; failure: @@ -606,7 +606,7 @@ static ALCenum WinMMOpenCapture(ALCdevice *Device, const ALCchar *deviceName) if (data->WaveThread == NULL) goto failure; - Device->DeviceName = strdup(CaptureDeviceList[DeviceID]); + al_string_copy_cstr(&Device->DeviceName, CaptureDeviceList[DeviceID]); return ALC_NO_ERROR; failure: |