[gjs/mozjs91: 124/135] Some functions have moved to js/String.h




commit b945d73362a6e0941fcb72f4111d2ab84b084843
Author: Evan Welsh <contact evanwelsh com>
Date:   Sat Aug 7 14:45:11 2021 -0700

    Some functions have moved to js/String.h
    
    - JS_StringHasLatin1Chars is now JS::StringHasLatin1Chars
    - LinearString utilities in js:: have moved to JS::
    
    See https://bugzilla.mozilla.org/show_bug.cgi?id=1663365

 gjs/jsapi-util-string.cpp | 13 +++++++------
 gjs/text-encoding.cpp     |  3 ++-
 2 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/gjs/jsapi-util-string.cpp b/gjs/jsapi-util-string.cpp
index c42fe1c0..81017ce7 100644
--- a/gjs/jsapi-util-string.cpp
+++ b/gjs/jsapi-util-string.cpp
@@ -25,6 +25,7 @@
 #include <js/Object.h>  // for GetClass
 #include <js/Promise.h>
 #include <js/RootingAPI.h>
+#include <js/String.h>
 #include <js/Symbol.h>
 #include <js/TypeDecls.h>
 #include <js/Utility.h>  // for UniqueChars
@@ -292,7 +293,7 @@ gjs_string_get_char16_data(JSContext       *context,
                            char16_t       **data_p,
                            size_t          *len_p)
 {
-    if (JS_StringHasLatin1Chars(str))
+    if (JS::StringHasLatin1Chars(str))
         return from_latin1(context, str, data_p, len_p);
 
     /* From this point on, crash if a GC is triggered while we are using
@@ -338,7 +339,7 @@ gjs_string_to_ucs4(JSContext       *cx,
     size_t len;
     GError *error = NULL;
 
-    if (JS_StringHasLatin1Chars(str))
+    if (JS::StringHasLatin1Chars(str))
         return from_latin1(cx, str, ucs4_string_p, len_p);
 
     /* From this point on, crash if a GC is triggered while we are using
@@ -485,22 +486,22 @@ enum Quotes {
 
 [[nodiscard]] static std::string gjs_debug_linear_string(JSLinearString* str,
                                                          Quotes quotes) {
-    size_t len = js::GetLinearStringLength(str);
+    size_t len = JS::GetLinearStringLength(str);
 
     std::ostringstream out;
     if (quotes == DoubleQuotes)
         out << '"';
 
     JS::AutoCheckCannotGC nogc;
-    if (js::LinearStringHasLatin1Chars(str)) {
-        const JS::Latin1Char *chars = js::GetLatin1LinearStringChars(nogc, str);
+    if (JS::LinearStringHasLatin1Chars(str)) {
+        const JS::Latin1Char* chars = JS::GetLatin1LinearStringChars(nogc, str);
         out << std::string(reinterpret_cast<const char*>(chars), len);
         if (quotes == DoubleQuotes)
             out << '"';
         return out.str();
     }
 
-    const char16_t *chars = js::GetTwoByteLinearStringChars(nogc, str);
+    const char16_t* chars = JS::GetTwoByteLinearStringChars(nogc, str);
     for (size_t ix = 0; ix < len; ix++) {
         char16_t c = chars[ix];
         if (c == '\n')
diff --git a/gjs/text-encoding.cpp b/gjs/text-encoding.cpp
index dbe61b41..2618d8ba 100644
--- a/gjs/text-encoding.cpp
+++ b/gjs/text-encoding.cpp
@@ -22,6 +22,7 @@
 #include <js/GCAPI.h>  // for AutoCheckCannotGC
 #include <js/PropertySpec.h>
 #include <js/RootingAPI.h>
+#include <js/String.h>
 #include <js/TypeDecls.h>
 #include <js/Utility.h>  // for UniqueChars
 #include <js/experimental/TypedData.h>
@@ -413,7 +414,7 @@ JSObject* gjs_encode_to_uint8array(JSContext* cx, JS::HandleString str,
             JS::AutoCheckCannotGC nogc;
             size_t len;
 
-            if (JS_StringHasLatin1Chars(str)) {
+            if (JS::StringHasLatin1Chars(str)) {
                 const JS::Latin1Char* chars =
                     JS_GetLatin1StringCharsAndLength(cx, nogc, str, &len);
                 if (!chars)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]