@zigc/lib 0.17.0-dev.228 → 0.17.0-dev.242
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiler/build_runner.zig +1 -1
- package/compiler/reduce/Walk.zig +1 -6
- package/compiler/resinator/cvtres.zig +4 -4
- package/compiler/resinator/ico.zig +4 -4
- package/compiler/resinator/parse.zig +2 -2
- package/compiler/resinator/res.zig +1 -1
- package/compiler/translate-c/ast.zig +11 -21
- package/compiler_rt/atomics.zig +1 -1
- package/compiler_rt/ssp.zig +2 -2
- package/docs/wasm/Walk.zig +1 -3
- package/docs/wasm/html_render.zig +1 -2
- package/package.json +1 -1
- package/std/Io/Reader.zig +0 -5
- package/std/Io/Threaded.zig +4 -4
- package/std/Io/Writer.zig +1 -2
- package/std/Io/net/HostName.zig +11 -6
- package/std/Random/ChaCha.zig +2 -2
- package/std/Random/benchmark.zig +2 -2
- package/std/Thread.zig +2 -2
- package/std/base64.zig +5 -5
- package/std/bit_set.zig +7 -7
- package/std/c.zig +17 -17
- package/std/compress/flate/Decompress.zig +1 -1
- package/std/crypto/25519/curve25519.zig +2 -2
- package/std/crypto/25519/edwards25519.zig +3 -3
- package/std/crypto/25519/ristretto255.zig +2 -2
- package/std/crypto/25519/scalar.zig +6 -6
- package/std/crypto/25519/x25519.zig +1 -1
- package/std/crypto/Certificate.zig +1 -1
- package/std/crypto/Sha1.zig +1 -1
- package/std/crypto/aegis.zig +45 -39
- package/std/crypto/aes_ccm.zig +20 -20
- package/std/crypto/aes_gcm.zig +10 -12
- package/std/crypto/aes_ocb.zig +9 -9
- package/std/crypto/argon2.zig +15 -15
- package/std/crypto/bcrypt.zig +20 -10
- package/std/crypto/benchmark.zig +7 -7
- package/std/crypto/blake2.zig +100 -64
- package/std/crypto/cbc_mac.zig +1 -1
- package/std/crypto/chacha20.zig +10 -10
- package/std/crypto/cmac.zig +2 -2
- package/std/crypto/codecs/asn1.zig +1 -1
- package/std/crypto/ecdsa.zig +9 -9
- package/std/crypto/ff.zig +2 -2
- package/std/crypto/ghash_polyval.zig +4 -4
- package/std/crypto/hkdf.zig +1 -1
- package/std/crypto/isap.zig +3 -3
- package/std/crypto/kangarootwelve.zig +1 -1
- package/std/crypto/keccak_p.zig +7 -7
- package/std/crypto/md5.zig +1 -1
- package/std/crypto/ml_dsa.zig +33 -33
- package/std/crypto/ml_kem.zig +4 -4
- package/std/crypto/modes.zig +1 -1
- package/std/crypto/pbkdf2.zig +1 -1
- package/std/crypto/pcurves/p256/scalar.zig +3 -3
- package/std/crypto/pcurves/p384/scalar.zig +2 -2
- package/std/crypto/pcurves/secp256k1/scalar.zig +3 -3
- package/std/crypto/pcurves/tests/p256.zig +5 -5
- package/std/crypto/pcurves/tests/p384.zig +5 -5
- package/std/crypto/pcurves/tests/secp256k1.zig +3 -3
- package/std/crypto/salsa20.zig +8 -8
- package/std/crypto/sha2.zig +2 -2
- package/std/crypto/sha3.zig +2 -2
- package/std/crypto/siphash.zig +1 -1
- package/std/crypto/timing_safe.zig +5 -4
- package/std/crypto/tls/Client.zig +10 -9
- package/std/crypto.zig +3 -3
- package/std/debug/Dwarf.zig +1 -1
- package/std/debug.zig +6 -4
- package/std/elf.zig +1 -1
- package/std/enums.zig +1 -1
- package/std/fmt/parse_float/decimal.zig +1 -1
- package/std/fmt.zig +5 -1
- package/std/hash/Adler32.zig +3 -3
- package/std/hash/benchmark.zig +2 -2
- package/std/hash/wyhash.zig +1 -1
- package/std/heap/debug_allocator.zig +1 -1
- package/std/http.zig +1 -1
- package/std/json/static.zig +2 -2
- package/std/math/big/int.zig +3 -3
- package/std/math/nextafter.zig +1 -2
- package/std/math/powi.zig +2 -3
- package/std/math/signbit.zig +0 -1
- package/std/math.zig +12 -18
- package/std/mem.zig +9 -8
- package/std/meta.zig +1 -1
- package/std/os/emscripten.zig +2 -2
- package/std/os/linux.zig +4 -4
- package/std/os/uefi/hii.zig +1 -1
- package/std/tar/Writer.zig +39 -33
- package/std/tar.zig +8 -4
- package/std/unicode.zig +13 -8
- package/std/zig/Ast/Render.zig +1 -25
- package/std/zig/Ast.zig +5 -28
- package/std/zig/AstGen.zig +75 -184
- package/std/zig/AstRlAnnotate.zig +1 -11
- package/std/zig/AstSmith.zig +5 -11
- package/std/zig/LibCInstallation.zig +1 -1
- package/std/zig/Parse.zig +4 -69
- package/std/zig/TokenSmith.zig +0 -6
- package/std/zig/WindowsSdk.zig +1 -1
- package/std/zig/Zir.zig +0 -54
- package/std/zig/ZonGen.zig +0 -1
- package/std/zig/llvm/Builder.zig +3 -7
- package/std/zig/tokenizer.zig +4 -43
- package/std/zig.zig +0 -2
|
@@ -1557,7 +1557,7 @@ fn printUsage(b: *std.Build, w: *Writer) !void {
|
|
|
1557
1557
|
const name = try fmt.allocPrint(arena, " -D{s}=[{t}]", .{ option.name, option.type_id });
|
|
1558
1558
|
try w.print("{s:<30} {s}\n", .{ name, option.description });
|
|
1559
1559
|
if (option.enum_options) |enum_options| {
|
|
1560
|
-
const padding =
|
|
1560
|
+
const padding: [33]u8 = @splat(' ');
|
|
1561
1561
|
try w.writeAll(padding ++ "Supported Values:\n");
|
|
1562
1562
|
for (enum_options) |enum_option| {
|
|
1563
1563
|
try w.print(padding ++ " {s}\n", .{enum_option});
|
package/compiler/reduce/Walk.zig
CHANGED
|
@@ -223,12 +223,8 @@ fn walkExpression(w: *Walk, node: Ast.Node.Index) Error!void {
|
|
|
223
223
|
return walkBlock(w, node, statements);
|
|
224
224
|
},
|
|
225
225
|
|
|
226
|
-
.@"errdefer" => {
|
|
227
|
-
const expr = ast.nodeData(node).opt_token_and_node[1];
|
|
228
|
-
return walkExpression(w, expr);
|
|
229
|
-
},
|
|
230
|
-
|
|
231
226
|
.@"defer",
|
|
227
|
+
.@"errdefer",
|
|
232
228
|
.@"comptime",
|
|
233
229
|
.@"nosuspend",
|
|
234
230
|
.@"suspend",
|
|
@@ -252,7 +248,6 @@ fn walkExpression(w: *Walk, node: Ast.Node.Index) Error!void {
|
|
|
252
248
|
.add_wrap,
|
|
253
249
|
.add_sat,
|
|
254
250
|
.array_cat,
|
|
255
|
-
.array_mult,
|
|
256
251
|
.assign,
|
|
257
252
|
.assign_bit_and,
|
|
258
253
|
.assign_bit_or,
|
|
@@ -321,7 +321,7 @@ pub fn writeCoff(
|
|
|
321
321
|
.checksum = 0,
|
|
322
322
|
.number = 0,
|
|
323
323
|
.selection = .NONE,
|
|
324
|
-
.unused =
|
|
324
|
+
.unused = @splat(0),
|
|
325
325
|
});
|
|
326
326
|
|
|
327
327
|
try writeSymbol(writer, .{
|
|
@@ -342,7 +342,7 @@ pub fn writeCoff(
|
|
|
342
342
|
.checksum = 0,
|
|
343
343
|
.number = 0,
|
|
344
344
|
.selection = .NONE,
|
|
345
|
-
.unused =
|
|
345
|
+
.unused = @splat(0),
|
|
346
346
|
});
|
|
347
347
|
|
|
348
348
|
for (resource_symbols) |resource_symbol| {
|
|
@@ -353,11 +353,11 @@ pub fn writeCoff(
|
|
|
353
353
|
const name_bytes: [8]u8 = name_bytes: {
|
|
354
354
|
if (external_symbol_name.len > 8) {
|
|
355
355
|
const string_table_offset: u32 = try string_table.put(allocator, external_symbol_name);
|
|
356
|
-
var bytes
|
|
356
|
+
var bytes: [8]u8 = @splat(0);
|
|
357
357
|
std.mem.writeInt(u32, bytes[4..8], string_table_offset, .little);
|
|
358
358
|
break :name_bytes bytes;
|
|
359
359
|
} else {
|
|
360
|
-
var symbol_shortname
|
|
360
|
+
var symbol_shortname: [8]u8 = @splat(0);
|
|
361
361
|
@memcpy(symbol_shortname[0..external_symbol_name.len], external_symbol_name);
|
|
362
362
|
break :name_bytes symbol_shortname;
|
|
363
363
|
}
|
|
@@ -183,7 +183,7 @@ pub const Entry = struct {
|
|
|
183
183
|
};
|
|
184
184
|
|
|
185
185
|
test "icon" {
|
|
186
|
-
const data = "\x00\x00\x01\x00\x01\x00\x10\x10\x00\x00\x01\x00\x10\x00\x10\x00\x00\x00\x16\x00\x00\x00" ++ [
|
|
186
|
+
const data = "\x00\x00\x01\x00\x01\x00\x10\x10\x00\x00\x01\x00\x10\x00\x10\x00\x00\x00\x16\x00\x00\x00" ++ @as([16]u8, @splat(0));
|
|
187
187
|
var fbs: std.Io.Reader = .fixed(data);
|
|
188
188
|
const icon = try read(std.testing.allocator, &fbs, data.len);
|
|
189
189
|
defer icon.deinit();
|
|
@@ -196,19 +196,19 @@ test "icon too many images" {
|
|
|
196
196
|
// Note that with verifying that all data sizes are within the file bounds and >= 16,
|
|
197
197
|
// it's not possible to hit EOF when looking for more RESDIR structures, since they are
|
|
198
198
|
// themselves 16 bytes long, so we'll always hit ImpossibleDataSize instead.
|
|
199
|
-
const data = "\x00\x00\x01\x00\x02\x00\x10\x10\x00\x00\x01\x00\x10\x00\x10\x00\x00\x00\x16\x00\x00\x00" ++ [
|
|
199
|
+
const data = "\x00\x00\x01\x00\x02\x00\x10\x10\x00\x00\x01\x00\x10\x00\x10\x00\x00\x00\x16\x00\x00\x00" ++ @as([16]u8, @splat(0));
|
|
200
200
|
var fbs: std.Io.Reader = .fixed(data);
|
|
201
201
|
try std.testing.expectError(error.ImpossibleDataSize, read(std.testing.allocator, &fbs, data.len));
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
test "icon data size past EOF" {
|
|
205
|
-
const data = "\x00\x00\x01\x00\x01\x00\x10\x10\x00\x00\x01\x00\x10\x00\x10\x01\x00\x00\x16\x00\x00\x00" ++ [
|
|
205
|
+
const data = "\x00\x00\x01\x00\x01\x00\x10\x10\x00\x00\x01\x00\x10\x00\x10\x01\x00\x00\x16\x00\x00\x00" ++ @as([16]u8, @splat(0));
|
|
206
206
|
var fbs: std.Io.Reader = .fixed(data);
|
|
207
207
|
try std.testing.expectError(error.ImpossibleDataSize, read(std.testing.allocator, &fbs, data.len));
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
test "icon data offset past EOF" {
|
|
211
|
-
const data = "\x00\x00\x01\x00\x01\x00\x10\x10\x00\x00\x01\x00\x10\x00\x10\x00\x00\x00\x17\x00\x00\x00" ++ [
|
|
211
|
+
const data = "\x00\x00\x01\x00\x01\x00\x10\x10\x00\x00\x01\x00\x10\x00\x10\x00\x00\x00\x17\x00\x00\x00" ++ @as([16]u8, @splat(0));
|
|
212
212
|
var fbs: std.Io.Reader = .fixed(data);
|
|
213
213
|
try std.testing.expectError(error.ImpossibleDataSize, read(std.testing.allocator, &fbs, data.len));
|
|
214
214
|
}
|
|
@@ -138,8 +138,8 @@ pub const Parser = struct {
|
|
|
138
138
|
var optional_statements: std.ArrayList(*Node) = .empty;
|
|
139
139
|
|
|
140
140
|
const num_statement_types = @typeInfo(rc.OptionalStatements).@"enum".fields.len;
|
|
141
|
-
var statement_type_has_duplicates
|
|
142
|
-
var last_statement_per_type
|
|
141
|
+
var statement_type_has_duplicates: [num_statement_types]bool = @splat(false);
|
|
142
|
+
var last_statement_per_type: [num_statement_types]?*Node = @splat(null);
|
|
143
143
|
|
|
144
144
|
while (true) {
|
|
145
145
|
const lookahead_token = try self.lookaheadToken(.normal);
|
|
@@ -1068,7 +1068,7 @@ pub const FixedFileInfo = struct {
|
|
|
1068
1068
|
pub const key = std.unicode.utf8ToUtf16LeStringLiteral("VS_VERSION_INFO");
|
|
1069
1069
|
|
|
1070
1070
|
pub const Version = struct {
|
|
1071
|
-
parts: [4]u16 =
|
|
1071
|
+
parts: [4]u16 = @splat(0),
|
|
1072
1072
|
|
|
1073
1073
|
pub fn mostSignificantCombinedParts(self: Version) u32 {
|
|
1074
1074
|
return (@as(u32, self.parts[0]) << 16) + self.parts[1];
|
|
@@ -242,7 +242,7 @@ pub const Node = extern union {
|
|
|
242
242
|
|
|
243
243
|
/// array_type{}
|
|
244
244
|
empty_array,
|
|
245
|
-
/// [
|
|
245
|
+
/// @as([count]type, @splat(val))
|
|
246
246
|
array_filler,
|
|
247
247
|
|
|
248
248
|
/// comptime { if (!(lhs)) @compileError(rhs); }
|
|
@@ -1976,28 +1976,18 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex {
|
|
|
1976
1976
|
.array_filler => {
|
|
1977
1977
|
const payload = node.castTag(.array_filler).?.data;
|
|
1978
1978
|
|
|
1979
|
-
const
|
|
1980
|
-
|
|
1981
|
-
const
|
|
1982
|
-
_ = try c.addToken(.
|
|
1979
|
+
const as_tok = try c.addToken(.builtin, "@as");
|
|
1980
|
+
_ = try c.addToken(.l_paren, "(");
|
|
1981
|
+
const type_node = try renderArrayType(c, payload.count, payload.type);
|
|
1982
|
+
_ = try c.addToken(.comma, ",");
|
|
1983
|
+
const splat_node = try renderBuiltinCall(c, "@splat", &.{payload.filler});
|
|
1984
|
+
_ = try c.addToken(.r_paren, ")");
|
|
1983
1985
|
|
|
1984
|
-
const init = try c.addNode(.{
|
|
1985
|
-
.tag = .array_init_one,
|
|
1986
|
-
.main_token = l_brace,
|
|
1987
|
-
.data = .{ .node_and_node = .{
|
|
1988
|
-
type_expr, val,
|
|
1989
|
-
} },
|
|
1990
|
-
});
|
|
1991
1986
|
return c.addNode(.{
|
|
1992
|
-
.tag = .
|
|
1993
|
-
.main_token =
|
|
1994
|
-
.data = .{ .
|
|
1995
|
-
|
|
1996
|
-
try c.addNode(.{
|
|
1997
|
-
.tag = .number_literal,
|
|
1998
|
-
.main_token = try c.addTokenFmt(.number_literal, "{d}", .{payload.count}),
|
|
1999
|
-
.data = undefined,
|
|
2000
|
-
}),
|
|
1987
|
+
.tag = .builtin_call_two,
|
|
1988
|
+
.main_token = as_tok,
|
|
1989
|
+
.data = .{ .opt_node_and_opt_node = .{
|
|
1990
|
+
.fromOptional(type_node), .fromOptional(splat_node),
|
|
2001
1991
|
} },
|
|
2002
1992
|
});
|
|
2003
1993
|
},
|
package/compiler_rt/atomics.zig
CHANGED
|
@@ -94,7 +94,7 @@ const SpinlockTable = struct {
|
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
-
list: [max_spinlocks]Spinlock =
|
|
97
|
+
list: [max_spinlocks]Spinlock = @splat(.{}),
|
|
98
98
|
|
|
99
99
|
// The spinlock table behaves as a really simple hash table, mapping
|
|
100
100
|
// addresses to spinlocks. The mapping is not unique but that's only a
|
package/compiler_rt/ssp.zig
CHANGED
|
@@ -44,10 +44,10 @@ fn __chk_fail() callconv(.c) noreturn {
|
|
|
44
44
|
|
|
45
45
|
// TODO: Initialize the canary with random data
|
|
46
46
|
var __stack_chk_guard: usize = blk: {
|
|
47
|
-
var buf
|
|
47
|
+
var buf: [@sizeOf(usize)]u8 = @splat(0);
|
|
48
48
|
buf[@sizeOf(usize) - 1] = 255;
|
|
49
49
|
buf[@sizeOf(usize) - 2] = '\n';
|
|
50
|
-
break :blk @
|
|
50
|
+
break :blk @bitCast(buf);
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
fn __strcpy_chk(dest: [*:0]u8, src: [*:0]const u8, dest_n: usize) callconv(.c) [*:0]u8 {
|
package/docs/wasm/Walk.zig
CHANGED
|
@@ -709,7 +709,6 @@ fn expr(w: *Walk, scope: *Scope, parent_decl: Decl.Index, node: Ast.Node.Index)
|
|
|
709
709
|
.less_or_equal,
|
|
710
710
|
.array_cat,
|
|
711
711
|
|
|
712
|
-
.array_mult,
|
|
713
712
|
.error_union,
|
|
714
713
|
.merge_error_sets,
|
|
715
714
|
.bool_and,
|
|
@@ -1014,8 +1013,7 @@ fn block(
|
|
|
1014
1013
|
|
|
1015
1014
|
.grouped_expression => try expr(w, scope, parent_decl, ast.nodeData(node).node_and_token[0]),
|
|
1016
1015
|
|
|
1017
|
-
.@"defer" => try expr(w, scope, parent_decl, ast.nodeData(node).node),
|
|
1018
|
-
.@"errdefer" => try expr(w, scope, parent_decl, ast.nodeData(node).opt_token_and_node[1]),
|
|
1016
|
+
.@"defer", .@"errdefer" => try expr(w, scope, parent_decl, ast.nodeData(node).node),
|
|
1019
1017
|
|
|
1020
1018
|
else => try expr(w, scope, parent_decl, node),
|
|
1021
1019
|
}
|
|
@@ -302,7 +302,6 @@ pub fn fileSourceHtml(
|
|
|
302
302
|
.minus_pipe_equal,
|
|
303
303
|
.asterisk,
|
|
304
304
|
.asterisk_equal,
|
|
305
|
-
.asterisk_asterisk,
|
|
306
305
|
.asterisk_percent,
|
|
307
306
|
.asterisk_percent_equal,
|
|
308
307
|
.asterisk_pipe,
|
|
@@ -328,7 +327,7 @@ pub fn fileSourceHtml(
|
|
|
328
327
|
.tilde,
|
|
329
328
|
=> try appendEscaped(out, slice),
|
|
330
329
|
|
|
331
|
-
.invalid
|
|
330
|
+
.invalid => return error.InvalidToken,
|
|
332
331
|
}
|
|
333
332
|
}
|
|
334
333
|
}
|
package/package.json
CHANGED
package/std/Io/Reader.zig
CHANGED
|
@@ -2097,7 +2097,6 @@ test "deserialize signed LEB128" {
|
|
|
2097
2097
|
try testing.expectEqual(std.math.minInt(i128), testLeb128(i128, "\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x7E"));
|
|
2098
2098
|
|
|
2099
2099
|
// Specific cases
|
|
2100
|
-
try testing.expectEqual(0, testLeb128(i0, "\x00"));
|
|
2101
2100
|
try testing.expectEqual(0, testLeb128(i2, "\x00"));
|
|
2102
2101
|
try testing.expectEqual(0, testLeb128(i8, "\x00"));
|
|
2103
2102
|
|
|
@@ -2134,8 +2133,6 @@ test "deserialize signed LEB128" {
|
|
|
2134
2133
|
try testing.expectError(error.EndOfStream, testLeb128(i128, &end_of_stream));
|
|
2135
2134
|
|
|
2136
2135
|
// Overflow
|
|
2137
|
-
try testing.expectError(error.Overflow, testLeb128(i0, "\x01"));
|
|
2138
|
-
try testing.expectError(error.Overflow, testLeb128(i0, "\x7F"));
|
|
2139
2136
|
try testing.expectError(error.Overflow, testLeb128(i8, "\x80\x01"));
|
|
2140
2137
|
try testing.expectError(error.Overflow, testLeb128(i8, "\xFF\x7E"));
|
|
2141
2138
|
try testing.expectError(error.Overflow, testLeb128(i8, "\x80\x80\x40"));
|
|
@@ -2145,7 +2142,6 @@ test "deserialize signed LEB128" {
|
|
|
2145
2142
|
try testing.expectError(error.Overflow, testLeb128(i64, "\x80\x80\x80\x80\x80\x80\x80\x80\x80\x01"));
|
|
2146
2143
|
try testing.expectError(error.Overflow, testLeb128(i64, "\x80\x80\x80\x80\x80\x80\x80\x80\x80\x40"));
|
|
2147
2144
|
|
|
2148
|
-
try testing.expectError(error.Overflow, testLeb128(i0, &overflow));
|
|
2149
2145
|
try testing.expectError(error.Overflow, testLeb128(i7, &overflow));
|
|
2150
2146
|
try testing.expectError(error.Overflow, testLeb128(i8, &overflow));
|
|
2151
2147
|
try testing.expectError(error.Overflow, testLeb128(i14, &overflow));
|
|
@@ -2159,7 +2155,6 @@ test "deserialize signed LEB128" {
|
|
|
2159
2155
|
try testing.expectEqual(0x80, testLeb128(i64, "\x80\x81\x00"));
|
|
2160
2156
|
try testing.expectEqual(0x80, testLeb128(i64, "\x80\x81\x80\x00"));
|
|
2161
2157
|
|
|
2162
|
-
try testing.expectEqual(0, testLeb128(i0, &long_zero));
|
|
2163
2158
|
try testing.expectEqual(0, testLeb128(i7, &long_zero));
|
|
2164
2159
|
try testing.expectEqual(0, testLeb128(i8, &long_zero));
|
|
2165
2160
|
try testing.expectEqual(0, testLeb128(i14, &long_zero));
|
package/std/Io/Threaded.zig
CHANGED
|
@@ -6329,7 +6329,7 @@ pub fn GetFinalPathNameByHandle(
|
|
|
6329
6329
|
const MIN_SIZE = @sizeOf(windows.MOUNTMGR_MOUNT_POINT) + windows.MAX_PATH;
|
|
6330
6330
|
// We initialize the input buffer to all zeros for convenience since
|
|
6331
6331
|
// `DeviceIoControl` with `IOCTL_MOUNTMGR_QUERY_POINTS` expects this.
|
|
6332
|
-
var input_buf: [MIN_SIZE]u8 align(@alignOf(windows.MOUNTMGR_MOUNT_POINT)) =
|
|
6332
|
+
var input_buf: [MIN_SIZE]u8 align(@alignOf(windows.MOUNTMGR_MOUNT_POINT)) = @splat(0);
|
|
6333
6333
|
var output_buf: [MIN_SIZE * 4]u8 align(@alignOf(windows.MOUNTMGR_MOUNT_POINTS)) = undefined;
|
|
6334
6334
|
|
|
6335
6335
|
// This surprising path is a filesystem path to the mount manager on Windows.
|
|
@@ -6409,7 +6409,7 @@ pub fn GetFinalPathNameByHandle(
|
|
|
6409
6409
|
|
|
6410
6410
|
// 49 is the maximum length accepted by mountmgrIsVolumeName
|
|
6411
6411
|
const vol_input_size = @sizeOf(windows.MOUNTMGR_TARGET_NAME) + (49 * 2);
|
|
6412
|
-
var vol_input_buf: [vol_input_size]u8 align(@alignOf(windows.MOUNTMGR_TARGET_NAME)) =
|
|
6412
|
+
var vol_input_buf: [vol_input_size]u8 align(@alignOf(windows.MOUNTMGR_TARGET_NAME)) = @splat(0);
|
|
6413
6413
|
// Note: If the path exceeds MAX_PATH, the Disk Management GUI doesn't accept the full path,
|
|
6414
6414
|
// and instead if must be specified using a shortened form (e.g. C:\FOO~1\BAR~1\<...>).
|
|
6415
6415
|
// However, just to be sure we can handle any path length, we use PATH_MAX_WIDE here.
|
|
@@ -8914,7 +8914,7 @@ fn isCygwinPty(file: File) Io.Cancelable!bool {
|
|
|
8914
8914
|
// we can use this smaller buffer and just return false on any error from
|
|
8915
8915
|
// NtQueryInformationFile.
|
|
8916
8916
|
const num_name_bytes = windows.MAX_PATH * 2;
|
|
8917
|
-
var name_info_bytes align(@alignOf(windows.FILE.NAME_INFORMATION)) =
|
|
8917
|
+
var name_info_bytes: [name_bytes_offset + num_name_bytes]u8 align(@alignOf(windows.FILE.NAME_INFORMATION)) = @splat(0);
|
|
8918
8918
|
|
|
8919
8919
|
var io_status_block: windows.IO_STATUS_BLOCK = undefined;
|
|
8920
8920
|
const syscall: Syscall = try .start();
|
|
@@ -16191,7 +16191,7 @@ fn windowsCreateProcessPathExt(
|
|
|
16191
16191
|
var io_status: windows.IO_STATUS_BLOCK = undefined;
|
|
16192
16192
|
|
|
16193
16193
|
const num_supported_pathext = @typeInfo(process.WindowsExtension).@"enum".fields.len;
|
|
16194
|
-
var pathext_seen
|
|
16194
|
+
var pathext_seen: [num_supported_pathext]bool = @splat(false);
|
|
16195
16195
|
var any_pathext_seen = false;
|
|
16196
16196
|
var unappended_exists = false;
|
|
16197
16197
|
|
package/std/Io/Writer.zig
CHANGED
|
@@ -781,7 +781,7 @@ test splatByteAll {
|
|
|
781
781
|
defer aw.deinit();
|
|
782
782
|
|
|
783
783
|
try aw.writer.splatByteAll('7', 45);
|
|
784
|
-
try testing.expectEqualStrings(
|
|
784
|
+
try testing.expectEqualStrings(&@as([45]u8, @splat('7')), aw.writer.buffered());
|
|
785
785
|
}
|
|
786
786
|
|
|
787
787
|
pub fn splatBytePreserve(w: *Writer, preserve: usize, byte: u8, n: usize) Error!void {
|
|
@@ -1924,7 +1924,6 @@ test "serialize signed LEB128" {
|
|
|
1924
1924
|
try testLeb128Encoding(i128, std.math.minInt(i128), "\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x7E");
|
|
1925
1925
|
|
|
1926
1926
|
// Specific cases
|
|
1927
|
-
try testLeb128Encoding(i0, 0, "\x00");
|
|
1928
1927
|
try testLeb128Encoding(i8, 0, "\x00");
|
|
1929
1928
|
|
|
1930
1929
|
try testLeb128Encoding(i2, -1, "\x7F");
|
package/std/Io/net/HostName.zig
CHANGED
|
@@ -76,9 +76,14 @@ test validate {
|
|
|
76
76
|
try validate("a-b.com");
|
|
77
77
|
try validate("a.b.c.d.e.f.g");
|
|
78
78
|
try validate("127.0.0.1"); // Also a valid hostname
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
try validate(
|
|
79
|
+
|
|
80
|
+
const many_a: [63]u8 = @splat('a');
|
|
81
|
+
try validate(&many_a ++ ".com"); // Label exactly 63 chars (valid)
|
|
82
|
+
|
|
83
|
+
const many_a_dot_buf: [127][2]u8 = @splat(.{ 'a', '.' });
|
|
84
|
+
const many_a_dot: []const u8 = @ptrCast(&many_a_dot_buf);
|
|
85
|
+
try validate(many_a_dot ++ "a"); // Total length 255 (valid)
|
|
86
|
+
try validate(many_a_dot ++ "a."); // Total length 255 + trailing dot (valid)
|
|
82
87
|
|
|
83
88
|
// Invalid hostnames
|
|
84
89
|
try std.testing.expectError(error.InvalidHostName, validate(""));
|
|
@@ -92,9 +97,9 @@ test validate {
|
|
|
92
97
|
try std.testing.expectError(error.InvalidHostName, validate("host_name.com"));
|
|
93
98
|
try std.testing.expectError(error.InvalidHostName, validate("."));
|
|
94
99
|
try std.testing.expectError(error.InvalidHostName, validate(".."));
|
|
95
|
-
try std.testing.expectError(error.InvalidHostName, validate(
|
|
96
|
-
try std.testing.expectError(error.NameTooLong, validate(
|
|
97
|
-
try std.testing.expectError(error.NameTooLong, validate(
|
|
100
|
+
try std.testing.expectError(error.InvalidHostName, validate(&many_a ++ "a.com")); // Label length 64 (too long)
|
|
101
|
+
try std.testing.expectError(error.NameTooLong, validate(many_a_dot ++ "ab")); // Total length 256 (too long)
|
|
102
|
+
try std.testing.expectError(error.NameTooLong, validate(many_a_dot ++ "ab.")); // Total length 256 + trailing dot (too long)
|
|
98
103
|
}
|
|
99
104
|
|
|
100
105
|
pub fn init(bytes: []const u8) ValidateError!HostName {
|
package/std/Random/ChaCha.zig
CHANGED
|
@@ -14,7 +14,7 @@ const State = [8 * Cipher.block_length]u8;
|
|
|
14
14
|
state: State,
|
|
15
15
|
offset: usize,
|
|
16
16
|
|
|
17
|
-
const nonce
|
|
17
|
+
const nonce: [Cipher.nonce_length]u8 = @splat(0);
|
|
18
18
|
|
|
19
19
|
pub const secret_seed_length = Cipher.key_length;
|
|
20
20
|
|
|
@@ -38,7 +38,7 @@ pub fn addEntropy(self: *Self, bytes: []const u8) void {
|
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
if (i < bytes.len) {
|
|
41
|
-
var k
|
|
41
|
+
var k: [Cipher.key_length]u8 = @splat(0);
|
|
42
42
|
const src = bytes[i..];
|
|
43
43
|
@memcpy(k[0..src.len], src);
|
|
44
44
|
Cipher.xor(
|
package/std/Random/benchmark.zig
CHANGED
|
@@ -55,12 +55,12 @@ const csprngs = [_]Rng{
|
|
|
55
55
|
Rng{
|
|
56
56
|
.ty = Random.Ascon,
|
|
57
57
|
.name = "ascon",
|
|
58
|
-
.init_u8s =
|
|
58
|
+
.init_u8s = &@as([32]u8, @splat(0)),
|
|
59
59
|
},
|
|
60
60
|
Rng{
|
|
61
61
|
.ty = Random.ChaCha,
|
|
62
62
|
.name = "chacha",
|
|
63
|
-
.init_u8s =
|
|
63
|
+
.init_u8s = &@as([32]u8, @splat(0)),
|
|
64
64
|
},
|
|
65
65
|
};
|
|
66
66
|
|
package/std/Thread.zig
CHANGED
|
@@ -1574,9 +1574,9 @@ const LinuxThreadImpl = struct {
|
|
|
1574
1574
|
};
|
|
1575
1575
|
|
|
1576
1576
|
fn testThreadName(io: Io, thread: *Thread) !void {
|
|
1577
|
-
const testCases
|
|
1577
|
+
const testCases: []const []const u8 = &.{
|
|
1578
1578
|
"mythread",
|
|
1579
|
-
|
|
1579
|
+
&@as([max_name_len]u8, @splat('b')),
|
|
1580
1580
|
};
|
|
1581
1581
|
|
|
1582
1582
|
inline for (testCases) |tc| {
|
package/std/base64.zig
CHANGED
|
@@ -86,7 +86,7 @@ pub const Base64Encoder = struct {
|
|
|
86
86
|
/// A bunch of assertions, then simply pass the data right through.
|
|
87
87
|
pub fn init(alphabet_chars: [64]u8, pad_char: ?u8) Base64Encoder {
|
|
88
88
|
assert(alphabet_chars.len == 64);
|
|
89
|
-
var char_in_alphabet
|
|
89
|
+
var char_in_alphabet: [256]bool = @splat(false);
|
|
90
90
|
for (alphabet_chars) |c| {
|
|
91
91
|
assert(!char_in_alphabet[c]);
|
|
92
92
|
assert(pad_char == null or c != pad_char.?);
|
|
@@ -176,12 +176,12 @@ pub const Base64Decoder = struct {
|
|
|
176
176
|
|
|
177
177
|
pub fn init(alphabet_chars: [64]u8, pad_char: ?u8) Base64Decoder {
|
|
178
178
|
var result = Base64Decoder{
|
|
179
|
-
.char_to_index =
|
|
180
|
-
.fast_char_to_index =
|
|
179
|
+
.char_to_index = @splat(invalid_char),
|
|
180
|
+
.fast_char_to_index = @splat(@splat(invalid_char_tst)),
|
|
181
181
|
.pad_char = pad_char,
|
|
182
182
|
};
|
|
183
183
|
|
|
184
|
-
var char_in_alphabet
|
|
184
|
+
var char_in_alphabet: [256]bool = @splat(false);
|
|
185
185
|
for (alphabet_chars, 0..) |c, i| {
|
|
186
186
|
assert(!char_in_alphabet[c]);
|
|
187
187
|
assert(pad_char == null or c != pad_char.?);
|
|
@@ -302,7 +302,7 @@ pub const Base64DecoderWithIgnore = struct {
|
|
|
302
302
|
pub fn init(alphabet_chars: [64]u8, pad_char: ?u8, ignore_chars: []const u8) Base64DecoderWithIgnore {
|
|
303
303
|
var result = Base64DecoderWithIgnore{
|
|
304
304
|
.decoder = Base64Decoder.init(alphabet_chars, pad_char),
|
|
305
|
-
.char_is_ignored =
|
|
305
|
+
.char_is_ignored = @splat(false),
|
|
306
306
|
};
|
|
307
307
|
for (ignore_chars) |c| {
|
|
308
308
|
assert(result.decoder.char_to_index[c] == Base64Decoder.invalid_char);
|
package/std/bit_set.zig
CHANGED
|
@@ -406,24 +406,24 @@ pub fn Array(comptime MaskIntType: type, comptime size: usize) type {
|
|
|
406
406
|
/// Deprecated: use `.empty`.
|
|
407
407
|
/// Creates a bit set with no elements present.
|
|
408
408
|
pub fn initEmpty() Self {
|
|
409
|
-
return .
|
|
409
|
+
return .empty;
|
|
410
410
|
}
|
|
411
411
|
|
|
412
412
|
/// Deprecated: use `.full`.
|
|
413
413
|
/// Creates a bit set with all elements present.
|
|
414
414
|
pub fn initFull() Self {
|
|
415
|
-
|
|
416
|
-
return .{ .masks = .{} };
|
|
417
|
-
} else {
|
|
418
|
-
return .{ .masks = [_]MaskInt{~@as(MaskInt, 0)} ** (num_masks - 1) ++ [_]MaskInt{last_item_mask} };
|
|
419
|
-
}
|
|
415
|
+
return .full;
|
|
420
416
|
}
|
|
421
417
|
|
|
422
418
|
/// A bit set with no elements present.
|
|
423
419
|
pub const empty: Self = .{ .masks = @splat(0) };
|
|
424
420
|
|
|
425
421
|
/// A bit set with all elements present.
|
|
426
|
-
pub const full: Self =
|
|
422
|
+
pub const full: Self = full: {
|
|
423
|
+
var masks: [num_masks]MaskInt = @splat(~@as(MaskInt, 0));
|
|
424
|
+
if (num_masks > 0) masks[num_masks - 1] = last_item_mask;
|
|
425
|
+
break :full .{ .masks = masks };
|
|
426
|
+
};
|
|
427
427
|
|
|
428
428
|
/// Returns the number of bits in this bit set
|
|
429
429
|
pub inline fn capacity(self: Self) usize {
|
package/std/c.zig
CHANGED
|
@@ -7914,7 +7914,7 @@ pub const pthread_spinlock_t = switch (native_os) {
|
|
|
7914
7914
|
|
|
7915
7915
|
pub const pthread_mutex_t = switch (native_os) {
|
|
7916
7916
|
.linux => extern struct {
|
|
7917
|
-
data: [data_len]u8 align(@alignOf(usize)) =
|
|
7917
|
+
data: [data_len]u8 align(@alignOf(usize)) = @splat(0),
|
|
7918
7918
|
|
|
7919
7919
|
const data_len = switch (native_abi) {
|
|
7920
7920
|
.musl, .musleabi, .musleabihf => if (@sizeOf(usize) == 8) 40 else 24,
|
|
@@ -7930,7 +7930,7 @@ pub const pthread_mutex_t = switch (native_os) {
|
|
|
7930
7930
|
},
|
|
7931
7931
|
.driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct {
|
|
7932
7932
|
sig: c_long = 0x32AAABA7,
|
|
7933
|
-
data: [data_len]u8 =
|
|
7933
|
+
data: [data_len]u8 = @splat(0),
|
|
7934
7934
|
|
|
7935
7935
|
const data_len = if (@sizeOf(usize) == 8) 56 else 40;
|
|
7936
7936
|
},
|
|
@@ -7966,10 +7966,10 @@ pub const pthread_mutex_t = switch (native_os) {
|
|
|
7966
7966
|
data: u64 = 0,
|
|
7967
7967
|
},
|
|
7968
7968
|
.fuchsia => extern struct {
|
|
7969
|
-
data: [40]u8 align(@alignOf(usize)) =
|
|
7969
|
+
data: [40]u8 align(@alignOf(usize)) = @splat(0),
|
|
7970
7970
|
},
|
|
7971
7971
|
.emscripten => extern struct {
|
|
7972
|
-
data: [24]u8 align(4) =
|
|
7972
|
+
data: [24]u8 align(4) = @splat(0),
|
|
7973
7973
|
},
|
|
7974
7974
|
// https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L68-L73
|
|
7975
7975
|
.serenity => extern struct {
|
|
@@ -7983,11 +7983,11 @@ pub const pthread_mutex_t = switch (native_os) {
|
|
|
7983
7983
|
|
|
7984
7984
|
pub const pthread_cond_t = switch (native_os) {
|
|
7985
7985
|
.linux => extern struct {
|
|
7986
|
-
data: [48]u8 align(@alignOf(usize)) =
|
|
7986
|
+
data: [48]u8 align(@alignOf(usize)) = @splat(0),
|
|
7987
7987
|
},
|
|
7988
7988
|
.driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct {
|
|
7989
7989
|
sig: c_long = 0x3CB0B1BB,
|
|
7990
|
-
data: [data_len]u8 =
|
|
7990
|
+
data: [data_len]u8 = @splat(0),
|
|
7991
7991
|
const data_len = if (@sizeOf(usize) == 8) 40 else 24;
|
|
7992
7992
|
},
|
|
7993
7993
|
.freebsd, .dragonfly, .openbsd => extern struct {
|
|
@@ -8012,13 +8012,13 @@ pub const pthread_cond_t = switch (native_os) {
|
|
|
8012
8012
|
lock: i32 = 0,
|
|
8013
8013
|
},
|
|
8014
8014
|
.illumos => extern struct {
|
|
8015
|
-
flag: [4]u8 =
|
|
8015
|
+
flag: [4]u8 = @splat(0),
|
|
8016
8016
|
type: u16 = 0,
|
|
8017
8017
|
magic: u16 = 0x4356,
|
|
8018
8018
|
data: u64 = 0,
|
|
8019
8019
|
},
|
|
8020
8020
|
.fuchsia, .emscripten => extern struct {
|
|
8021
|
-
data: [48]u8 align(@alignOf(usize)) =
|
|
8021
|
+
data: [48]u8 align(@alignOf(usize)) = @splat(0),
|
|
8022
8022
|
},
|
|
8023
8023
|
// https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L80-L84
|
|
8024
8024
|
.serenity => extern struct {
|
|
@@ -8033,20 +8033,20 @@ pub const pthread_rwlock_t = switch (native_os) {
|
|
|
8033
8033
|
.linux => switch (native_abi) {
|
|
8034
8034
|
.android, .androideabi => switch (@sizeOf(usize)) {
|
|
8035
8035
|
4 => extern struct {
|
|
8036
|
-
data: [40]u8 align(@alignOf(usize)) =
|
|
8036
|
+
data: [40]u8 align(@alignOf(usize)) = @splat(0),
|
|
8037
8037
|
},
|
|
8038
8038
|
8 => extern struct {
|
|
8039
|
-
data: [56]u8 align(@alignOf(usize)) =
|
|
8039
|
+
data: [56]u8 align(@alignOf(usize)) = @splat(0),
|
|
8040
8040
|
},
|
|
8041
8041
|
else => @compileError("impossible pointer size"),
|
|
8042
8042
|
},
|
|
8043
8043
|
else => extern struct {
|
|
8044
|
-
data: [56]u8 align(@alignOf(usize)) =
|
|
8044
|
+
data: [56]u8 align(@alignOf(usize)) = @splat(0),
|
|
8045
8045
|
},
|
|
8046
8046
|
},
|
|
8047
8047
|
.driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct {
|
|
8048
8048
|
sig: c_long = 0x2DA8B3B4,
|
|
8049
|
-
data: [192]u8 =
|
|
8049
|
+
data: [192]u8 = @splat(0),
|
|
8050
8050
|
},
|
|
8051
8051
|
.freebsd, .dragonfly, .openbsd => extern struct {
|
|
8052
8052
|
ptr: ?*anyopaque = null,
|
|
@@ -8079,10 +8079,10 @@ pub const pthread_rwlock_t = switch (native_os) {
|
|
|
8079
8079
|
writercv: pthread_cond_t = .{},
|
|
8080
8080
|
},
|
|
8081
8081
|
.fuchsia => extern struct {
|
|
8082
|
-
size: [56]u8 align(@alignOf(usize)) =
|
|
8082
|
+
size: [56]u8 align(@alignOf(usize)) = @splat(0),
|
|
8083
8083
|
},
|
|
8084
8084
|
.emscripten => extern struct {
|
|
8085
|
-
size: [32]u8 align(4) =
|
|
8085
|
+
size: [32]u8 align(4) = @splat(0),
|
|
8086
8086
|
},
|
|
8087
8087
|
// https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L86
|
|
8088
8088
|
.serenity => extern struct {
|
|
@@ -8170,8 +8170,8 @@ pub const sem_t = switch (native_os) {
|
|
|
8170
8170
|
count: u32 = 0,
|
|
8171
8171
|
type: u16 = 0,
|
|
8172
8172
|
magic: u16 = 0x534d,
|
|
8173
|
-
__pad1: [3]u64 =
|
|
8174
|
-
__pad2: [2]u64 =
|
|
8173
|
+
__pad1: [3]u64 = @splat(0),
|
|
8174
|
+
__pad2: [2]u64 = @splat(0),
|
|
8175
8175
|
},
|
|
8176
8176
|
.openbsd, .netbsd, .dragonfly => ?*opaque {},
|
|
8177
8177
|
.haiku => extern struct {
|
|
@@ -8235,7 +8235,7 @@ pub const Kevent = switch (native_os) {
|
|
|
8235
8235
|
/// Opaque user data identifier.
|
|
8236
8236
|
udata: usize,
|
|
8237
8237
|
/// Future extensions.
|
|
8238
|
-
_ext: [4]u64 =
|
|
8238
|
+
_ext: [4]u64 = @splat(0),
|
|
8239
8239
|
},
|
|
8240
8240
|
.dragonfly => extern struct {
|
|
8241
8241
|
ident: usize,
|
|
@@ -723,7 +723,7 @@ fn HuffmanDecoder(
|
|
|
723
723
|
if (alphabet_size == 286)
|
|
724
724
|
if (lens[256] == 0) return error.MissingEndOfBlockCode;
|
|
725
725
|
|
|
726
|
-
var count
|
|
726
|
+
var count: [@as(usize, max_code_bits) + 1]u16 = @splat(0);
|
|
727
727
|
var max: usize = 0;
|
|
728
728
|
for (lens) |n| {
|
|
729
729
|
if (n == 0) continue;
|
|
@@ -41,7 +41,7 @@ pub const Curve25519 = struct {
|
|
|
41
41
|
|
|
42
42
|
/// Multiply a point by the cofactor, returning WeakPublicKey if the element is in a small-order group.
|
|
43
43
|
pub fn clearCofactor(p: Curve25519) WeakPublicKeyError!Curve25519 {
|
|
44
|
-
const cofactor = [_]u8{8} ++ [
|
|
44
|
+
const cofactor = [_]u8{8} ++ @as([31]u8, @splat(0));
|
|
45
45
|
return ladder(p, cofactor, 4) catch return error.WeakPublicKey;
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -168,7 +168,7 @@ test "elligator2" {
|
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
test "small order check" {
|
|
171
|
-
var s: [32]u8 = [_]u8{1} ++ [
|
|
171
|
+
var s: [32]u8 = [_]u8{1} ++ @as([31]u8, @splat(0));
|
|
172
172
|
const small_order_ss: [7][32]u8 = .{
|
|
173
173
|
.{
|
|
174
174
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0 (order 4)
|