Skip to content

Commit 37fa41b

Browse files
committed
fix buffer ranges
1 parent 298f959 commit 37fa41b

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

build.zig.zon

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
.fingerprint = 0xda130f3af836cea0,
66
.dependencies = .{
77
.v8 = .{
8-
.url = "https://github.com/lightpanda-io/zig-v8-fork/archive/c25223900587005c9cf13f25e56a7e0be26a533c.tar.gz",
9-
.hash = "v8-0.0.0-xddH6x_DAwBh0gSbFFv1fyiExhExXKzZpbmj5sFH4MRY",
8+
.url = "https://github.com/lightpanda-io/zig-v8-fork/archive/b51ed00390101b1fb9dd1ba4650c13f6586d0e24.tar.gz",
9+
.hash = "v8-0.0.0-xddH68vFAwCYTTv4JjcgP7OcXSW7bv3sCKtaJ2SWXjR8",
1010
},
11-
// .v8 = .{ .path = "../zig-v8-fork" }
11+
//.v8 = .{ .path = "../zig-v8-fork" }
1212
},
1313
}

src/browser/encoding/TextDecoder.zig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
const std = @import("std");
2020
const log = @import("../../log.zig");
2121

22+
const Env = @import("../env.zig").Env;
2223
const Page = @import("../page.zig").Page;
2324

2425
// https://encoding.spec.whatwg.org/#interface-textdecoder
@@ -69,8 +70,8 @@ pub fn get_fatal(self: *const TextDecoder) bool {
6970
const DecodeOptions = struct {
7071
stream: bool = false,
7172
};
72-
pub fn _decode(self: *TextDecoder, input_: ?[]const u8, opts_: ?DecodeOptions, page: *Page) ![]const u8 {
73-
var str = input_ orelse return "";
73+
pub fn _decode(self: *TextDecoder, str_: ?[]const u8, opts_: ?DecodeOptions, page: *Page) ![]const u8 {
74+
var str = str_ orelse return "";
7475
const opts: DecodeOptions = opts_ orelse .{};
7576

7677
if (self.stream.items.len > 0) {

src/tests/encoding/decoder.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,14 @@
4747
</script>
4848

4949
<script id=slice>
50-
const buffer = new ArrayBuffer(4);
51-
const arr1 = new Uint8Array(buffer)
50+
const buf1 = new ArrayBuffer(7);
51+
const arr1 = new Uint8Array(buf1)
5252
arr1[0] = 80;
5353
arr1[1] = 81;
5454
arr1[2] = 82;
5555
arr1[3] = 83;
56-
testing.expectEqual('QR', d3.decode(new Uint8Array(buffer, 1, 2)));
56+
arr1[4] = 84;
57+
arr1[5] = 85;
58+
arr1[6] = 86;
59+
testing.expectEqual('RST', d3.decode(new Uint8Array(buf1, 2, 3)));
5760
</script>

0 commit comments

Comments
 (0)