[gjs/master.msvc: 4/8] gjs/text-encoding.cpp: Replace strcasecmp with g_ascii_strcasecmp




commit 9f00808ad462651281d0730a884702192eee4aab
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]