updated docs for dylib paths
This commit is contained in:
@@ -6889,7 +6889,15 @@ static JSValue js_cell_text (JSContext *ctx, JSValue this_val, int argc, JSValue
|
||||
if (bd->length % 8 != 0)
|
||||
return JS_RaiseDisrupt (ctx,
|
||||
"text: blob not byte-aligned for UTF-8");
|
||||
return JS_NewStringLen (ctx, (const char *)data, byte_len);
|
||||
/* Copy blob data to a temp buffer before JS_NewStringLen, because
|
||||
JS_NewStringLen allocates internally (js_alloc_string) which can
|
||||
trigger GC, moving the blob and invalidating data. */
|
||||
char *tmp = pjs_malloc (byte_len);
|
||||
if (!tmp) return JS_ThrowMemoryError (ctx);
|
||||
memcpy (tmp, data, byte_len);
|
||||
JSValue result = JS_NewStringLen (ctx, tmp, byte_len);
|
||||
pjs_free (tmp);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user