aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-01-10 19:06:53 -0800
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-01-10 19:06:53 -0800
commite07dd6194a29c2d71f66e758b824330ad479ddbf (patch)
tree9a34b76e9f47e8391c9ee9ce6b04e018fbff1636 /src
parentbcabf31121f4fff4e124bfbe11588fe9f1711e07 (diff)
downloadbun-e07dd6194a29c2d71f66e758b824330ad479ddbf.tar.gz
bun-e07dd6194a29c2d71f66e758b824330ad479ddbf.tar.zst
bun-e07dd6194a29c2d71f66e758b824330ad479ddbf.zip
make it size_t
Diffstat (limited to 'src')
-rw-r--r--src/bun.js/bindings/Buffer.h2
-rw-r--r--src/bun.js/bindings/JSBuffer.cpp18
2 files changed, 10 insertions, 10 deletions
diff --git a/src/bun.js/bindings/Buffer.h b/src/bun.js/bindings/Buffer.h
index 6269403e6..9acef1400 100644
--- a/src/bun.js/bindings/Buffer.h
+++ b/src/bun.js/bindings/Buffer.h
@@ -12,7 +12,7 @@
#include "JavaScriptCore/JSBase.h"
#include "headers-handwritten.h"
-extern "C" JSC::EncodedJSValue JSBuffer__bufferFromPointerAndLengthAndDeinit(JSC::JSGlobalObject* lexicalGlobalObject, char* ptr, unsigned int length, void* ctx, JSTypedArrayBytesDeallocator bytesDeallocator);
+extern "C" JSC::EncodedJSValue JSBuffer__bufferFromPointerAndLengthAndDeinit(JSC::JSGlobalObject* lexicalGlobalObject, char* ptr, size_t length, void* ctx, JSTypedArrayBytesDeallocator bytesDeallocator);
extern "C" JSC::EncodedJSValue Bun__encoding__toString(const uint8_t* input, size_t len, JSC::JSGlobalObject* globalObject, Encoding encoding);
extern "C" JSC::EncodedJSValue Bun__encoding__toStringUTF8(const uint8_t* input, size_t len, JSC::JSGlobalObject* globalObject);
extern "C" void Bun__Buffer_fill(ZigString*, void*, size_t, WebCore::BufferEncodingType);
diff --git a/src/bun.js/bindings/JSBuffer.cpp b/src/bun.js/bindings/JSBuffer.cpp
index 58c3dad16..4299286eb 100644
--- a/src/bun.js/bindings/JSBuffer.cpp
+++ b/src/bun.js/bindings/JSBuffer.cpp
@@ -82,7 +82,7 @@ static JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_swap64);
static JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_toString);
static JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_write);
-static JSUint8Array* allocBuffer(JSC::JSGlobalObject* lexicalGlobalObject, unsigned int byteLength)
+static JSUint8Array* allocBuffer(JSC::JSGlobalObject* lexicalGlobalObject, size_t byteLength)
{
JSC::VM& vm = JSC::getVM(lexicalGlobalObject);
auto throwScope = DECLARE_THROW_SCOPE(vm);
@@ -98,7 +98,7 @@ static JSUint8Array* allocBuffer(JSC::JSGlobalObject* lexicalGlobalObject, unsig
return uint8Array;
}
-static JSUint8Array* allocBufferUnsafe(JSC::JSGlobalObject* lexicalGlobalObject, unsigned int byteLength)
+static JSUint8Array* allocBufferUnsafe(JSC::JSGlobalObject* lexicalGlobalObject, size_t byteLength)
{
JSC::VM& vm = JSC::getVM(lexicalGlobalObject);
auto throwScope = DECLARE_THROW_SCOPE(vm);
@@ -175,7 +175,7 @@ public:
}
-JSC::EncodedJSValue JSBuffer__bufferFromPointerAndLengthAndDeinit(JSC::JSGlobalObject* lexicalGlobalObject, char* ptr, unsigned int length, void* ctx, JSTypedArrayBytesDeallocator bytesDeallocator)
+JSC::EncodedJSValue JSBuffer__bufferFromPointerAndLengthAndDeinit(JSC::JSGlobalObject* lexicalGlobalObject, char* ptr, size_t length, void* ctx, JSTypedArrayBytesDeallocator bytesDeallocator)
{
JSC::JSUint8Array* uint8Array = nullptr;
@@ -242,7 +242,7 @@ static inline JSC::EncodedJSValue jsBufferConstructorFunction_allocUnsafeBody(JS
RELEASE_AND_RETURN(throwScope, JSValue::encode(allocBufferUnsafe(lexicalGlobalObject, length)));
}
-EncodedJSValue JSBuffer__bufferFromPointerAndLength(JSC::JSGlobalObject* lexicalGlobalObject, const unsigned char* ptr, unsigned int length)
+EncodedJSValue JSBuffer__bufferFromPointerAndLength(JSC::JSGlobalObject* lexicalGlobalObject, const unsigned char* ptr, size_t length)
{
JSC::JSUint8Array* uint8Array;
@@ -921,9 +921,9 @@ static inline JSC::EncodedJSValue jsBufferPrototypeFunction_fillBody(JSC::JSGlob
{
EnsureStillAliveScope value_ = callFrame->argument(0);
- unsigned int length = castedThis->byteLength();
- unsigned int start = 0;
- unsigned int end = length;
+ size_t length = castedThis->byteLength();
+ size_t start = 0;
+ size_t end = length;
WebCore::BufferEncodingType encoding = WebCore::BufferEncodingType::utf8;
if (callFrame->argumentCount() > 1) {
if (auto start_ = callFrame->uncheckedArgument(1).tryGetAsUint32Index()) {
@@ -1159,7 +1159,7 @@ static inline JSC::EncodedJSValue jsBufferPrototypeFunction_swap32Body(JSC::JSGl
uint8_t* typedVector = castedThis->typedVector();
- constexpr size_t swaps = elemSize/2;
+ constexpr size_t swaps = elemSize / 2;
for (size_t elem = 0; elem < length; elem += elemSize) {
const size_t right = elem + elemSize - 1;
for (size_t k = 0; k < swaps; k++) {
@@ -1193,7 +1193,7 @@ static inline JSC::EncodedJSValue jsBufferPrototypeFunction_swap64Body(JSC::JSGl
uint8_t* typedVector = castedThis->typedVector();
- constexpr size_t swaps = elemSize/2;
+ constexpr size_t swaps = elemSize / 2;
for (size_t elem = 0; elem < length; elem += elemSize) {
const size_t right = elem + elemSize - 1;
for (size_t k = 0; k < swaps; k++) {