From 1becd014facbf4ebd40f9629a10f53f2a485e4e1 Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Fri, 14 Jul 2023 18:34:09 -0700 Subject: [PATCH] boop --- src/bun.js/bindings/ZigGlobalObject.cpp | 5 ++-- src/bun.js/bindings/headers.h | 40 +++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp index 923dc00100..12840aceb2 100644 --- a/src/bun.js/bindings/ZigGlobalObject.cpp +++ b/src/bun.js/bindings/ZigGlobalObject.cpp @@ -1390,7 +1390,7 @@ extern "C" JSC__JSValue Bun__createArrayBufferForCopy(JSC::JSGlobalObject* globa return JSC::JSValue::encode(JSC::JSValue {}); } - if (len > 0) + if (len > 0 && ptr) memcpy(arrayBuffer->data(), ptr, len); RELEASE_AND_RETURN(scope, JSValue::encode(JSC::JSArrayBuffer::create(globalObject->vm(), globalObject->arrayBufferStructure(JSC::ArrayBufferSharingMode::Default), WTFMove(arrayBuffer)))); @@ -1409,7 +1409,7 @@ extern "C" JSC__JSValue Bun__createUint8ArrayForCopy(JSC::JSGlobalObject* global return JSC::JSValue::encode(JSC::JSValue {}); } - if (len > 0) + if (len > 0 && ptr) memcpy(array->vector(), ptr, len); RELEASE_AND_RETURN(scope, JSValue::encode(array)); @@ -4241,7 +4241,6 @@ void GlobalObject::installAPIGlobals(JSClassRef* globals, int count, JSC::VM& vm JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly); } - { JSC::Identifier identifier = JSC::Identifier::fromString(vm, "BrotliCompressorSink"_s); object->putDirectCustomAccessor(vm, identifier, JSC::CustomGetterSetter::create(vm, functionBrotliCompressorSink__getter, nullptr), diff --git a/src/bun.js/bindings/headers.h b/src/bun.js/bindings/headers.h index 206a7e27c3..02631d749d 100644 --- a/src/bun.js/bindings/headers.h +++ b/src/bun.js/bindings/headers.h @@ -714,6 +714,46 @@ ZIG_DECL JSC__JSValue FileSink__start(JSC__JSGlobalObject* arg0, JSC__CallFrame* ZIG_DECL void FileSink__updateRef(void* arg0, bool arg1); ZIG_DECL JSC__JSValue FileSink__write(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); +#endif +CPP_DECL JSC__JSValue BrotliDecompressorSink__assignToStream(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, void* arg2, void** arg3); +CPP_DECL JSC__JSValue BrotliDecompressorSink__createObject(JSC__JSGlobalObject* arg0, void* arg1); +CPP_DECL void BrotliDecompressorSink__detachPtr(JSC__JSValue JSValue0); +CPP_DECL void* BrotliDecompressorSink__fromJS(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1); +CPP_DECL void BrotliDecompressorSink__onClose(JSC__JSValue JSValue0, JSC__JSValue JSValue1); +CPP_DECL void BrotliDecompressorSink__onReady(JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSValue JSValue2); + +#ifdef __cplusplus + +ZIG_DECL JSC__JSValue BrotliDecompressorSink__close(JSC__JSGlobalObject* arg0, void* arg1); +ZIG_DECL JSC__JSValue BrotliDecompressorSink__construct(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); +ZIG_DECL JSC__JSValue BrotliDecompressorSink__end(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); +ZIG_DECL JSC__JSValue BrotliDecompressorSink__endWithSink(void* arg0, JSC__JSGlobalObject* arg1); +ZIG_DECL void BrotliDecompressorSink__finalize(void* arg0); +ZIG_DECL JSC__JSValue BrotliDecompressorSink__flush(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); +ZIG_DECL JSC__JSValue BrotliDecompressorSink__start(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); +ZIG_DECL void BrotliDecompressorSink__updateRef(void* arg0, bool arg1); +ZIG_DECL JSC__JSValue BrotliDecompressorSink__write(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); + +#endif +CPP_DECL JSC__JSValue BrotliCompressorSink__assignToStream(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, void* arg2, void** arg3); +CPP_DECL JSC__JSValue BrotliCompressorSink__createObject(JSC__JSGlobalObject* arg0, void* arg1); +CPP_DECL void BrotliCompressorSink__detachPtr(JSC__JSValue JSValue0); +CPP_DECL void* BrotliCompressorSink__fromJS(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1); +CPP_DECL void BrotliCompressorSink__onClose(JSC__JSValue JSValue0, JSC__JSValue JSValue1); +CPP_DECL void BrotliCompressorSink__onReady(JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSValue JSValue2); + +#ifdef __cplusplus + +ZIG_DECL JSC__JSValue BrotliCompressorSink__close(JSC__JSGlobalObject* arg0, void* arg1); +ZIG_DECL JSC__JSValue BrotliCompressorSink__construct(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); +ZIG_DECL JSC__JSValue BrotliCompressorSink__end(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); +ZIG_DECL JSC__JSValue BrotliCompressorSink__endWithSink(void* arg0, JSC__JSGlobalObject* arg1); +ZIG_DECL void BrotliCompressorSink__finalize(void* arg0); +ZIG_DECL JSC__JSValue BrotliCompressorSink__flush(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); +ZIG_DECL JSC__JSValue BrotliCompressorSink__start(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); +ZIG_DECL void BrotliCompressorSink__updateRef(void* arg0, bool arg1); +ZIG_DECL JSC__JSValue BrotliCompressorSink__write(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); + #endif #ifdef __cplusplus