aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends/wave.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-11-10 04:27:10 -0800
committerChris Robinson <[email protected]>2018-11-10 04:27:10 -0800
commitdc31969b04395db71d8162587f55cf81e7e69aac (patch)
tree7c4d07e655dc4fb4f6b19b477207b196799ce649 /Alc/backends/wave.cpp
parent58eb0e754d19237ca66d705834081a236e307484 (diff)
Get rid of the last few al_fopen calls
Diffstat (limited to 'Alc/backends/wave.cpp')
-rw-r--r--Alc/backends/wave.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/Alc/backends/wave.cpp b/Alc/backends/wave.cpp
index 4f3947e5..ec67342a 100644
--- a/Alc/backends/wave.cpp
+++ b/Alc/backends/wave.cpp
@@ -223,10 +223,7 @@ static int ALCwaveBackend_mixerProc(void *ptr)
static ALCenum ALCwaveBackend_open(ALCwaveBackend *self, const ALCchar *name)
{
- ALCdevice *device;
- const char *fname;
-
- fname = GetConfigValue(nullptr, "wave", "file", "");
+ const char *fname{GetConfigValue(nullptr, "wave", "file", "")};
if(!fname[0]) return ALC_INVALID_VALUE;
if(!name)
@@ -234,14 +231,21 @@ static ALCenum ALCwaveBackend_open(ALCwaveBackend *self, const ALCchar *name)
else if(strcmp(name, waveDevice) != 0)
return ALC_INVALID_VALUE;
- self->mFile = al_fopen(fname, "wb");
+#ifdef _WIN32
+ {
+ std::wstring wname = utf8_to_wstr(fname);
+ self->mFile = _wfopen(wname.c_str(), L"wb");
+ }
+#else
+ self->mFile = fopen(fname, "wb");
+#endif
if(!self->mFile)
{
ERR("Could not open file '%s': %s\n", fname, strerror(errno));
return ALC_INVALID_VALUE;
}
- device = STATIC_CAST(ALCbackend, self)->mDevice;
+ ALCdevice *device{STATIC_CAST(ALCbackend, self)->mDevice};
alstr_copy_cstr(&device->DeviceName, name);
return ALC_NO_ERROR;