diff options
author | Chris Robinson <[email protected]> | 2023-12-29 03:39:58 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-12-29 03:39:58 -0800 |
commit | 10ecdff7d1dfcc16bd2a090f089781310ea9a93d (patch) | |
tree | ecd0f09a18f211ca7df2120e7c998aa037f5dfe4 /alc/backends | |
parent | 768781bab97732fbd0d66fa153d4ebc768be1240 (diff) |
Handle pointer ownership a bit better
Diffstat (limited to 'alc/backends')
-rw-r--r-- | alc/backends/wave.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/alc/backends/wave.cpp b/alc/backends/wave.cpp index 60cebd7f..985bb539 100644 --- a/alc/backends/wave.cpp +++ b/alc/backends/wave.cpp @@ -56,7 +56,7 @@ using ubyte = unsigned char; using ushort = unsigned short; struct FileDeleter { - void operator()(FILE *f) { fclose(f); } + void operator()(gsl::owner<FILE*> f) { fclose(f); } }; using FilePtr = std::unique_ptr<FILE,FileDeleter>; @@ -211,10 +211,10 @@ void WaveBackend::open(std::string_view name) #ifdef _WIN32 { std::wstring wname{utf8_to_wstr(fname.value())}; - mFile.reset(_wfopen(wname.c_str(), L"wb")); + mFile = FilePtr{_wfopen(wname.c_str(), L"wb")}; } #else - mFile.reset(fopen(fname->c_str(), "wb")); + mFile = FilePtr{fopen(fname->c_str(), "wb")}; #endif if(!mFile) throw al::backend_exception{al::backend_error::DeviceError, "Could not open file '%s': %s", |