Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2022-05-09 18:17:03 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-05-09 19:28:24 +0300
commit78f61bf8c13460f8065eaa8eabaa2ac5a4c66a5e (patch)
tree94673857e57239130dcaca621b61b07e4f2e296d /source/blender/blenlib/intern
parent686abf1850545f8c953a76791bd098a5259ce0d6 (diff)
Fix T97906: OpenEXR files with lower case xyz channel names not read correctly
Adds some utility functions to avoid using toupper() which depends on the locale and should not be used for this type of parsing.
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r--source/blender/blenlib/intern/string.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index 74559751d91..8387eb5f4f9 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -914,14 +914,22 @@ size_t BLI_strnlen(const char *s, const size_t maxlen)
/** \name String Case Conversion
* \{ */
+char BLI_tolower_ascii(const char c)
+{
+ return (c >= 'A' && c <= 'Z') ? c + ('a' - 'A') : c;
+}
+
+char BLI_toupper_ascii(const char c)
+{
+ return (c >= 'a' && c <= 'z') ? c - ('a' - 'A') : c;
+}
+
void BLI_str_tolower_ascii(char *str, const size_t len)
{
size_t i;
for (i = 0; (i < len) && str[i]; i++) {
- if (str[i] >= 'A' && str[i] <= 'Z') {
- str[i] += 'a' - 'A';
- }
+ str[i] = BLI_tolower_ascii(str[i]);
}
}
@@ -930,9 +938,7 @@ void BLI_str_toupper_ascii(char *str, const size_t len)
size_t i;
for (i = 0; (i < len) && str[i]; i++) {
- if (str[i] >= 'a' && str[i] <= 'z') {
- str[i] -= 'a' - 'A';
- }
+ str[i] = BLI_toupper_ascii(str[i]);
}
}