authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2025-11-16 03:45:38-08:00
committergravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2025-11-16 04:03:52-08:00
logadf74ba4fb86b9fa95739e9e6cb78bf93858e1a5
treed8331a109b4fd873ea829bf13550d9cc7ab270b6
parentaa4332fb0e5f46657c8c41a3971150b642be1c19

windows.eqlIgnoreCaseWTF16 -> eqlIgnoreCaseWtf16

Consistent with naming of other, similar functions

3 files changed, 7 insertions(+), 7 deletions(-)

lib/std/os/windows.zig+4-4
...@@ -2088,7 +2088,7 @@ pub fn nanoSecondsToFileTime(ns: Io.Timestamp) FILETIME {...@@ -2088,7 +2088,7 @@ pub fn nanoSecondsToFileTime(ns: Io.Timestamp) FILETIME {
2088/// Compares two WTF16 strings using the equivalent functionality of2088/// Compares two WTF16 strings using the equivalent functionality of
2089/// `RtlEqualUnicodeString` (with case insensitive comparison enabled).2089/// `RtlEqualUnicodeString` (with case insensitive comparison enabled).
2090/// This function can be called on any target.2090/// This function can be called on any target.
2091pub fn eqlIgnoreCaseWTF16(a: []const u16, b: []const u16) bool {2091pub fn eqlIgnoreCaseWtf16(a: []const u16, b: []const u16) bool {
2092 if (@inComptime() or builtin.os.tag != .windows) {2092 if (@inComptime() or builtin.os.tag != .windows) {
2093 // This function compares the strings code unit by code unit (aka u16-to-u16),2093 // This function compares the strings code unit by code unit (aka u16-to-u16),
2094 // so any length difference implies inequality. In other words, there's no possible2094 // so any length difference implies inequality. In other words, there's no possible
...@@ -2165,19 +2165,19 @@ pub fn eqlIgnoreCaseWtf8(a: []const u8, b: []const u8) bool {...@@ -2165,19 +2165,19 @@ pub fn eqlIgnoreCaseWtf8(a: []const u8, b: []const u8) bool {
21652165
2166fn testEqlIgnoreCase(comptime expect_eql: bool, comptime a: []const u8, comptime b: []const u8) !void {2166fn testEqlIgnoreCase(comptime expect_eql: bool, comptime a: []const u8, comptime b: []const u8) !void {
2167 try std.testing.expectEqual(expect_eql, eqlIgnoreCaseWtf8(a, b));2167 try std.testing.expectEqual(expect_eql, eqlIgnoreCaseWtf8(a, b));
2168 try std.testing.expectEqual(expect_eql, eqlIgnoreCaseWTF16(2168 try std.testing.expectEqual(expect_eql, eqlIgnoreCaseWtf16(
2169 std.unicode.utf8ToUtf16LeStringLiteral(a),2169 std.unicode.utf8ToUtf16LeStringLiteral(a),
2170 std.unicode.utf8ToUtf16LeStringLiteral(b),2170 std.unicode.utf8ToUtf16LeStringLiteral(b),
2171 ));2171 ));
21722172
2173 try comptime std.testing.expect(expect_eql == eqlIgnoreCaseWtf8(a, b));2173 try comptime std.testing.expect(expect_eql == eqlIgnoreCaseWtf8(a, b));
2174 try comptime std.testing.expect(expect_eql == eqlIgnoreCaseWTF16(2174 try comptime std.testing.expect(expect_eql == eqlIgnoreCaseWtf16(
2175 std.unicode.utf8ToUtf16LeStringLiteral(a),2175 std.unicode.utf8ToUtf16LeStringLiteral(a),
2176 std.unicode.utf8ToUtf16LeStringLiteral(b),2176 std.unicode.utf8ToUtf16LeStringLiteral(b),
2177 ));2177 ));
2178}2178}
21792179
2180test "eqlIgnoreCaseWTF16/Wtf8" {2180test "eqlIgnoreCaseWtf16/Wtf8" {
2181 try testEqlIgnoreCase(true, "\x01 a B Λ ɐ", "\x01 A b λ Ɐ");2181 try testEqlIgnoreCase(true, "\x01 a B Λ ɐ", "\x01 A b λ Ɐ");
2182 // does not do case-insensitive comparison for codepoints >= U+100002182 // does not do case-insensitive comparison for codepoints >= U+10000
2183 try testEqlIgnoreCase(false, "𐓏", "𐓷");2183 try testEqlIgnoreCase(false, "𐓏", "𐓷");
lib/std/process.zig+1-1
...@@ -564,7 +564,7 @@ pub fn getenvW(key: [*:0]const u16) ?[:0]const u16 {...@@ -564,7 +564,7 @@ pub fn getenvW(key: [*:0]const u16) ?[:0]const u16 {
564 };564 };
565565
566 const this_key = key_value[0..equal_index];566 const this_key = key_value[0..equal_index];
567 if (windows.eqlIgnoreCaseWTF16(key_slice, this_key)) {567 if (windows.eqlIgnoreCaseWtf16(key_slice, this_key)) {
568 return key_value[equal_index + 1 ..];568 return key_value[equal_index + 1 ..];
569 }569 }
570570
lib/std/process/Child.zig+2-2
...@@ -1227,7 +1227,7 @@ fn windowsCreateProcessPathExt(...@@ -1227,7 +1227,7 @@ fn windowsCreateProcessPathExt(
1227 const app_name = app_buf.items[0..app_name_len];1227 const app_name = app_buf.items[0..app_name_len];
1228 const ext_start = std.mem.lastIndexOfScalar(u16, app_name, '.') orelse break :unappended err;1228 const ext_start = std.mem.lastIndexOfScalar(u16, app_name, '.') orelse break :unappended err;
1229 const ext = app_name[ext_start..];1229 const ext = app_name[ext_start..];
1230 if (windows.eqlIgnoreCaseWTF16(ext, unicode.utf8ToUtf16LeStringLiteral(".EXE"))) {1230 if (windows.eqlIgnoreCaseWtf16(ext, unicode.utf8ToUtf16LeStringLiteral(".EXE"))) {
1231 return error.UnrecoverableInvalidExe;1231 return error.UnrecoverableInvalidExe;
1232 }1232 }
1233 break :unappended err;1233 break :unappended err;
...@@ -1278,7 +1278,7 @@ fn windowsCreateProcessPathExt(...@@ -1278,7 +1278,7 @@ fn windowsCreateProcessPathExt(
1278 // On InvalidExe, if the extension of the app name is .exe then1278 // On InvalidExe, if the extension of the app name is .exe then
1279 // it's treated as an unrecoverable error. Otherwise, it'll be1279 // it's treated as an unrecoverable error. Otherwise, it'll be
1280 // skipped as normal.1280 // skipped as normal.
1281 if (windows.eqlIgnoreCaseWTF16(ext, unicode.utf8ToUtf16LeStringLiteral(".EXE"))) {1281 if (windows.eqlIgnoreCaseWtf16(ext, unicode.utf8ToUtf16LeStringLiteral(".EXE"))) {
1282 return error.UnrecoverableInvalidExe;1282 return error.UnrecoverableInvalidExe;
1283 }1283 }
1284 continue;1284 continue;