diff options
author | Chris Robinson <[email protected]> | 2018-11-15 04:24:33 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-15 04:24:33 -0800 |
commit | 1971d0f5c6c94b250f4b3e29bdfa95c836f900bc (patch) | |
tree | b3af8bbd22fe26ad4db683214911897fae767ae3 /Alc/backends/sdl2.cpp | |
parent | d4f64b9e29319f56f2ecab1291918a52ec8336f1 (diff) |
Use std::string instead of al_string for enumerating
Diffstat (limited to 'Alc/backends/sdl2.cpp')
-rw-r--r-- | Alc/backends/sdl2.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Alc/backends/sdl2.cpp b/Alc/backends/sdl2.cpp index cf81e1f0..82c350e1 100644 --- a/Alc/backends/sdl2.cpp +++ b/Alc/backends/sdl2.cpp @@ -222,7 +222,7 @@ ALCbackendFactory *ALCsdl2BackendFactory_getFactory(void); static ALCboolean ALCsdl2BackendFactory_init(ALCsdl2BackendFactory *self); static void ALCsdl2BackendFactory_deinit(ALCsdl2BackendFactory *self); static ALCboolean ALCsdl2BackendFactory_querySupport(ALCsdl2BackendFactory *self, ALCbackend_Type type); -static void ALCsdl2BackendFactory_probe(ALCsdl2BackendFactory *self, enum DevProbe type, al_string *outnames); +static void ALCsdl2BackendFactory_probe(ALCsdl2BackendFactory *self, enum DevProbe type, std::string *outnames); static ALCbackend* ALCsdl2BackendFactory_createBackend(ALCsdl2BackendFactory *self, ALCdevice *device, ALCbackend_Type type); DEFINE_ALCBACKENDFACTORY_VTABLE(ALCsdl2BackendFactory); @@ -257,23 +257,21 @@ static ALCboolean ALCsdl2BackendFactory_querySupport(ALCsdl2BackendFactory* UNUS return ALC_FALSE; } -static void ALCsdl2BackendFactory_probe(ALCsdl2BackendFactory* UNUSED(self), enum DevProbe type, al_string *outnames) +static void ALCsdl2BackendFactory_probe(ALCsdl2BackendFactory* UNUSED(self), enum DevProbe type, std::string *outnames) { if(type != ALL_DEVICE_PROBE) return; int num_devices{SDL_GetNumAudioDevices(SDL_FALSE)}; - alstr_append_range(outnames, defaultDeviceName, defaultDeviceName+sizeof(defaultDeviceName)); + /* Includes null char. */ + outnames->append(defaultDeviceName, sizeof(defaultDeviceName)); for(int i{0};i < num_devices;++i) { std::string name{DEVNAME_PREFIX}; name += SDL_GetAudioDeviceName(i, SDL_FALSE); if(!name.empty()) - { - const char *namestr{name.c_str()}; - alstr_append_range(outnames, namestr, namestr+name.length()+1); - } + outnames->append(name.c_str(), name.length()+1); } } |