mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
std.compress.xz: fix 32-bit targets
This commit is contained in:
parent
0339c5793a
commit
68f590d430
1 changed files with 5 additions and 6 deletions
|
|
@ -259,9 +259,9 @@ fn readBlock(input: *Reader, allocating: *Writer.Allocating) !void {
|
||||||
|
|
||||||
// Block Padding
|
// Block Padding
|
||||||
const block_counter = header_size + packed_bytes_read;
|
const block_counter = header_size + packed_bytes_read;
|
||||||
const padding = (4 - (block_counter % 4)) % 4;
|
const padding = try input.take(@intCast((4 - (block_counter % 4)) % 4));
|
||||||
for (0..padding) |_| {
|
for (padding) |byte| {
|
||||||
if (try input.takeByte() != 0) return error.CorruptInput;
|
if (byte != 0) return error.CorruptInput;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -279,14 +279,13 @@ fn finish(d: *Decompress) !void {
|
||||||
if (record_count != d.block_count)
|
if (record_count != d.block_count)
|
||||||
return error.CorruptInput;
|
return error.CorruptInput;
|
||||||
|
|
||||||
for (0..record_count) |_| {
|
for (0..@intCast(record_count)) |_| {
|
||||||
// TODO: validate records
|
// TODO: validate records
|
||||||
_ = try countLeb128(input, u64, &input_counter, &checksum);
|
_ = try countLeb128(input, u64, &input_counter, &checksum);
|
||||||
_ = try countLeb128(input, u64, &input_counter, &checksum);
|
_ = try countLeb128(input, u64, &input_counter, &checksum);
|
||||||
}
|
}
|
||||||
|
|
||||||
const padding_len = (4 - (input_counter % 4)) % 4;
|
const padding = try input.take(@intCast((4 - (input_counter % 4)) % 4));
|
||||||
const padding = try input.take(padding_len);
|
|
||||||
for (padding) |byte| {
|
for (padding) |byte| {
|
||||||
if (byte != 0) return error.CorruptInput;
|
if (byte != 0) return error.CorruptInput;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue