Merge pull request #260 from lightpanda-io/zig0.13

upgrade to zig 0.13
This commit is contained in:
Pierre Tachoire
2024-07-19 14:36:13 +02:00
committed by GitHub
8 changed files with 16 additions and 15 deletions

View File

@@ -5,7 +5,7 @@ inputs:
zig: zig:
description: 'Zig version to install' description: 'Zig version to install'
required: false required: false
default: '0.12.1' default: '0.13.0'
arch: arch:
description: 'CPU arch used to select the v8 lib' description: 'CPU arch used to select the v8 lib'
required: false required: false
@@ -17,7 +17,7 @@ inputs:
zig-v8: zig-v8:
description: 'zig v8 version to install' description: 'zig v8 version to install'
required: false required: false
default: 'v0.1.5' default: 'v0.1.6'
v8: v8:
description: 'v8 version to install' description: 'v8 version to install'
required: false required: false

View File

@@ -1,7 +1,7 @@
name: zig-fmt name: zig-fmt
env: env:
ZIG_VERSION: 0.12.1 ZIG_VERSION: 0.13.0
on: on:
pull_request: pull_request:

1
.gitignore vendored
View File

@@ -1,4 +1,5 @@
zig-cache zig-cache
/.zig-cache/
zig-out zig-out
/vendor/netsurf/build/ /vendor/netsurf/build/
/vendor/netsurf/lib/ /vendor/netsurf/lib/

View File

@@ -76,7 +76,7 @@ We do not provide yet binary versions of Lightpanda, you have to compile it from
### Prerequisites ### Prerequisites
Lightpanda is written with [Zig](https://ziglang.org/) `0.12.1`. You have to Lightpanda is written with [Zig](https://ziglang.org/) `0.13.0`. You have to
install it with the right version in order to build the project. install it with the right version in order to build the project.
Lightpanda also depends on Lightpanda also depends on

View File

@@ -278,7 +278,7 @@ pub const Connection = struct {
if (conn.read_end != conn.read_start) return; if (conn.read_end != conn.read_start) return;
var iovecs = [1]std.posix.iovec{ var iovecs = [1]std.posix.iovec{
.{ .iov_base = &conn.read_buf, .iov_len = conn.read_buf.len }, .{ .base = &conn.read_buf, .len = conn.read_buf.len },
}; };
const nread = try conn.readvDirect(&iovecs); const nread = try conn.readvDirect(&iovecs);
if (nread == 0) return error.EndOfStream; if (nread == 0) return error.EndOfStream;
@@ -314,8 +314,8 @@ pub const Connection = struct {
} }
var iovecs = [2]std.posix.iovec{ var iovecs = [2]std.posix.iovec{
.{ .iov_base = buffer.ptr, .iov_len = buffer.len }, .{ .base = buffer.ptr, .len = buffer.len },
.{ .iov_base = &conn.read_buf, .iov_len = conn.read_buf.len }, .{ .base = &conn.read_buf, .len = conn.read_buf.len },
}; };
const nread = try conn.readvDirect(&iovecs); const nread = try conn.readvDirect(&iovecs);
@@ -1560,7 +1560,7 @@ pub const RequestOptions = struct {
}; };
fn validateUri(uri: Uri, arena: Allocator) !struct { Connection.Protocol, Uri } { fn validateUri(uri: Uri, arena: Allocator) !struct { Connection.Protocol, Uri } {
const protocol_map = std.ComptimeStringMap(Connection.Protocol, .{ const protocol_map = std.StaticStringMap(Connection.Protocol).initComptime(.{
.{ "http", .plain }, .{ "http", .plain },
.{ "ws", .plain }, .{ "ws", .plain },
.{ "https", .tls }, .{ "https", .tls },

View File

@@ -107,7 +107,7 @@ pub const Stream = struct {
/// See equivalent function: `std.fs.File.writev`. /// See equivalent function: `std.fs.File.writev`.
pub fn writev(self: Stream, iovecs: []const posix.iovec_const) WriteError!usize { pub fn writev(self: Stream, iovecs: []const posix.iovec_const) WriteError!usize {
if (iovecs.len == 0) return 0; if (iovecs.len == 0) return 0;
const first_buffer = iovecs[0].iov_base[0..iovecs[0].iov_len]; const first_buffer = iovecs[0].base[0..iovecs[0].len];
return try self.write(first_buffer); return try self.write(first_buffer);
} }
@@ -121,13 +121,13 @@ pub const Stream = struct {
var i: usize = 0; var i: usize = 0;
while (true) { while (true) {
var amt = try self.writev(iovecs[i..]); var amt = try self.writev(iovecs[i..]);
while (amt >= iovecs[i].iov_len) { while (amt >= iovecs[i].len) {
amt -= iovecs[i].iov_len; amt -= iovecs[i].len;
i += 1; i += 1;
if (i >= iovecs.len) return; if (i >= iovecs.len) return;
} }
iovecs[i].iov_base += amt; iovecs[i].base += amt;
iovecs[i].iov_len -= amt; iovecs[i].len -= amt;
} }
} }
}; };

View File

@@ -288,7 +288,7 @@ fn runSafe(
argv.appendAssumeCapacity(tc); argv.appendAssumeCapacity(tc);
defer _ = argv.pop(); defer _ = argv.pop();
const run = try std.ChildProcess.run(.{ const run = try std.process.Child.run(.{
.allocator = alloc, .allocator = alloc,
.argv = argv.items, .argv = argv.items,
.max_output_bytes = 1024 * 1024, .max_output_bytes = 1024 * 1024,