authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2026-06-24 17:19:47-07:00
committergravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2026-06-25 15:13:00+02:00
log64c5cc80471ccd167af2403741dc2037824e0c8c
tree16d3dc0cd12af97dfdcacdbadc8e6ebf51db445e
parentfe671e7ba9138250e3435e40ac36460d89c0f67b

resinator: Sync with upstream

Fixes a bug where certain non-ASCII filenames would lead to errors

3 files changed, 8 insertions(+), 4 deletions(-)

lib/compiler/resinator/cli.zig+1-1
...@@ -15,7 +15,7 @@ pub const usage_string_after_command_name =...@@ -15,7 +15,7 @@ pub const usage_string_after_command_name =
15 \\ [options] [--] <INPUT> [<OUTPUT>]15 \\ [options] [--] <INPUT> [<OUTPUT>]
16 \\16 \\
17 \\The sequence -- can be used to signify when to stop parsing options.17 \\The sequence -- can be used to signify when to stop parsing options.
18 \\This is necessary when the input path begins with a forward slash.18 \\This avoids ambiguity when the input path begins with a forward slash.
19 \\19 \\
20 \\Supported option prefixes are /, -, and --, so e.g. /h, -h, and --h all work.20 \\Supported option prefixes are /, -, and --, so e.g. /h, -h, and --h all work.
21 \\Drop-in compatible with the Microsoft Resource Compiler.21 \\Drop-in compatible with the Microsoft Resource Compiler.
lib/compiler/resinator/compile.zig+2-2
...@@ -2746,7 +2746,7 @@ pub const Compiler = struct {...@@ -2746,7 +2746,7 @@ pub const Compiler = struct {
2746 // 1. Any permutation that does not have PRELOAD in it just uses the2746 // 1. Any permutation that does not have PRELOAD in it just uses the
2747 // default flags.2747 // default flags.
2748 const initial_flags = flags.*;2748 const initial_flags = flags.*;
2749 var flags_set = std.enums.EnumSet(rc.CommonResourceAttributes).empty;2749 var flags_set: std.enums.EnumSet(rc.CommonResourceAttributes) = .empty;
2750 for (tokens) |token| {2750 for (tokens) |token| {
2751 const attribute = rc.CommonResourceAttributes.map.get(token.slice(source)).?;2751 const attribute = rc.CommonResourceAttributes.map.get(token.slice(source)).?;
2752 flags_set.insert(attribute);2752 flags_set.insert(attribute);
...@@ -2769,7 +2769,7 @@ pub const Compiler = struct {...@@ -2769,7 +2769,7 @@ pub const Compiler = struct {
2769 // 3. If none of DISCARDABLE, SHARED, or PURE is specified, then PRELOAD2769 // 3. If none of DISCARDABLE, SHARED, or PURE is specified, then PRELOAD
2770 // implies `flags &= ~SHARED` and LOADONCALL implies `flags |= SHARED`2770 // implies `flags &= ~SHARED` and LOADONCALL implies `flags |= SHARED`
2771 const shared_set = comptime blk: {2771 const shared_set = comptime blk: {
2772 var set = std.enums.EnumSet(rc.CommonResourceAttributes).empty;2772 var set: std.enums.EnumSet(rc.CommonResourceAttributes) = .empty;
2773 set.insert(.discardable);2773 set.insert(.discardable);
2774 set.insert(.shared);2774 set.insert(.shared);
2775 set.insert(.pure);2775 set.insert(.pure);
lib/compiler/resinator/source_mapping.zig+5-1
...@@ -636,6 +636,10 @@ fn parseFilename(allocator: Allocator, str: []const u8) error{ OutOfMemory, Inva...@@ -636,6 +636,10 @@ fn parseFilename(allocator: Allocator, str: []const u8) error{ OutOfMemory, Inva
636 if (escape_val != 0) escape_val = std.math.mul(u8, @as(u8, @intCast(escape_val)), 16) catch return error.InvalidString;636 if (escape_val != 0) escape_val = std.math.mul(u8, @as(u8, @intCast(escape_val)), 16) catch return error.InvalidString;
637 escape_val = std.math.add(u8, @as(u8, @intCast(escape_val)), digit) catch return error.InvalidString;637 escape_val = std.math.add(u8, @as(u8, @intCast(escape_val)), digit) catch return error.InvalidString;
638 escape_len += 1;638 escape_len += 1;
639 if (escape_len == 2) {
640 filename.appendAssumeCapacity(@intCast(escape_val));
641 state = .string;
642 }
639 },643 },
640 else => {644 else => {
641 if (escape_len == 0) return error.InvalidString;645 if (escape_len == 0) return error.InvalidString;
...@@ -706,6 +710,7 @@ fn testParseFilename(expected: []const u8, input: []const u8) !void {...@@ -706,6 +710,7 @@ fn testParseFilename(expected: []const u8, input: []const u8) !void {
706test parseFilename {710test parseFilename {
707 try testParseFilename("'\"?\\\t\n\r\x11", "\\'\\\"\\?\\\\\\t\\n\\r\\x11");711 try testParseFilename("'\"?\\\t\n\r\x11", "\\'\\\"\\?\\\\\\t\\n\\r\\x11");
708 try testParseFilename("\xABz\x53", "\\xABz\\123");712 try testParseFilename("\xABz\x53", "\\xABz\\123");
713 try testParseFilename("\xABCDEF", "\\xABCDEF");
709 try testParseFilename("⚡⚡", "\\u26A1\\U000026A1");714 try testParseFilename("⚡⚡", "\\u26A1\\U000026A1");
710 try std.testing.expectError(error.InvalidString, parseFilename(std.testing.allocator, "\""));715 try std.testing.expectError(error.InvalidString, parseFilename(std.testing.allocator, "\""));
711 try std.testing.expectError(error.InvalidString, parseFilename(std.testing.allocator, "\\"));716 try std.testing.expectError(error.InvalidString, parseFilename(std.testing.allocator, "\\"));
...@@ -713,7 +718,6 @@ test parseFilename {...@@ -713,7 +718,6 @@ test parseFilename {
713 try std.testing.expectError(error.InvalidString, parseFilename(std.testing.allocator, "\\U"));718 try std.testing.expectError(error.InvalidString, parseFilename(std.testing.allocator, "\\U"));
714 try std.testing.expectError(error.InvalidString, parseFilename(std.testing.allocator, "\\x"));719 try std.testing.expectError(error.InvalidString, parseFilename(std.testing.allocator, "\\x"));
715 try std.testing.expectError(error.InvalidString, parseFilename(std.testing.allocator, "\\xZZ"));720 try std.testing.expectError(error.InvalidString, parseFilename(std.testing.allocator, "\\xZZ"));
716 try std.testing.expectError(error.InvalidString, parseFilename(std.testing.allocator, "\\xABCDEF"));
717 try std.testing.expectError(error.InvalidString, parseFilename(std.testing.allocator, "\\777"));721 try std.testing.expectError(error.InvalidString, parseFilename(std.testing.allocator, "\\777"));
718}722}
719723