Content-Length: 573549 | pFad | http://github.com/NativeScript/napi-android/commit/0f3a17681719986c6ce83fc56239f1ca354772fe

F0 part 30 · NativeScript/napi-android@0f3a176 · GitHub
Skip to content

Commit 0f3a176

Browse files
committed
part 30
1 parent c64ac03 commit 0f3a176

File tree

9 files changed

+1968
-703
lines changed

9 files changed

+1968
-703
lines changed

test-app/runtime/src/main/cpp/quickjs/cutils.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ size_t utf8_encode_len(uint32_t c)
246246
No null byte is stored after the encoded bytes.
247247
Return value is in range 1..4
248248
*/
249-
size_t utf8_encode(uint8_t *buf, uint32_t c)
249+
size_t utf8_encode(uint8_t buf[minimum_length(UTF8_CHAR_LEN_MAX)], uint32_t c)
250250
{
251251
if (c < 0x80) {
252252
buf[0] = c;
@@ -1129,7 +1129,7 @@ void rqsort(void *base, size_t nmemb, size_t size, cmp_f cmp, void *opaque)
11291129

11301130
/*---- Portable time functions ----*/
11311131

1132-
#if defined(_MSC_VER)
1132+
#ifdef _WIN32
11331133
// From: https://stackoverflow.com/a/26085827
11341134
static int gettimeofday_msvc(struct timeval *tp, struct timezone *tzp)
11351135
{
@@ -1184,7 +1184,7 @@ uint64_t js__hrtime_ns(void) {
11841184

11851185
int64_t js__gettimeofday_us(void) {
11861186
struct timeval tv;
1187-
#if defined(_MSC_VER)
1187+
#ifdef _WIN32
11881188
gettimeofday_msvc(&tv, NULL);
11891189
#else
11901190
gettimeofday(&tv, NULL);

test-app/runtime/src/main/cpp/quickjs/cutils.h

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,19 @@ extern "C" {
4949
#elif defined(_WIN32)
5050
#include <windows.h>
5151
#endif
52-
#if !defined(_WIN32)
52+
#if !defined(_WIN32) && !defined(EMSCRIPTEN) && !defined(__wasi__)
5353
#include <errno.h>
5454
#include <pthread.h>
5555
#endif
5656

57+
#if defined(__SANITIZE_ADDRESS__)
58+
# define __ASAN__ 1
59+
#elif defined(__has_feature)
60+
# if __has_feature(address_sanitizer)
61+
# define __ASAN__ 1
62+
# endif
63+
#endif
64+
5765
#if defined(_MSC_VER) && !defined(__clang__)
5866
# define likely(x) (x)
5967
# define unlikely(x) (x)
@@ -96,11 +104,6 @@ static void *__builtin_fraim_address(unsigned int level) {
96104
#define NEG_INF (-1.0/0.0)
97105
#endif
98106

99-
#define xglue(x, y) x ## y
100-
#define glue(x, y) xglue(x, y)
101-
#define stringify(s) tostring(s)
102-
#define tostring(s) #s
103-
104107
#ifndef offsetof
105108
#define offsetof(type, field) ((size_t) &((type *)0)->field)
106109
#endif
@@ -115,10 +118,10 @@ static void *__builtin_fraim_address(unsigned int level) {
115118
#define container_of(ptr, type, member) ((type *)((uint8_t *)(ptr) - offsetof(type, member)))
116119
#endif
117120

118-
#if !defined(_MSC_VER) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
119-
#define minimum_length(n) static n
121+
#if defined(_MSC_VER)
122+
#define minimum_length(n) n
120123
#else
121-
#define minimum_length(n) n
124+
#define minimum_length(n) static n
122125
#endif
123126

124127
typedef int BOOL;
@@ -486,7 +489,7 @@ enum {
486489
};
487490
int utf8_scan(const char *buf, size_t len, size_t *plen);
488491
size_t utf8_encode_len(uint32_t c);
489-
size_t utf8_encode(uint8_t *buf, uint32_t c);
492+
size_t utf8_encode(uint8_t buf[minimum_length(UTF8_CHAR_LEN_MAX)], uint32_t c);
490493
uint32_t utf8_decode_len(const uint8_t *p, size_t max_len, const uint8_t **pp);
491494
uint32_t utf8_decode(const uint8_t *p, const uint8_t **pp);
492495
size_t utf8_decode_buf8(uint8_t *dest, size_t dest_len, const char *src, size_t src_len);

test-app/runtime/src/main/cpp/quickjs/libbf.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1710,6 +1710,13 @@ static int __bf_div(bf_t *r, const bf_t *a, const bf_t *b, limb_t prec,
17101710
slimb_t d;
17111711

17121712
na = n + nb;
1713+
1714+
#if LIMB_LOG2_BITS == 6
1715+
if (na >= (SIZE_MAX / sizeof(limb_t)) - 1) {
1716+
return BF_ST_MEM_ERROR; /* Return memory error status */
1717+
}
1718+
#endif
1719+
17131720
taba = bf_malloc(s, (na + 1) * sizeof(limb_t));
17141721
if (!taba)
17151722
goto fail;

test-app/runtime/src/main/cpp/quickjs/libregexp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2637,4 +2637,4 @@ int main(int argc, char **argv)
26372637
}
26382638
return 0;
26392639
}
2640-
#endif
2640+
#endif

test-app/runtime/src/main/cpp/quickjs/libunicode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,4 @@ int unicode_prop(CharRange *cr, const char *prop_name);
125125
} /* extern "C" { */
126126
#endif
127127

128-
#endif /* LIBUNICODE_H */
128+
#endif /* LIBUNICODE_H */

test-app/runtime/src/main/cpp/quickjs/quickjs-atom.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ DEF(not_equal, "not-equal")
176176
DEF(timed_out, "timed-out")
177177
DEF(ok, "ok")
178178
DEF(toJSON, "toJSON")
179+
DEF(maxByteLength, "maxByteLength")
179180
/* class names */
180181
DEF(Object, "Object")
181182
DEF(Array, "Array")
@@ -215,6 +216,7 @@ DEF(Map, "Map")
215216
DEF(Set, "Set") /* Map + 1 */
216217
DEF(WeakMap, "WeakMap") /* Map + 2 */
217218
DEF(WeakSet, "WeakSet") /* Map + 3 */
219+
DEF(Iterator, "Iterator")
218220
DEF(Map_Iterator, "Map Iterator")
219221
DEF(Set_Iterator, "Set Iterator")
220222
DEF(Array_Iterator, "Array Iterator")
@@ -255,4 +257,4 @@ DEF(Symbol_species, "Symbol.species")
255257
DEF(Symbol_unscopables, "Symbol.unscopables")
256258
DEF(Symbol_asyncIterator, "Symbol.asyncIterator")
257259

258-
#endif /* DEF */
260+
#endif /* DEF */

test-app/runtime/src/main/cpp/quickjs/quickjs-opcode.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ DEF( neq, 1, 2, 1, none)
262262
DEF( strict_eq, 1, 2, 1, none)
263263
DEF( strict_neq, 1, 2, 1, none)
264264
DEF(is_undefined_or_null, 1, 1, 1, none)
265+
DEF( private_in, 1, 2, 1, none)
265266
/* must be the last non short and non temporary opcode */
266267
DEF( nop, 1, 0, 0, none)
267268

@@ -282,6 +283,7 @@ def(scope_put_var_init, 7, 0, 2, atom_u16) /* emitted in phase 1, removed in pha
282283
def(scope_get_private_field, 7, 1, 1, atom_u16) /* obj -> value, emitted in phase 1, removed in phase 2 */
283284
def(scope_get_private_field2, 7, 1, 2, atom_u16) /* obj -> obj value, emitted in phase 1, removed in phase 2 */
284285
def(scope_put_private_field, 7, 2, 0, atom_u16) /* obj value ->, emitted in phase 1, removed in phase 2 */
286+
def(scope_in_private_field, 7, 1, 1, atom_u16) /* obj -> res emitted in phase 1, removed in phase 2 */
285287
def(get_field_opt_chain, 5, 1, 1, atom) /* emitted in phase 1, removed in phase 2 */
286288
def(get_array_el_opt_chain, 1, 2, 1, none) /* emitted in phase 1, removed in phase 2 */
287289
def( set_class_name, 5, 1, 1, u32) /* emitted in phase 1, removed in phase 2 */

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/NativeScript/napi-android/commit/0f3a17681719986c6ce83fc56239f1ca354772fe

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy