| author | |
| committer | |
| log | 21cad3e09f173154c4c0dc61dd05fe8dd0628dc3 |
| tree | 716f87eacd02c591b4288fb70d3adf6daa7cac8c |
| parent | e1d4cf67caedfe20d2e0af9d3b518af1f0777191 |
5 files changed, 11 insertions(+), 8 deletions(-)
lib/compiler/aro/aro/Driver.zig+2-2| ... | ... | @@ -730,8 +730,8 @@ fn processSource( |
| 730 | 730 | defer obj.deinit(); |
| 731 | 731 | |
| 732 | 732 | // If it's used, name_buf will either hold a filename or `/tmp/<12 random bytes with base-64 encoding>.<extension>` |
| 733 | // both of which should fit into MAX_NAME_BYTES for all systems | |
| 734 | var name_buf: [std.fs.MAX_NAME_BYTES]u8 = undefined; | |
| 733 | // both of which should fit into max_name_bytes for all systems | |
| 734 | var name_buf: [std.fs.max_name_bytes]u8 = undefined; | |
| 735 | 735 | |
| 736 | 736 | const out_file_name = if (d.only_compile) blk: { |
| 737 | 737 | const fmt_template = "{s}{s}"; |
lib/std/fs.zig+5-2| ... | ... | @@ -72,7 +72,7 @@ pub const max_path_bytes = switch (native_os) { |
| 72 | 72 | /// On Windows, `[]u8` file name components are encoded as [WTF-8](https://simonsapin.github.io/wtf-8/). |
| 73 | 73 | /// On WASI, file name components are encoded as valid UTF-8. |
| 74 | 74 | /// On other platforms, `[]u8` components are an opaque sequence of bytes with no particular encoding. |
| 75 | pub const MAX_NAME_BYTES = switch (native_os) { | |
| 75 | pub const max_name_bytes = switch (native_os) { | |
| 76 | 76 | .linux, .macos, .ios, .freebsd, .openbsd, .netbsd, .dragonfly, .solaris, .illumos => posix.NAME_MAX, |
| 77 | 77 | // Haiku's NAME_MAX includes the null terminator, so subtract one. |
| 78 | 78 | .haiku => posix.NAME_MAX - 1, |
| ... | ... | @@ -81,7 +81,7 @@ pub const MAX_NAME_BYTES = switch (native_os) { |
| 81 | 81 | // pair in the WTF-16LE, and we (over)account 3 bytes for it that way. |
| 82 | 82 | .windows => windows.NAME_MAX * 3, |
| 83 | 83 | // For WASI, the MAX_NAME will depend on the host OS, so it needs to be |
| 84 | // as large as the largest MAX_NAME_BYTES (Windows) in order to work on any host OS. | |
| 84 | // as large as the largest max_name_bytes (Windows) in order to work on any host OS. | |
| 85 | 85 | // TODO determine if this is a reasonable approach |
| 86 | 86 | .wasi => windows.NAME_MAX * 3, |
| 87 | 87 | else => if (@hasDecl(root, "os") and @hasDecl(root.os, "NAME_MAX")) |
| ... | ... | @@ -90,6 +90,9 @@ pub const MAX_NAME_BYTES = switch (native_os) { |
| 90 | 90 | @compileError("NAME_MAX not implemented for " ++ @tagName(native_os)), |
| 91 | 91 | }; |
| 92 | 92 | |
| 93 | /// Deprecated: use `max_name_bytes` | |
| 94 | pub const MAX_NAME_BYTES = max_name_bytes; | |
| 95 | ||
| 93 | 96 | pub const base64_alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".*; |
| 94 | 97 | |
| 95 | 98 | /// Base64 encoder, replacing the standard `+/` with `-_` so that it can be used in a file name on any filesystem. |
lib/std/fs/Dir.zig+1-1| ... | ... | @@ -414,7 +414,7 @@ pub const Iterator = switch (native_os) { |
| 414 | 414 | index: usize, |
| 415 | 415 | end_index: usize, |
| 416 | 416 | first_iter: bool, |
| 417 | name_data: [fs.MAX_NAME_BYTES]u8, | |
| 417 | name_data: [fs.max_name_bytes]u8, | |
| 418 | 418 | |
| 419 | 419 | const Self = @This(); |
| 420 | 420 |
lib/std/fs/test.zig+2-2| ... | ... | @@ -1269,11 +1269,11 @@ test "max file name component lengths" { |
| 1269 | 1269 | } else if (native_os == .wasi) { |
| 1270 | 1270 | // On WASI, the maxed filename depends on the host OS, so in order for this test to |
| 1271 | 1271 | // work on any host, we need to use a length that will work for all platforms |
| 1272 | // (i.e. the minimum MAX_NAME_BYTES of all supported platforms). | |
| 1272 | // (i.e. the minimum max_name_bytes of all supported platforms). | |
| 1273 | 1273 | const maxed_wasi_filename = [_]u8{'1'} ** 255; |
| 1274 | 1274 | try testFilenameLimits(tmp.dir, &maxed_wasi_filename); |
| 1275 | 1275 | } else { |
| 1276 | const maxed_ascii_filename = [_]u8{'1'} ** std.fs.MAX_NAME_BYTES; | |
| 1276 | const maxed_ascii_filename = [_]u8{'1'} ** std.fs.max_name_bytes; | |
| 1277 | 1277 | try testFilenameLimits(tmp.dir, &maxed_ascii_filename); |
| 1278 | 1278 | } |
| 1279 | 1279 | } |
lib/std/zig/WindowsSdk.zig+1-1| ... | ... | @@ -750,7 +750,7 @@ const MsvcLibDir = struct { |
| 750 | 750 | var instances_dir = try findInstancesDir(allocator); |
| 751 | 751 | defer instances_dir.close(); |
| 752 | 752 | |
| 753 | var state_subpath_buf: [std.fs.MAX_NAME_BYTES + 32]u8 = undefined; | |
| 753 | var state_subpath_buf: [std.fs.max_name_bytes + 32]u8 = undefined; | |
| 754 | 754 | var latest_version_lib_dir = std.ArrayListUnmanaged(u8){}; |
| 755 | 755 | errdefer latest_version_lib_dir.deinit(allocator); |
| 756 | 756 |