[gjs/master.msvc: 2/4] gjs/text-encoding.cpp: Replace strcasecmp with g_ascii_strcasecmp
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/master.msvc: 2/4] gjs/text-encoding.cpp: Replace strcasecmp with g_ascii_strcasecmp
- Date: Wed, 7 Jul 2021 10:03:57 +0000 (UTC)
commit 6c893a302225b6514216d943f06a360b83d8571c
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Wed Jul 7 17:48:32 2021 +0800
gjs/text-encoding.cpp: Replace strcasecmp with g_ascii_strcasecmp
We can also define it as _stricmp on builds using the Microsoft Visual
Studio/SDK headers, but just to keep things safe.
gjs/text-encoding.cpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/gjs/text-encoding.cpp b/gjs/text-encoding.cpp
index a3559fc8..a77bd19f 100644
--- a/gjs/text-encoding.cpp
+++ b/gjs/text-encoding.cpp
@@ -54,12 +54,13 @@ static const char* UTF16_CODESET = "UTF-16BE";
//
// is_utf8_label is only an optimization, so if a label
// doesn't match we just use the slower path.
- if (strcasecmp(encoding, "utf-8") == 0 || strcasecmp(encoding, "utf8") == 0)
+ if (g_ascii_strcasecmp(encoding, "utf-8") == 0 ||
+ g_ascii_strcasecmp(encoding, "utf8") == 0)
return true;
GjsAutoChar stripped(g_strdup(encoding));
- return strcasecmp(g_strstrip(stripped), "utf-8") == 0 ||
- strcasecmp(stripped, "utf8") == 0;
+ return g_ascii_strcasecmp(g_strstrip(stripped), "utf-8") == 0 ||
+ g_ascii_strcasecmp(stripped, "utf8") == 0;
}
GJS_JSAPI_RETURN_CONVENTION
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]