[gjs/mozjs91: 48/64] Typed arrays use size_t instead of uint32_t in mozjs91




commit 2382d3ff5f0b69a4cab381c676e39449837f1cf8
Author: Evan Welsh <contact evanwelsh com>
Date:   Sat Jul 10 20:23:55 2021 -0700

    Typed arrays use size_t instead of uint32_t in mozjs91

 gjs/byteArray.cpp     | 2 +-
 gjs/text-encoding.cpp | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/gjs/byteArray.cpp b/gjs/byteArray.cpp
index 7bb713dc..05c25034 100644
--- a/gjs/byteArray.cpp
+++ b/gjs/byteArray.cpp
@@ -295,7 +295,7 @@ JSObject* gjs_byte_array_from_byte_array(JSContext* cx, GByteArray* array) {
 
 GBytes* gjs_byte_array_get_bytes(JSObject* obj) {
     bool is_shared_memory;
-    uint32_t len;
+    size_t len;
     uint8_t* data;
 
     js::GetUint8ArrayLengthAndData(obj, &len, &is_shared_memory, &data);
diff --git a/gjs/text-encoding.cpp b/gjs/text-encoding.cpp
index a3559fc8..17db89a2 100644
--- a/gjs/text-encoding.cpp
+++ b/gjs/text-encoding.cpp
@@ -24,6 +24,7 @@
 #include <js/RootingAPI.h>
 #include <js/TypeDecls.h>
 #include <js/Utility.h>   // for UniqueChars
+#include <js/experimental/TypedData.h>
 #include <jsapi.h>        // for JS_DefineFunctionById, JS_DefineFun...
 #include <jsfriendapi.h>  // for JS_NewUint8ArrayWithBuffer, GetUint...
 
@@ -63,7 +64,7 @@ static const char* UTF16_CODESET = "UTF-16BE";
 }
 
 GJS_JSAPI_RETURN_CONVENTION
-static bool to_string_impl_slow(JSContext* cx, uint8_t* data, uint32_t len,
+static bool to_string_impl_slow(JSContext* cx, uint8_t* data, size_t len,
                                 const char* encoding,
                                 JS::MutableHandleValue rval) {
     size_t bytes_written;
@@ -103,7 +104,7 @@ bool bytearray_to_string(JSContext* context, JS::HandleObject byte_array,
         encoding_is_utf8 = is_utf8_label(encoding);
 
     uint8_t* data;
-    uint32_t len;
+    size_t len;
     bool is_shared_memory;
     js::GetUint8ArrayLengthAndData(byte_array, &len, &is_shared_memory, &data);
 
@@ -130,7 +131,7 @@ bool bytearray_to_string(JSContext* context, JS::HandleObject byte_array,
     }
 
     uint8_t* current_data;
-    uint32_t current_len;
+    size_t current_len;
     bool ignore_val;
 
     // If a garbage collection occurs between when we call


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