mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-10-09 12:51:45 -04:00
v8: update for changes to v8__String__WriteUtf8
https://github.com/lightpanda-io/zig-v8-fork/pull/211
This commit is contained in:
8 files changed
+13
-12
No files matched your search
@@ -668,7 +668,7 @@ fn illegalConstructorCallback(raw_info: ?*const v8.FunctionCallbackInfo) callcon
|
||||
if (v8.v8__Function__GetName(func)) |name_value| {
|
||||
if (v8.v8__Value__IsString(name_value)) {
|
||||
const str: *const v8.String = @ptrCast(name_value);
|
||||
const n = v8.v8__String__WriteUtf8(str, isolate, &name_buf, name_buf.len, v8.NO_NULL_TERMINATION | v8.REPLACE_INVALID_UTF8);
|
||||
const n = v8.v8__String__WriteUtf8(str, isolate, &name_buf, name_buf.len, v8.WRITE_REPLACE_INVALID_UTF8, null);
|
||||
name = name_buf[0..@intCast(n)];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ fn _toSlice(self: String, comptime null_terminate: bool, allocator: Allocator) !
|
||||
|
||||
const l = v8.v8__String__Utf8Length(handle, isolate);
|
||||
const buf = try (if (comptime null_terminate) allocator.allocSentinel(u8, @intCast(l), 0) else allocator.alloc(u8, @intCast(l)));
|
||||
const n = v8.v8__String__WriteUtf8(handle, isolate, buf.ptr, buf.len, v8.NO_NULL_TERMINATION | v8.REPLACE_INVALID_UTF8);
|
||||
const n = v8.v8__String__WriteUtf8(handle, isolate, buf.ptr, buf.len, v8.WRITE_REPLACE_INVALID_UTF8, null);
|
||||
if (comptime lp.IS_DEBUG) {
|
||||
std.debug.assert(n == l);
|
||||
}
|
||||
@@ -87,7 +87,7 @@ pub fn toSSOWithAlloc(self: String, allocator: Allocator) !lp.String {
|
||||
|
||||
if (l <= 12) {
|
||||
var content: [12]u8 = undefined;
|
||||
const n = v8.v8__String__WriteUtf8(handle, isolate, &content[0], content.len, v8.NO_NULL_TERMINATION | v8.REPLACE_INVALID_UTF8);
|
||||
const n = v8.v8__String__WriteUtf8(handle, isolate, &content[0], content.len, v8.WRITE_REPLACE_INVALID_UTF8, null);
|
||||
if (comptime lp.IS_DEBUG) {
|
||||
std.debug.assert(n == l);
|
||||
}
|
||||
@@ -103,7 +103,7 @@ pub fn toSSOWithAlloc(self: String, allocator: Allocator) !lp.String {
|
||||
}
|
||||
|
||||
const buf = try allocator.alloc(u8, l);
|
||||
const n = v8.v8__String__WriteUtf8(handle, isolate, buf.ptr, buf.len, v8.NO_NULL_TERMINATION | v8.REPLACE_INVALID_UTF8);
|
||||
const n = v8.v8__String__WriteUtf8(handle, isolate, buf.ptr, buf.len, v8.WRITE_REPLACE_INVALID_UTF8, null);
|
||||
if (comptime lp.IS_DEBUG) {
|
||||
std.debug.assert(n == l);
|
||||
}
|
||||
@@ -124,7 +124,7 @@ pub fn format(self: String, writer: *std.Io.Writer) !void {
|
||||
const l = v8.v8__String__Utf8Length(handle, isolate);
|
||||
var buf = if (l < 1024) &small else local.call_arena.alloc(u8, @intCast(l)) catch return error.WriteFailed;
|
||||
|
||||
const n = v8.v8__String__WriteUtf8(handle, isolate, buf.ptr, buf.len, v8.NO_NULL_TERMINATION | v8.REPLACE_INVALID_UTF8);
|
||||
const n = v8.v8__String__WriteUtf8(handle, isolate, buf.ptr, buf.len, v8.WRITE_REPLACE_INVALID_UTF8, null);
|
||||
return writer.writeAll(buf[0..n]);
|
||||
}
|
||||
|
||||
|
||||
@@ -598,7 +598,7 @@ pub fn writeStackTrace(isolate: *v8.Isolate, stack_handle: *const v8.StackTrace,
|
||||
const frame_handle = v8.v8__StackTrace__GetFrame(stack_handle, isolate, @intCast(i)).?;
|
||||
if (v8.v8__StackFrame__GetFunctionName(frame_handle)) |name| {
|
||||
var buf: [1024]u8 = undefined;
|
||||
const n = v8.v8__String__WriteUtf8(name, isolate, &buf, buf.len, v8.NO_NULL_TERMINATION | v8.REPLACE_INVALID_UTF8);
|
||||
const n = v8.v8__String__WriteUtf8(name, isolate, &buf, buf.len, v8.WRITE_REPLACE_INVALID_UTF8, null);
|
||||
try writer.print("{s}{s}:{d}", .{ separator, buf[0..n], v8.v8__StackFrame__GetLineNumber(frame_handle) });
|
||||
} else {
|
||||
try writer.print("{s}<anonymous>:{d}", .{ separator, v8.v8__StackFrame__GetLineNumber(frame_handle) });
|
||||
|
||||
@@ -975,7 +975,8 @@ fn stringToOwned(
|
||||
self.env.isolate.handle,
|
||||
buf.ptr,
|
||||
buf.len,
|
||||
v8.NO_NULL_TERMINATION | v8.REPLACE_INVALID_UTF8,
|
||||
v8.WRITE_REPLACE_INVALID_UTF8,
|
||||
null,
|
||||
);
|
||||
return buf[0..written];
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user