]> git.kaiwu.me - njs.git/commitdiff
Fixed compilation on 32bit platforms.
authorDmitry Volyntsev <xeioex@nginx.com>
Fri, 16 Aug 2024 05:02:48 +0000 (22:02 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Fri, 16 Aug 2024 15:26:45 +0000 (08:26 -0700)
The issue was introduced in d1c615eaa.

src/qjs.h
src/qjs_buffer.c

index 00e9296aaaae8404c83609357b56db1a1c6bd1e9..f8eabefa9c0b515d1da71bdb14b7ac26ebc50e5f 100644 (file)
--- a/src/qjs.h
+++ b/src/qjs.h
@@ -11,6 +11,7 @@
 
 #include <njs_types.h>
 #include <njs_clang.h>
+#include <inttypes.h>
 #include <string.h>
 #include <njs_str.h>
 #include <njs_unicode.h>
index 83764e023ba91e51b4153dd46f3a27876fb968c7..06574110acda039529ffe0421aaf4fc0bdf03a39 100644 (file)
@@ -760,7 +760,7 @@ qjs_buffer_array_range(JSContext *ctx, njs_str_t *array, JSValueConst start,
     }
 
     if (num_start < 0 || (size_t) num_start > array->length) {
-        return JS_ThrowRangeError(ctx, "\"%sStart\" is out of range: %ld",
+        return JS_ThrowRangeError(ctx, "\"%sStart\" is out of range: %" PRId64,
                                   name, num_start);
     }
 
@@ -773,7 +773,7 @@ qjs_buffer_array_range(JSContext *ctx, njs_str_t *array, JSValueConst start,
     }
 
     if (num_end < 0 || (size_t) num_end > array->length) {
-        return JS_ThrowRangeError(ctx, "\"%sEnd\" is out of range: %ld",
+        return JS_ThrowRangeError(ctx, "\"%sEnd\" is out of range: %" PRId64,
                                   name, num_end);
     }
 
@@ -1141,8 +1141,8 @@ qjs_buffer_prototype_read_float(JSContext *ctx, JSValueConst this_val,
     size = magic >> 2;
 
     if (size + index > self.length) {
-        return JS_ThrowRangeError(ctx, "index %lu is outside the bound of the"
-                                  " buffer", index);
+        return JS_ThrowRangeError(ctx, "index %" PRIu64 " is outside the bound"
+                                  " of the buffer", index);
     }
 
     little = magic & 1;
@@ -1217,8 +1217,8 @@ qjs_buffer_prototype_read_int(JSContext *ctx, JSValueConst this_val,
     }
 
     if (size + index > self.length) {
-        return JS_ThrowRangeError(ctx, "index %lu is outside the bound of the"
-                                  " buffer", index);
+        return JS_ThrowRangeError(ctx, "index %" PRIu64 " is outside the bound"
+                                  " of the buffer", index);
     }
 
     sign = (magic >> 1) & 1;
@@ -1628,8 +1628,8 @@ qjs_buffer_prototype_write_int(JSContext *ctx, JSValueConst this_val,
     }
 
     if (size + index > self.length) {
-        return JS_ThrowRangeError(ctx, "index %lu is outside the bound of the"
-                                  " buffer", index);
+        return JS_ThrowRangeError(ctx, "index %" PRIu64 " is outside the bound"
+                                  " of the buffer", index);
     }
 
     little = magic & 1;
@@ -1834,8 +1834,8 @@ qjs_buffer_prototype_write_float(JSContext *ctx, JSValueConst this_val,
     size = magic >> 2;
 
     if (size + index > self.length) {
-        return JS_ThrowRangeError(ctx, "index %lu is outside the bound of the"
-                                  " buffer", index);
+        return JS_ThrowRangeError(ctx, "index %" PRIu64 " is outside the bound"
+                                  " of the buffer", index);
     }
 
     little = magic & 1;