summaryrefslogtreecommitdiff
path: root/gjs
diff options
context:
space:
mode:
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2022-04-28 19:53:59 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2022-04-28 20:36:59 +0200
commit753f70ae577d1a31a6eb1a4413e2a8c626e75b1c (patch)
treef2b25b3844e6f5457f6eb6867cc5424b80bdafc8 /gjs
parent70552bee79f644836a5e9f9a54845791b1ef7a94 (diff)
downloadgjs-753f70ae577d1a31a6eb1a4413e2a8c626e75b1c.tar.gz
jsapi-util-strings: Ignore locale to compute the upper case of a char
We used to compute camel-case name of properties using toupper(), however this is locale-dependent, while in this case we want to be sure that we're only using ASCII values. This is particularly problematic in Turkish (and maybe other locales) because there 'i'.toLocaleUpperCase() is 'İ', that is definitely not an ASCII char, causing problems to with our generated properties. See: https://github.com/micheleg/dash-to-dock/issues/1687
Diffstat (limited to 'gjs')
-rw-r--r--gjs/gjs_pch.hh1
-rw-r--r--gjs/jsapi-util-string.cpp3
2 files changed, 1 insertions, 3 deletions
diff --git a/gjs/gjs_pch.hh b/gjs/gjs_pch.hh
index 46bea8a9..6f1b0b4f 100644
--- a/gjs/gjs_pch.hh
+++ b/gjs/gjs_pch.hh
@@ -28,7 +28,6 @@
#include <vector>
#include <assert.h>
-#include <ctype.h>
#include <errno.h>
#include <ffi.h>
#include <gio/gio.h>
diff --git a/gjs/jsapi-util-string.cpp b/gjs/jsapi-util-string.cpp
index c78069a8..a39a0c05 100644
--- a/gjs/jsapi-util-string.cpp
+++ b/gjs/jsapi-util-string.cpp
@@ -4,7 +4,6 @@
#include <config.h>
-#include <ctype.h> // for toupper
#include <stdint.h>
#include <string.h> // for size_t, strlen
#include <sys/types.h> // for ssize_t
@@ -59,7 +58,7 @@ GjsAutoChar gjs_hyphen_to_camel(const char* str) {
if (*input_iter == '-') {
uppercase_next = true;
} else if (uppercase_next) {
- *output_iter++ = toupper(*input_iter);
+ *output_iter++ = g_ascii_toupper(*input_iter);
uppercase_next = false;
} else {
*output_iter++ = *input_iter;