[assimp] Make sure ctype calls use unsigned char.

Cast to unsigned char as required by C++ (see C++ **[cctype.cyn]** -> ISO C99 section 7.4, [see also](https://en.cppreference.com/w/cpp/string/byte/isspace)).

Addresses https://github.com/assimp/assimp/issues/3867 and then some.
This commit is contained in:
Jason C
2021-05-04 04:55:08 -04:00
committed by Jason C
parent f17d58cadd
commit 2925592c64
13 changed files with 23 additions and 23 deletions

View File

@@ -193,7 +193,7 @@ void BaseImporter::GetExtensionList(std::set<std::string> &extensions) {
}
for (size_t i = 0; i < read; ++i) {
buffer[i] = static_cast<char>(::tolower(buffer[i]));
buffer[i] = static_cast<char>(::tolower((unsigned char)buffer[i]));
}
// It is not a proper handling of unicode files here ...
@@ -214,7 +214,7 @@ void BaseImporter::GetExtensionList(std::set<std::string> &extensions) {
token.clear();
const char *ptr(tokens[i]);
for (size_t tokIdx = 0; tokIdx < len; ++tokIdx) {
token.push_back(static_cast<char>(tolower(*ptr)));
token.push_back(static_cast<char>(tolower(static_cast<unsigned char>(*ptr))));
++ptr;
}
const char *r = strstr(buffer, token.c_str());
@@ -223,7 +223,7 @@ void BaseImporter::GetExtensionList(std::set<std::string> &extensions) {
}
// We need to make sure that we didn't accidentially identify the end of another token as our token,
// e.g. in a previous version the "gltf " present in some gltf files was detected as "f "
if (noAlphaBeforeTokens && (r != buffer && isalpha(r[-1]))) {
if (noAlphaBeforeTokens && (r != buffer && isalpha(static_cast<unsigned char>(r[-1])))) {
continue;
}
// We got a match, either we don't care where it is, or it happens to