diff options
author | Chris Robinson <[email protected]> | 2019-09-16 15:10:36 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-09-16 15:10:36 -0700 |
commit | 899a414591559633f2641a74325dffc5e54562c7 (patch) | |
tree | 5cd3b23181266634ff89fd3bc3ea68862bc0762c /alc | |
parent | 6d93b2ba81958eb277da4361924e89bc7048da41 (diff) |
Remove the last uses of the system's str[n]casecmp
Diffstat (limited to 'alc')
-rw-r--r-- | alc/alconfig.cpp | 13 | ||||
-rw-r--r-- | alc/alu.cpp | 7 | ||||
-rw-r--r-- | alc/helpers.cpp | 3 | ||||
-rw-r--r-- | alc/mixvoice.cpp | 15 | ||||
-rw-r--r-- | alc/panning.cpp | 21 |
5 files changed, 33 insertions, 26 deletions
diff --git a/alc/alconfig.cpp b/alc/alconfig.cpp index 666c2c2d..b266fe5b 100644 --- a/alc/alconfig.cpp +++ b/alc/alconfig.cpp @@ -46,6 +46,7 @@ #include <algorithm> #include "alcmain.h" +#include "alstring.h" #include "logging.h" #include "strutils.h" #include "compat.h" @@ -169,7 +170,7 @@ void LoadConfigFromFile(std::istream &f) *endsection = 0; curSection.clear(); - if(strcasecmp(section, "general") != 0) + if(al::strcasecmp(section, "general") != 0) { do { char *nextp = std::strchr(section, '%'); @@ -447,7 +448,7 @@ const char *GetConfigValue(const char *devName, const char *blockName, const cha return def; std::string key; - if(blockName && strcasecmp(blockName, "general") != 0) + if(blockName && al::strcasecmp(blockName, "general") != 0) { key = blockName; if(devName) @@ -532,8 +533,8 @@ al::optional<bool> ConfigValueBool(const char *devName, const char *blockName, c if(!val[0]) return al::nullopt; return al::make_optional( - strcasecmp(val, "true") == 0 || strcasecmp(val, "yes") == 0 || - strcasecmp(val, "on") == 0 || atoi(val) != 0); + al::strcasecmp(val, "true") == 0 || al::strcasecmp(val, "yes") == 0 || + al::strcasecmp(val, "on") == 0 || atoi(val) != 0); } int GetConfigValueBool(const char *devName, const char *blockName, const char *keyName, int def) @@ -541,6 +542,6 @@ int GetConfigValueBool(const char *devName, const char *blockName, const char *k const char *val = GetConfigValue(devName, blockName, keyName, ""); if(!val[0]) return def != 0; - return (strcasecmp(val, "true") == 0 || strcasecmp(val, "yes") == 0 || - strcasecmp(val, "on") == 0 || atoi(val) != 0); + return (al::strcasecmp(val, "true") == 0 || al::strcasecmp(val, "yes") == 0 || + al::strcasecmp(val, "on") == 0 || atoi(val) != 0); } diff --git a/alc/alu.cpp b/alc/alu.cpp index 32c52526..b0405822 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -55,6 +55,7 @@ #include "almalloc.h" #include "alnumeric.h" #include "alspan.h" +#include "alstring.h" #include "ambidefs.h" #include "atomic.h" #include "bformatdec.h" @@ -90,7 +91,8 @@ ALfloat InitConeScale() ALfloat ret{1.0f}; if(auto optval = al::getenv("__ALSOFT_HALF_ANGLE_CONES")) { - if(strcasecmp(optval->c_str(), "true") == 0 || strtol(optval->c_str(), nullptr, 0) == 1) + if(al::strcasecmp(optval->c_str(), "true") == 0 + || strtol(optval->c_str(), nullptr, 0) == 1) ret *= 0.5f; } return ret; @@ -101,7 +103,8 @@ ALfloat InitZScale() ALfloat ret{1.0f}; if(auto optval = al::getenv("__ALSOFT_REVERSE_Z")) { - if(strcasecmp(optval->c_str(), "true") == 0 || strtol(optval->c_str(), nullptr, 0) == 1) + if(al::strcasecmp(optval->c_str(), "true") == 0 + || strtol(optval->c_str(), nullptr, 0) == 1) ret *= -1.0f; } return ret; diff --git a/alc/helpers.cpp b/alc/helpers.cpp index 77f96fb8..1d19d004 100644 --- a/alc/helpers.cpp +++ b/alc/helpers.cpp @@ -70,6 +70,7 @@ #include "alcmain.h" #include "almalloc.h" +#include "alstring.h" #include "compat.h" #include "cpu_caps.h" #include "fpu_modes.h" @@ -662,7 +663,7 @@ static void DirectorySearch(const char *path, const char *ext, al::vector<std::s size_t len{strlen(dirent->d_name)}; if(len <= extlen) continue; - if(strcasecmp(dirent->d_name+len-extlen, ext) != 0) + if(al::strcasecmp(dirent->d_name+len-extlen, ext) != 0) continue; results->emplace_back(); diff --git a/alc/mixvoice.cpp b/alc/mixvoice.cpp index 3d4d9cb8..34fe9275 100644 --- a/alc/mixvoice.cpp +++ b/alc/mixvoice.cpp @@ -48,6 +48,7 @@ #include "alnumeric.h" #include "aloptional.h" #include "alspan.h" +#include "alstring.h" #include "alu.h" #include "cpu_caps.h" #include "devformat.h" @@ -174,22 +175,22 @@ void aluInitMixer() if(auto resopt = ConfigValueStr(nullptr, nullptr, "resampler")) { const char *str{resopt->c_str()}; - if(strcasecmp(str, "point") == 0 || strcasecmp(str, "none") == 0) + if(al::strcasecmp(str, "point") == 0 || al::strcasecmp(str, "none") == 0) ResamplerDefault = PointResampler; - else if(strcasecmp(str, "linear") == 0) + else if(al::strcasecmp(str, "linear") == 0) ResamplerDefault = LinearResampler; - else if(strcasecmp(str, "cubic") == 0) + else if(al::strcasecmp(str, "cubic") == 0) ResamplerDefault = FIR4Resampler; - else if(strcasecmp(str, "bsinc12") == 0) + else if(al::strcasecmp(str, "bsinc12") == 0) ResamplerDefault = BSinc12Resampler; - else if(strcasecmp(str, "bsinc24") == 0) + else if(al::strcasecmp(str, "bsinc24") == 0) ResamplerDefault = BSinc24Resampler; - else if(strcasecmp(str, "bsinc") == 0) + else if(al::strcasecmp(str, "bsinc") == 0) { WARN("Resampler option \"%s\" is deprecated, using bsinc12\n", str); ResamplerDefault = BSinc12Resampler; } - else if(strcasecmp(str, "sinc4") == 0 || strcasecmp(str, "sinc8") == 0) + else if(al::strcasecmp(str, "sinc4") == 0 || al::strcasecmp(str, "sinc8") == 0) { WARN("Resampler option \"%s\" is deprecated, using cubic\n", str); ResamplerDefault = FIR4Resampler; diff --git a/alc/panning.cpp b/alc/panning.cpp index 7fb1d9ff..7e2408da 100644 --- a/alc/panning.cpp +++ b/alc/panning.cpp @@ -44,6 +44,7 @@ #include "alnumeric.h" #include "aloptional.h" #include "alspan.h" +#include "alstring.h" #include "alu.h" #include "ambdec.h" #include "ambidefs.h" @@ -586,25 +587,25 @@ void InitHrtfPanning(ALCdevice *device) if(auto modeopt = ConfigValueStr(device->DeviceName.c_str(), nullptr, "hrtf-mode")) { const char *mode{modeopt->c_str()}; - if(strcasecmp(mode, "basic") == 0) + if(al::strcasecmp(mode, "basic") == 0) { ERR("HRTF mode \"%s\" deprecated, substituting \"%s\"\n", mode, "ambi2"); mode = "ambi2"; } - if(strcasecmp(mode, "full") == 0) + if(al::strcasecmp(mode, "full") == 0) device->mRenderMode = HrtfRender; - else if(strcasecmp(mode, "ambi1") == 0) + else if(al::strcasecmp(mode, "ambi1") == 0) { device->mRenderMode = NormalRender; ambi_order = 1; } - else if(strcasecmp(mode, "ambi2") == 0) + else if(al::strcasecmp(mode, "ambi2") == 0) { device->mRenderMode = NormalRender; ambi_order = 2; } - else if(strcasecmp(mode, "ambi3") == 0) + else if(al::strcasecmp(mode, "ambi3") == 0) { device->mRenderMode = NormalRender; ambi_order = 3; @@ -732,11 +733,11 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, HrtfRequestMode hrtf_appr if(auto modeopt = ConfigValueStr(device->DeviceName.c_str(), nullptr, "stereo-mode")) { const char *mode{modeopt->c_str()}; - if(strcasecmp(mode, "headphones") == 0) + if(al::strcasecmp(mode, "headphones") == 0) headphones = true; - else if(strcasecmp(mode, "speakers") == 0) + else if(al::strcasecmp(mode, "speakers") == 0) headphones = false; - else if(strcasecmp(mode, "auto") != 0) + else if(al::strcasecmp(mode, "auto") != 0) ERR("Unexpected stereo-mode: %s\n", mode); } } @@ -835,9 +836,9 @@ no_hrtf: if(auto encopt = ConfigValueStr(device->DeviceName.c_str(), nullptr, "stereo-encoding")) { const char *mode{encopt->c_str()}; - if(strcasecmp(mode, "uhj") == 0) + if(al::strcasecmp(mode, "uhj") == 0) device->mRenderMode = NormalRender; - else if(strcasecmp(mode, "panpot") != 0) + else if(al::strcasecmp(mode, "panpot") != 0) ERR("Unexpected stereo-encoding: %s\n", mode); } if(device->mRenderMode == NormalRender) |