mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
std-docs: read/write messages as little endian
This commit is contained in:
parent
8817fc8958
commit
04853f4052
1 changed files with 7 additions and 4 deletions
|
|
@ -348,12 +348,12 @@ fn buildWasmBinary(
|
||||||
result_error_bundle = try std.zig.Server.allocErrorBundle(arena, body);
|
result_error_bundle = try std.zig.Server.allocErrorBundle(arena, body);
|
||||||
},
|
},
|
||||||
.emit_digest => {
|
.emit_digest => {
|
||||||
const EmitDigest = std.zig.Server.Message.EmitDigest;
|
var r: std.Io.Reader = .fixed(body);
|
||||||
const emit_digest = @as(*align(1) const EmitDigest, @ptrCast(body));
|
const emit_digest = r.takeStruct(std.zig.Server.Message.EmitDigest, .little) catch unreachable;
|
||||||
if (!emit_digest.flags.cache_hit) {
|
if (!emit_digest.flags.cache_hit) {
|
||||||
std.log.info("source changes detected; rebuilt wasm component", .{});
|
std.log.info("source changes detected; rebuilt wasm component", .{});
|
||||||
}
|
}
|
||||||
const digest = body[@sizeOf(EmitDigest)..][0..Cache.bin_digest_len];
|
const digest = r.takeArray(Cache.bin_digest_len) catch unreachable;
|
||||||
result = .{
|
result = .{
|
||||||
.root_dir = Cache.Directory.cwd(),
|
.root_dir = Cache.Directory.cwd(),
|
||||||
.sub_path = try std.fs.path.join(arena, &.{
|
.sub_path = try std.fs.path.join(arena, &.{
|
||||||
|
|
@ -415,7 +415,10 @@ fn sendMessage(file: std.fs.File, tag: std.zig.Client.Message.Tag) !void {
|
||||||
.tag = tag,
|
.tag = tag,
|
||||||
.bytes_len = 0,
|
.bytes_len = 0,
|
||||||
};
|
};
|
||||||
try file.writeAll(std.mem.asBytes(&header));
|
var w = file.writer(&.{});
|
||||||
|
w.interface.writeStruct(header, .little) catch |err| switch (err) {
|
||||||
|
error.WriteFailed => return w.err.?,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
fn openBrowserTab(gpa: Allocator, url: []const u8) !void {
|
fn openBrowserTab(gpa: Allocator, url: []const u8) !void {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue