Skip to content

Commit b370d99

Browse files
committed
fix: fix compile in windows/msys2
1 parent 8a04e04 commit b370d99

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

quickjs.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55300,18 +55300,18 @@ uint16_t* JS_ToUnicode(JSContext* ctx, JSValue value, uint32_t* length) {
5530055300
if (!string->is_wide_char) {
5530155301
uint8_t* p = string->u.str8;
5530255302
#if defined(_WIN32)
55303-
int utf16_str_len = MultiByteToWideChar(CP_ACP, 0, reinterpret_cast<const char*>(p), -1, NULL, 0) - 1;
55303+
int utf16_str_len = MultiByteToWideChar(CP_ACP, 0, (const char*)(p), -1, NULL, 0) - 1;
5530455304
if (utf16_str_len == -1) {
55305-
return nullptr;
55305+
return NULL;
5530655306
}
5530755307
// Allocate memory for the UTF-16 string, including the null terminator
5530855308
buffer = (uint16_t*)CoTaskMemAlloc((utf16_str_len + 1) * sizeof(WCHAR));
55309-
if (buffer == nullptr) {
55310-
return nullptr;
55309+
if (buffer == NULL) {
55310+
return NULL;
5531155311
}
5531255312

5531355313
// Convert the ASCII string to UTF-16
55314-
MultiByteToWideChar(CP_ACP, 0, reinterpret_cast<const char*>(p), -1, (WCHAR*)buffer, utf16_str_len + 1);
55314+
MultiByteToWideChar(CP_ACP, 0, (const char*)(p), -1, (WCHAR*)buffer, utf16_str_len + 1);
5531555315
*length = utf16_str_len;
5531655316
#else
5531755317
uint32_t len = *length = string->len;
@@ -55368,20 +55368,20 @@ JSAtom JS_NewUnicodeAtom(JSContext* ctx, const uint16_t* code, uint32_t length)
5536855368

5536955369
BOOL JS_IsArrayBufferView(JSValue value) {
5537055370
if (!JS_IsObject(value))
55371-
return false;
55371+
return FALSE;
5537255372
JSObject* p = JS_VALUE_GET_OBJ(value);
5537355373
return p->class_id >= JS_CLASS_UINT8C_ARRAY && p->class_id <= JS_CLASS_DATAVIEW;
5537455374
}
5537555375

5537655376
BOOL JS_HasClassId(JSRuntime* runtime, JSClassID classId) {
5537755377
if (runtime->class_count <= classId)
55378-
return false;
55378+
return FALSE;
5537955379
return runtime->class_array[classId].class_id == classId;
5538055380
}
5538155381

5538255382
int JS_AtomIs8Bit(JSRuntime* runtime, JSAtom atom) {
5538355383
if (__JS_AtomIsTaggedInt(atom))
55384-
return true;
55384+
return TRUE;
5538555385
JSString* string = runtime->atom_array[atom];
5538655386
return string->is_wide_char == 0;
5538755387
}
@@ -55509,21 +55509,21 @@ int JS_SetGlobalObjectOpaque(JSContext* ctx, void *opaque) {
5550955509

5551055510
JS_BOOL JS_IsProxy(JSValue value) {
5551155511
if (!JS_IsObject(value))
55512-
return false;
55512+
return FALSE;
5551355513
JSObject* p = JS_VALUE_GET_OBJ(value);
5551455514
return p->class_id == JS_CLASS_PROXY;
5551555515
}
5551655516

5551755517
JS_BOOL JS_IsPromise(JSValue value) {
5551855518
if (!JS_IsObject(value))
55519-
return false;
55519+
return FALSE;
5552055520
JSObject* p = JS_VALUE_GET_OBJ(value);
5552155521
return p->class_id == JS_CLASS_PROMISE;
5552255522
}
5552355523

5552455524
BOOL JS_IsArrayBuffer(JSValue value) {
5552555525
if (!JS_IsObject(value))
55526-
return false;
55526+
return FALSE;
5552755527
JSObject* p = JS_VALUE_GET_OBJ(value);
5552855528
return p->class_id == JS_CLASS_ARRAY_BUFFER;
5552955529
}

0 commit comments

Comments
 (0)