diff options
author | Chris Robinson <[email protected]> | 2023-08-06 18:49:42 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-08-06 18:49:42 -0700 |
commit | 9296af5566afea4ba4cb78b374ef3ee0bf9bc04b (patch) | |
tree | ac71d8896956166aed320ed38ffb32847bc2cba7 /alc/backends/wave.cpp | |
parent | 05d80f9b3283d7686a27e5d3ed0bac6086669368 (diff) |
Use a string_view for the backend open method
Diffstat (limited to 'alc/backends/wave.cpp')
-rw-r--r-- | alc/backends/wave.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/alc/backends/wave.cpp b/alc/backends/wave.cpp index 40592ee7..1078c654 100644 --- a/alc/backends/wave.cpp +++ b/alc/backends/wave.cpp @@ -96,7 +96,7 @@ struct WaveBackend final : public BackendBase { int mixerProc(); - void open(const char *name) override; + void open(std::string_view name) override; bool reset() override; void start() override; void stop() override; @@ -194,24 +194,24 @@ int WaveBackend::mixerProc() return 0; } -void WaveBackend::open(const char *name) +void WaveBackend::open(std::string_view name) { auto fname = ConfigValueStr(nullptr, "wave", "file"); if(!fname) throw al::backend_exception{al::backend_error::NoDevice, "No wave output filename"}; - if(!name) + if(name.empty()) name = waveDevice; - else if(strcmp(name, waveDevice) != 0) - throw al::backend_exception{al::backend_error::NoDevice, "Device name \"%s\" not found", - name}; + else if(name != waveDevice) + throw al::backend_exception{al::backend_error::NoDevice, "Device name \"%.*s\" not found", + static_cast<int>(name.length()), name.data()}; /* There's only one "device", so if it's already open, we're done. */ if(mFile) return; #ifdef _WIN32 { - std::wstring wname{utf8_to_wstr(fname->c_str())}; + std::wstring wname{utf8_to_wstr(fname.value())}; mFile = _wfopen(wname.c_str(), L"wb"); } #else |