mirror of
https://github.com/bellard/quickjs.git
synced 2025-09-27 05:38:45 +03:00
Compare commits
2 Commits
45612cbd05
...
c34c932a2b
Author | SHA1 | Date | |
---|---|---|---|
|
c34c932a2b | ||
|
83fa050312 |
@ -52893,7 +52893,8 @@ static JSArrayBuffer *js_get_array_buffer(JSContext *ctx, JSValueConst obj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* return NULL if exception. WARNING: any JS call can detach the
|
/* return NULL if exception. WARNING: any JS call can detach the
|
||||||
buffer and render the returned pointer invalid */
|
buffer and render the returned pointer invalid. psize can be
|
||||||
|
NULL. */
|
||||||
uint8_t *JS_GetArrayBuffer(JSContext *ctx, size_t *psize, JSValueConst obj)
|
uint8_t *JS_GetArrayBuffer(JSContext *ctx, size_t *psize, JSValueConst obj)
|
||||||
{
|
{
|
||||||
JSArrayBuffer *abuf = js_get_array_buffer(ctx, obj);
|
JSArrayBuffer *abuf = js_get_array_buffer(ctx, obj);
|
||||||
@ -52903,10 +52904,14 @@ uint8_t *JS_GetArrayBuffer(JSContext *ctx, size_t *psize, JSValueConst obj)
|
|||||||
JS_ThrowTypeErrorDetachedArrayBuffer(ctx);
|
JS_ThrowTypeErrorDetachedArrayBuffer(ctx);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
if (psize) {
|
||||||
*psize = abuf->byte_length;
|
*psize = abuf->byte_length;
|
||||||
|
}
|
||||||
return abuf->data;
|
return abuf->data;
|
||||||
fail:
|
fail:
|
||||||
|
if (psize) {
|
||||||
*psize = 0;
|
*psize = 0;
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user