mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-11 05:43:33 +00:00
1. fixed bug, where return value was set incorrectly when calling _write
2. updated behavior, so if unshift is called with zero length buffer, it is a no-op
This commit is contained in:
@@ -910,8 +910,12 @@ duk_ret_t ILibDuktape_ReadableStream_unshift(duk_context *ctx)
|
||||
else
|
||||
{
|
||||
duk_size_t bufferLen;
|
||||
rs->unshiftReserved = (char*)Duktape_GetBuffer(ctx, 0, &bufferLen);
|
||||
duk_push_int(ctx, rs->UnshiftHandler(rs, (int)bufferLen, rs->user));
|
||||
char *unshiftBuffer = (char*)Duktape_GetBuffer(ctx, 0, &bufferLen);
|
||||
if (bufferLen > 0)
|
||||
{
|
||||
rs->unshiftReserved = unshiftBuffer;
|
||||
duk_push_int(ctx, rs->UnshiftHandler(rs, (int)bufferLen, rs->user));
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user