aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-03-28 22:11:34 -0700
committerChris Robinson <[email protected]>2014-03-28 22:11:34 -0700
commit7b93e10f7a24b7e18c916b0f791d9998f9b4b800 (patch)
tree204d07479d2f25e4170edfc80c68c810826384b2 /Alc/backends
parent7570195b0973770e2b19551399fcf0e4d3b81a21 (diff)
Use an al_string for the device name
Diffstat (limited to 'Alc/backends')
-rw-r--r--Alc/backends/alsa.c4
-rw-r--r--Alc/backends/coreaudio.c4
-rw-r--r--Alc/backends/dsound.c4
-rw-r--r--Alc/backends/loopback.c2
-rw-r--r--Alc/backends/mmdevapi.c9
-rw-r--r--Alc/backends/null.c2
-rw-r--r--Alc/backends/opensl.c2
-rw-r--r--Alc/backends/oss.c4
-rw-r--r--Alc/backends/portaudio.c4
-rw-r--r--Alc/backends/pulseaudio.c6
-rw-r--r--Alc/backends/qsa.c8
-rw-r--r--Alc/backends/sndio.c2
-rw-r--r--Alc/backends/solaris.c2
-rw-r--r--Alc/backends/wave.c2
-rw-r--r--Alc/backends/winmm.c4
15 files changed, 27 insertions, 32 deletions
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: