[njs] Improved njs_object_length() and friends prototypes.
Dmitry Volyntsev
xeioex at nginx.com
Thu Mar 26 14:12:45 UTC 2020
details: https://hg.nginx.org/njs/rev/2a03cd71561a
branches:
changeset: 1364:2a03cd71561a
user: Dmitry Volyntsev <xeioex at nginx.com>
date: Thu Mar 26 17:12:16 2020 +0300
description:
Improved njs_object_length() and friends prototypes.
While object length is always non-negative it is simpler to work with
signed value to avoid too many typecasts.
diffstat:
src/njs_array.c | 78 +++++++++++++++++++++------------------------
src/njs_function.c | 2 +-
src/njs_json.c | 4 +-
src/njs_number.c | 8 ++--
src/njs_number.h | 2 +-
src/njs_object.c | 2 +-
src/njs_object.h | 4 +-
src/njs_regexp.c | 6 +-
src/njs_string.c | 2 +-
src/njs_typed_array.c | 8 ++--
src/njs_value.c | 5 +-
src/njs_value.h | 10 ++--
src/njs_value_conversion.h | 2 +-
13 files changed, 65 insertions(+), 68 deletions(-)
diffs (596 lines):
diff -r 94d6774e0c03 -r 2a03cd71561a src/njs_array.c
--- a/src/njs_array.c Mon Mar 23 19:58:50 2020 +0300
+++ b/src/njs_array.c Thu Mar 26 17:12:16 2020 +0300
@@ -24,7 +24,7 @@ typedef struct {
typedef njs_int_t (*njs_array_iterator_handler_t)(njs_vm_t *vm,
- njs_array_iterator_args_t *args, njs_value_t *entry, uint64_t n);
+ njs_array_iterator_args_t *args, njs_value_t *entry, int64_t n);
static njs_int_t njs_array_prototype_slice_copy(njs_vm_t *vm,
@@ -183,8 +183,8 @@ njs_array_length_set(njs_vm_t *vm, njs_v
njs_object_prop_t *prev, njs_value_t *setval)
{
double num, idx;
+ int64_t prev_length;
uint32_t i, length;
- uint64_t prev_length;
njs_int_t ret;
njs_array_t *array, *keys;
@@ -576,8 +576,7 @@ static njs_int_t
njs_array_prototype_slice(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs,
njs_index_t unused)
{
- int64_t start, end, length;
- uint64_t object_length;
+ int64_t start, end, length, object_length;
njs_int_t ret;
njs_value_t *this;
@@ -823,7 +822,7 @@ static njs_int_t
njs_array_prototype_push(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs,
njs_index_t unused)
{
- uint64_t length;
+ int64_t length;
njs_int_t ret;
njs_uint_t i;
njs_array_t *array;
@@ -889,7 +888,7 @@ static njs_int_t
njs_array_prototype_pop(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs,
njs_index_t unused)
{
- uint64_t length;
+ int64_t length;
njs_int_t ret;
njs_array_t *array;
njs_value_t *this, *entry;
@@ -963,7 +962,7 @@ njs_array_prototype_unshift(njs_vm_t *vm
njs_index_t unused)
{
double idx;
- uint64_t from, to, length;
+ int64_t from, to, length;
njs_int_t ret;
njs_uint_t n;
njs_array_t *array, *keys;
@@ -1097,7 +1096,7 @@ static njs_int_t
njs_array_prototype_shift(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs,
njs_index_t unused)
{
- uint64_t i, length;
+ int64_t i, length;
njs_int_t ret;
njs_array_t *array;
njs_value_t *this, *item, entry;
@@ -1301,7 +1300,7 @@ static njs_int_t
njs_array_prototype_reverse(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs,
njs_index_t unused)
{
- uint64_t length;
+ int64_t length;
njs_int_t ret;
njs_uint_t i, n;
njs_value_t value, *this;
@@ -1382,8 +1381,7 @@ njs_array_prototype_join(njs_vm_t *vm, n
njs_index_t unused)
{
u_char *p, *last;
- int64_t size, length;
- uint64_t i, len;
+ int64_t i, size, len, length;
njs_int_t ret;
njs_chb_t chain;
njs_utf8_t utf8;
@@ -1602,7 +1600,7 @@ njs_array_indices(njs_vm_t *vm, njs_valu
njs_inline njs_int_t
njs_array_object_handler(njs_vm_t *vm, njs_array_iterator_handler_t handler,
- njs_array_iterator_args_t *args, njs_value_t *key, uint64_t i)
+ njs_array_iterator_args_t *args, njs_value_t *key, int64_t i)
{
njs_int_t ret;
njs_value_t prop, *entry;
@@ -1640,7 +1638,7 @@ njs_array_iterator(njs_vm_t *vm, njs_arr
njs_array_iterator_handler_t handler)
{
double idx;
- uint64_t length, i, from, to;
+ int64_t length, i, from, to;
njs_int_t ret;
njs_array_t *array, *keys;
njs_value_t *value, *entry, prop, character, string_obj;
@@ -1712,7 +1710,7 @@ njs_array_iterator(njs_vm_t *vm, njs_arr
p = string_prop.start;
end = p + string_prop.size;
- if (length == string_prop.size) {
+ if ((size_t) length == string_prop.size) {
/* Byte or ASCII string. */
for (i = from; i < to; i++) {
@@ -1802,7 +1800,7 @@ njs_array_reverse_iterator(njs_vm_t *vm,
njs_array_iterator_handler_t handler)
{
double idx;
- uint64_t i, from, to, length;
+ int64_t i, from, to, length;
njs_int_t ret;
njs_array_t *array, *keys;
njs_value_t *entry, *value, prop, character, string_obj;
@@ -1874,7 +1872,7 @@ njs_array_reverse_iterator(njs_vm_t *vm,
length = njs_string_prop(&string_prop, value);
end = string_prop.start + string_prop.size;
- if (length == string_prop.size) {
+ if ((size_t) length == string_prop.size) {
/* Byte or ASCII string. */
p = string_prop.start + from;
@@ -2005,8 +2003,9 @@ njs_array_prototype_concat(njs_vm_t *vm,
njs_index_t unused)
{
double idx;
- uint64_t i, k, len, length;
+ int64_t k, len, length;
njs_int_t ret;
+ njs_uint_t i;
njs_value_t this, retval, *value, *e;
njs_array_t *array, *keys;
@@ -2158,7 +2157,7 @@ njs_array_prototype_concat(njs_vm_t *vm,
static njs_int_t
njs_array_handler_index_of(njs_vm_t *vm, njs_array_iterator_args_t *args,
- njs_value_t *entry, uint64_t n)
+ njs_value_t *entry, int64_t n)
{
if (njs_values_strict_equal(args->argument, entry)) {
njs_set_number(&vm->retval, n);
@@ -2174,8 +2173,7 @@ static njs_int_t
njs_array_prototype_index_of(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs,
njs_index_t unused)
{
- int64_t from;
- uint64_t length;
+ int64_t from, length;
njs_int_t ret;
njs_array_iterator_args_t iargs;
@@ -2230,8 +2228,7 @@ static njs_int_t
njs_array_prototype_last_index_of(njs_vm_t *vm, njs_value_t *args,
njs_uint_t nargs, njs_index_t unused)
{
- int64_t from;
- uint64_t length;
+ int64_t from, length;
njs_int_t ret;
njs_array_iterator_args_t iargs;
@@ -2264,7 +2261,7 @@ njs_array_prototype_last_index_of(njs_vm
}
if (from >= 0) {
- from = njs_min((uint64_t) from, length - 1);
+ from = njs_min(from, length - 1);
} else if (from < 0) {
from += length;
@@ -2292,7 +2289,7 @@ not_found:
static njs_int_t
njs_array_handler_includes(njs_vm_t *vm, njs_array_iterator_args_t *args,
- njs_value_t *entry, uint64_t n)
+ njs_value_t *entry, int64_t n)
{
if (!njs_is_valid(entry)) {
entry = njs_value_arg(&njs_value_undefined);
@@ -2312,8 +2309,7 @@ static njs_int_t
njs_array_prototype_includes(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs,
njs_index_t unused)
{
- int64_t from;
- uint64_t length;
+ int64_t from, length;
njs_int_t ret;
njs_array_iterator_args_t iargs;
@@ -2387,7 +2383,7 @@ njs_array_prototype_fill(njs_vm_t *vm, n
length = array->length;
} else {
- ret = njs_object_length(vm, this, (uint64_t *) &length);
+ ret = njs_object_length(vm, this, &length);
if (njs_slow_path(ret == NJS_ERROR)) {
return ret;
}
@@ -2469,7 +2465,7 @@ njs_array_validate_args(njs_vm_t *vm, nj
return ret;
}
- ret = njs_value_length(vm, iargs->value, (uint64_t *) &iargs->to);
+ ret = njs_value_length(vm, iargs->value, &iargs->to);
if (njs_slow_path(ret != NJS_OK)) {
return ret;
}
@@ -2494,7 +2490,7 @@ failed:
static njs_int_t
njs_array_handler_for_each(njs_vm_t *vm, njs_array_iterator_args_t *args,
- njs_value_t *entry, uint64_t n)
+ njs_value_t *entry, int64_t n)
{
if (njs_is_valid(entry)) {
return njs_array_iterator_call(vm, args, entry, n);
@@ -2529,7 +2525,7 @@ njs_array_prototype_for_each(njs_vm_t *v
static njs_int_t
njs_array_handler_some(njs_vm_t *vm, njs_array_iterator_args_t *args,
- njs_value_t *entry, uint64_t n)
+ njs_value_t *entry, int64_t n)
{
njs_int_t ret;
@@ -2577,7 +2573,7 @@ njs_array_prototype_some(njs_vm_t *vm, n
static njs_int_t
njs_array_handler_every(njs_vm_t *vm, njs_array_iterator_args_t *args,
- njs_value_t *entry, uint64_t n)
+ njs_value_t *entry, int64_t n)
{
njs_int_t ret;
@@ -2625,7 +2621,7 @@ njs_array_prototype_every(njs_vm_t *vm,
static njs_int_t
njs_array_handler_filter(njs_vm_t *vm, njs_array_iterator_args_t *args,
- njs_value_t *entry, uint64_t n)
+ njs_value_t *entry, int64_t n)
{
njs_int_t ret;
njs_value_t copy;
@@ -2681,7 +2677,7 @@ njs_array_prototype_filter(njs_vm_t *vm,
static njs_int_t
njs_array_handler_find(njs_vm_t *vm, njs_array_iterator_args_t *args,
- njs_value_t *entry, uint64_t n)
+ njs_value_t *entry, int64_t n)
{
njs_int_t ret;
njs_value_t copy;
@@ -2735,7 +2731,7 @@ njs_array_prototype_find(njs_vm_t *vm, n
static njs_int_t
njs_array_handler_find_index(njs_vm_t *vm, njs_array_iterator_args_t *args,
- njs_value_t *entry, uint64_t n)
+ njs_value_t *entry, int64_t n)
{
njs_int_t ret;
njs_value_t copy;
@@ -2789,7 +2785,7 @@ njs_array_prototype_find_index(njs_vm_t
static njs_int_t
njs_array_handler_map(njs_vm_t *vm, njs_array_iterator_args_t *args,
- njs_value_t *entry, uint64_t n)
+ njs_value_t *entry, int64_t n)
{
njs_int_t ret;
njs_array_t *retval;
@@ -2830,7 +2826,7 @@ static njs_int_t
njs_array_prototype_map(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs,
njs_index_t unused)
{
- uint64_t length, i;
+ int64_t i, length;
njs_int_t ret;
njs_array_t *array;
njs_value_t *this;
@@ -2896,7 +2892,7 @@ unexpected_args:
njs_inline njs_int_t
njs_array_iterator_reduce(njs_vm_t *vm, njs_array_iterator_args_t *args,
- njs_value_t *entry, uint64_t n)
+ njs_value_t *entry, int64_t n)
{
njs_value_t arguments[5];
@@ -2914,7 +2910,7 @@ njs_array_iterator_reduce(njs_vm_t *vm,
static njs_int_t
njs_array_handler_reduce(njs_vm_t *vm, njs_array_iterator_args_t *args,
- njs_value_t *entry, uint64_t n)
+ njs_value_t *entry, int64_t n)
{
njs_int_t ret;
@@ -2986,7 +2982,7 @@ njs_array_prototype_reduce_right(njs_vm_
return ret;
}
- ret = njs_value_length(vm, iargs.value, (uint64_t *) &iargs.from);
+ ret = njs_value_length(vm, iargs.value, &iargs.from);
if (njs_slow_path(ret != NJS_OK)) {
return ret;
}
@@ -3080,7 +3076,7 @@ static njs_int_t
njs_array_prototype_sort(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs,
njs_index_t unused)
{
- uint64_t n, index, length, current;
+ int64_t n, index, length, current;
njs_int_t ret;
njs_array_t *array;
njs_value_t retval, value, *this, *start, arguments[3];
@@ -3205,7 +3201,7 @@ njs_array_prototype_copy_within(njs_vm_t
return ret;
}
- ret = njs_value_length(vm, this, (uint64_t *) &length);
+ ret = njs_value_length(vm, this, &length);
if (njs_slow_path(ret != NJS_OK)) {
return ret;
}
diff -r 94d6774e0c03 -r 2a03cd71561a src/njs_function.c
--- a/src/njs_function.c Mon Mar 23 19:58:50 2020 +0300
+++ b/src/njs_function.c Thu Mar 26 17:12:16 2020 +0300
@@ -1076,7 +1076,7 @@ static njs_int_t
njs_function_prototype_apply(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs,
njs_index_t unused)
{
- uint64_t i, length;
+ int64_t i, length;
njs_int_t ret;
njs_frame_t *frame;
njs_value_t *this, *arr_like;
diff -r 94d6774e0c03 -r 2a03cd71561a src/njs_json.c
--- a/src/njs_json.c Mon Mar 23 19:58:50 2020 +0300
+++ b/src/njs_json.c Thu Mar 26 17:12:16 2020 +0300
@@ -28,8 +28,8 @@ typedef struct {
NJS_JSON_ARRAY,
} type:8;
- uint64_t index;
- uint64_t length;
+ int64_t index;
+ int64_t length;
njs_array_t *keys;
njs_value_t *key;
njs_object_prop_t *prop;
diff -r 94d6774e0c03 -r 2a03cd71561a src/njs_number.c
--- a/src/njs_number.c Mon Mar 23 19:58:50 2020 +0300
+++ b/src/njs_number.c Thu Mar 26 17:12:16 2020 +0300
@@ -230,24 +230,24 @@ njs_number_to_string(njs_vm_t *vm, njs_v
njs_int_t
-njs_uint64_to_string(njs_vm_t *vm, njs_value_t *value, uint64_t u64)
+njs_int64_to_string(njs_vm_t *vm, njs_value_t *value, int64_t i64)
{
size_t size;
u_char *dst, *p;
u_char buf[128];
- if (njs_fast_path(u64 < 0x3fffffffffffULL)) {
+ if (njs_fast_path(i64 >= 0 && i64 < 0x3fffffffffffLL)) {
/* Fits to short_string. */
dst = njs_string_short_start(value);
- p = njs_sprintf(dst, dst + NJS_STRING_SHORT, "%uL", u64);
+ p = njs_sprintf(dst, dst + NJS_STRING_SHORT, "%L", i64);
njs_string_short_set(value, p - dst, p - dst);
return NJS_OK;
}
- size = njs_dtoa(u64, (char *) buf);
+ size = njs_dtoa(i64, (char *) buf);
return njs_string_new(vm, value, buf, size, size);
}
diff -r 94d6774e0c03 -r 2a03cd71561a src/njs_number.h
--- a/src/njs_number.h Mon Mar 23 19:58:50 2020 +0300
+++ b/src/njs_number.h Thu Mar 26 17:12:16 2020 +0300
@@ -8,7 +8,7 @@
#define _NJS_NUMBER_H_INCLUDED_
-#define NJS_MAX_LENGTH (0x1fffffffffffffULL)
+#define NJS_MAX_LENGTH (0x1fffffffffffffLL)
double njs_key_to_index(const njs_value_t *value);
diff -r 94d6774e0c03 -r 2a03cd71561a src/njs_object.c
--- a/src/njs_object.c Mon Mar 23 19:58:50 2020 +0300
+++ b/src/njs_object.c Thu Mar 26 17:12:16 2020 +0300
@@ -2628,7 +2628,7 @@ const njs_object_init_t njs_object_prot
njs_int_t
-njs_object_length(njs_vm_t *vm, njs_value_t *value, uint64_t *length)
+njs_object_length(njs_vm_t *vm, njs_value_t *value, int64_t *length)
{
njs_int_t ret;
njs_value_t value_length;
diff -r 94d6774e0c03 -r 2a03cd71561a src/njs_object.h
--- a/src/njs_object.h Mon Mar 23 19:58:50 2020 +0300
+++ b/src/njs_object.h Thu Mar 26 17:12:16 2020 +0300
@@ -67,7 +67,7 @@ njs_value_t *njs_property_constructor_cr
njs_value_t *constructor);
njs_int_t njs_object_prototype_to_string(njs_vm_t *vm, njs_value_t *args,
njs_uint_t nargs, njs_index_t unused);
-njs_int_t njs_object_length(njs_vm_t *vm, njs_value_t *value, uint64_t *dst);
+njs_int_t njs_object_length(njs_vm_t *vm, njs_value_t *value, int64_t *dst);
njs_int_t njs_prop_private_copy(njs_vm_t *vm, njs_property_query_t *pq);
njs_object_prop_t *njs_object_prop_alloc(njs_vm_t *vm, const njs_value_t *name,
@@ -226,7 +226,7 @@ njs_key_string_get(njs_vm_t *vm, njs_val
njs_inline njs_int_t
-njs_object_length_set(njs_vm_t *vm, njs_value_t *value, uint64_t length)
+njs_object_length_set(njs_vm_t *vm, njs_value_t *value, int64_t length)
{
njs_value_t index;
diff -r 94d6774e0c03 -r 2a03cd71561a src/njs_regexp.c
--- a/src/njs_regexp.c Mon Mar 23 19:58:50 2020 +0300
+++ b/src/njs_regexp.c Thu Mar 26 17:12:16 2020 +0300
@@ -871,7 +871,7 @@ njs_regexp_prototype_test(njs_vm_t *vm,
njs_index_t unused)
{
int *captures;
- uint64_t last_index;
+ int64_t last_index;
njs_int_t ret, match;
njs_uint_t n;
njs_regex_t *regex;
@@ -963,7 +963,7 @@ njs_int_t
njs_regexp_prototype_exec(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs,
njs_index_t unused)
{
- uint64_t last_index;
+ int64_t last_index;
njs_int_t ret;
njs_utf8_t utf8;
njs_value_t *value, lvalue;
@@ -1002,7 +1002,7 @@ njs_regexp_prototype_exec(njs_vm_t *vm,
(void) njs_string_prop(&string, value);
- if (string.size >= last_index) {
+ if (string.size >= (size_t) last_index) {
utf8 = NJS_STRING_BYTE;
type = NJS_REGEXP_BYTE;
diff -r 94d6774e0c03 -r 2a03cd71561a src/njs_string.c
--- a/src/njs_string.c Mon Mar 23 19:58:50 2020 +0300
+++ b/src/njs_string.c Thu Mar 26 17:12:16 2020 +0300
@@ -1608,8 +1608,8 @@ static njs_int_t
njs_string_bytes_from_array_like(njs_vm_t *vm, njs_value_t *value)
{
u_char *p;
+ int64_t length;
uint32_t u32;
- uint64_t length;
njs_int_t ret;
njs_array_t *array;
njs_value_t *octet, index, prop;
diff -r 94d6774e0c03 -r 2a03cd71561a src/njs_typed_array.c
--- a/src/njs_typed_array.c Mon Mar 23 19:58:50 2020 +0300
+++ b/src/njs_typed_array.c Thu Mar 26 17:12:16 2020 +0300
@@ -13,8 +13,9 @@ njs_typed_array_constructor(njs_vm_t *vm
njs_index_t magic)
{
double num;
+ int64_t i, length;
uint32_t element_size;
- uint64_t i, length, size, offset;
+ uint64_t size, offset;
njs_int_t ret;
njs_value_t *value, prop;
njs_array_t *src_array;
@@ -360,8 +361,7 @@ njs_typed_array_prototype_set(njs_vm_t *
njs_uint_t nargs, njs_index_t unused)
{
double num;
- uint32_t i;
- int64_t length, src_length, offset;
+ int64_t i, length, src_length, offset;
njs_int_t ret;
njs_value_t *this, *src, *value, prop;
njs_array_t *array;
@@ -436,7 +436,7 @@ njs_typed_array_prototype_set(njs_vm_t *
return ret;
}
- ret = njs_object_length(vm, src, (uint64_t *) &src_length);
+ ret = njs_object_length(vm, src, &src_length);
if (njs_slow_path(ret == NJS_ERROR)) {
return ret;
}
diff -r 94d6774e0c03 -r 2a03cd71561a src/njs_value.c
--- a/src/njs_value.c Mon Mar 23 19:58:50 2020 +0300
+++ b/src/njs_value.c Thu Mar 26 17:12:16 2020 +0300
@@ -261,7 +261,7 @@ njs_value_own_enumerate(njs_vm_t *vm, nj
njs_int_t
-njs_value_length(njs_vm_t *vm, njs_value_t *value, uint64_t *length)
+njs_value_length(njs_vm_t *vm, njs_value_t *value, int64_t *length)
{
njs_string_prop_t string_prop;
@@ -697,7 +697,8 @@ static njs_int_t
njs_array_property_query(njs_vm_t *vm, njs_property_query_t *pq,
njs_array_t *array, uint32_t index)
{
- uint64_t size, length;
+ int64_t length;
+ uint64_t size;
njs_int_t ret;
njs_value_t *setval, value;
njs_object_prop_t *prop;
diff -r 94d6774e0c03 -r 2a03cd71561a src/njs_value.h
--- a/src/njs_value.h Mon Mar 23 19:58:50 2020 +0300
+++ b/src/njs_value.h Thu Mar 26 17:12:16 2020 +0300
@@ -1002,7 +1002,7 @@ njs_array_t *njs_value_enumerate(njs_vm_
njs_object_enum_t kind, njs_object_enum_type_t type, njs_bool_t all);
njs_array_t *njs_value_own_enumerate(njs_vm_t *vm, njs_value_t *value,
njs_object_enum_t kind, njs_object_enum_type_t type, njs_bool_t all);
-njs_int_t njs_value_length(njs_vm_t *vm, njs_value_t *value, uint64_t *dst);
+njs_int_t njs_value_length(njs_vm_t *vm, njs_value_t *value, int64_t *dst);
const char *njs_type_string(njs_value_type_t type);
njs_int_t njs_primitive_value_to_string(njs_vm_t *vm, njs_value_t *dst,
@@ -1010,7 +1010,7 @@ njs_int_t njs_primitive_value_to_string(
njs_int_t njs_primitive_value_to_chain(njs_vm_t *vm, njs_chb_t *chain,
const njs_value_t *src);
double njs_string_to_number(const njs_value_t *value, njs_bool_t parse_float);
-njs_int_t njs_uint64_to_string(njs_vm_t *vm, njs_value_t *value, uint64_t u64);
+njs_int_t njs_int64_to_string(njs_vm_t *vm, njs_value_t *value, int64_t i64);
njs_bool_t njs_string_eq(const njs_value_t *v1, const njs_value_t *v2);
@@ -1041,7 +1041,7 @@ njs_value_property_i64(njs_vm_t *vm, njs
/* FIXME: False-positive in MSAN?. */
njs_msan_unpoison(&key, sizeof(njs_value_t));
- ret = njs_uint64_to_string(vm, &key, index);
+ ret = njs_int64_to_string(vm, &key, index);
if (njs_slow_path(ret != NJS_OK)) {
return ret;
}
@@ -1060,7 +1060,7 @@ njs_value_property_i64_set(njs_vm_t *vm,
/* FIXME: False-positive in MSAN?. */
njs_msan_unpoison(&key, sizeof(njs_value_t));
- ret = njs_uint64_to_string(vm, &key, index);
+ ret = njs_int64_to_string(vm, &key, index);
if (njs_slow_path(ret != NJS_OK)) {
return ret;
}
@@ -1079,7 +1079,7 @@ njs_value_property_i64_delete(njs_vm_t *
/* FIXME: False-positive in MSAN?. */
njs_msan_unpoison(&key, sizeof(njs_value_t));
- ret = njs_uint64_to_string(vm, &key, index);
+ ret = njs_int64_to_string(vm, &key, index);
if (njs_slow_path(ret != NJS_OK)) {
return ret;
}
diff -r 94d6774e0c03 -r 2a03cd71561a src/njs_value_conversion.h
--- a/src/njs_value_conversion.h Mon Mar 23 19:58:50 2020 +0300
+++ b/src/njs_value_conversion.h Thu Mar 26 17:12:16 2020 +0300
@@ -80,7 +80,7 @@ njs_value_to_integer(njs_vm_t *vm, njs_v
njs_inline njs_int_t
-njs_value_to_length(njs_vm_t *vm, njs_value_t *value, uint64_t *dst)
+njs_value_to_length(njs_vm_t *vm, njs_value_t *value, int64_t *dst)
{
double num;
njs_int_t ret;
More information about the nginx-devel
mailing list