mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-09 15:30:41 +00:00
update openal-soft
sync point: master-ac5d40e40a0155351fe1be4aab30017b6a13a859
This commit is contained in:
parent
762a84550f
commit
3603188b7f
365 changed files with 76053 additions and 53126 deletions
45
Engine/lib/openal-soft/common/alstring.cpp
Normal file
45
Engine/lib/openal-soft/common/alstring.cpp
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "alstring.h"
|
||||
|
||||
#include <cctype>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
int to_upper(const char ch)
|
||||
{
|
||||
using char8_traits = std::char_traits<char>;
|
||||
return std::toupper(char8_traits::to_int_type(ch));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace al {
|
||||
|
||||
int strcasecmp(const char *str0, const char *str1) noexcept
|
||||
{
|
||||
do {
|
||||
const int diff{to_upper(*str0) - to_upper(*str1)};
|
||||
if(diff < 0) return -1;
|
||||
if(diff > 0) return 1;
|
||||
} while(*(str0++) && *(str1++));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int strncasecmp(const char *str0, const char *str1, std::size_t len) noexcept
|
||||
{
|
||||
if(len > 0)
|
||||
{
|
||||
do {
|
||||
const int diff{to_upper(*str0) - to_upper(*str1)};
|
||||
if(diff < 0) return -1;
|
||||
if(diff > 0) return 1;
|
||||
} while(--len && *(str0++) && *(str1++));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace al
|
||||
Loading…
Add table
Add a link
Reference in a new issue