Skip to content
Closed
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ xcheck_add_c_compiler_flag(-Wno-unused-parameter)
xcheck_add_c_compiler_flag(-Wno-unused-but-set-variable)
xcheck_add_c_compiler_flag(-Wno-array-bounds)
xcheck_add_c_compiler_flag(-Wno-format-truncation)
xcheck_add_c_compiler_flag(-Wno-format-zero-length)
xcheck_add_c_compiler_flag(-funsigned-char)

# ClangCL is command line compatible with MSVC, so 'MSVC' is set.
Expand Down
2 changes: 1 addition & 1 deletion cutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extern "C" {
#elif defined(_WIN32)
#include <windows.h>
#endif
#if !defined(_WIN32)
#if !defined(_WIN32) && !defined(EMSCRIPTEN) && !defined(__wasi__)
#include <errno.h>
#include <pthread.h>
#endif
Expand Down
7 changes: 7 additions & 0 deletions libbf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1710,6 +1710,13 @@ static int __bf_div(bf_t *r, const bf_t *a, const bf_t *b, limb_t prec,
slimb_t d;

na = n + nb;

#if LIMB_LOG2_BITS == 6
if (na >= (SIZE_MAX / sizeof(limb_t)) - 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fails on Windows, since IIRC the limb bits are fewer there.

D:/a/quickjs/quickjs/libbf.c:1714:16: error: comparison is always false due to limited range of data type [-Werror=type-limits]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, that's rough, will try to play with it more

return BF_ST_MEM_ERROR; /* Return memory error status */
}
#endif

taba = bf_malloc(s, (na + 1) * sizeof(limb_t));
if (!taba)
goto fail;
Expand Down
14 changes: 8 additions & 6 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
#define NO_TM_GMTOFF
#endif

#if !defined(EMSCRIPTEN) && !defined(__wasi__)
#if !defined(EMSCRIPTEN) && !defined(__wasi__) && !defined(__STDC_NO_ATOMICS__)
#include "quickjs-c-atomics.h"
#define CONFIG_ATOMICS
#endif
Expand Down Expand Up @@ -6646,7 +6646,7 @@ static void build_backtrace(JSContext *ctx, JSValue error_obj,
}
done:
if (has_prepare) {
int j = 0;
int j = 0, k;
stack = JS_NewArray(ctx);
if (JS_IsException(stack)) {
stack = JS_NULL;
Expand All @@ -6662,7 +6662,7 @@ static void build_backtrace(JSContext *ctx, JSValue error_obj,
}
}
// Clear the csd's we didn't use in case of error.
for (int k = j; k < i; k++) {
for (k = j; k < i; k++) {
JS_FreeValue(ctx, csd[k].filename);
JS_FreeValue(ctx, csd[k].func);
JS_FreeValue(ctx, csd[k].func_name);
Expand Down Expand Up @@ -34604,7 +34604,7 @@ static JSString *JS_ReadString(BCReaderState *s)
}
#ifdef DUMP_READ_OBJECT
if (check_dump_flag(s->ctx->rt, DUMP_READ_OBJECT)) {
bc_read_trace(s, ""); // hex dump and indentation
bc_read_trace(s, "%s", ""); // hex dump and indentation
JS_DumpString(s->ctx->rt, p);
printf("\n");
}
Expand Down Expand Up @@ -34664,7 +34664,7 @@ static int JS_ReadFunctionBytecode(BCReaderState *s, JSFunctionBytecode *b,
const uint8_t *save_ptr = s->ptr;
s->ptr = s->ptr_last + len;
s->level -= 4;
bc_read_trace(s, ""); // hex dump + indent
bc_read_trace(s, "%s", ""); // hex dump + indent
dump_single_byte_code(s->ctx, bc_buf + pos, b,
s->ptr - s->buf_start - len);
s->level += 4;
Expand Down Expand Up @@ -49776,7 +49776,9 @@ static struct {
};

static BOOL string_get_tzabbr(const uint8_t *sp, int *pp, int *offset) {
for (size_t i = 0; i < countof(js_tzabbr); i++) {
size_t i;

for (i = 0; i < countof(js_tzabbr); i++) {
if (string_match(sp, pp, js_tzabbr[i].name)) {
*offset = js_tzabbr[i].offset;
return TRUE;
Expand Down
Loading