mirror of
https://github.com/ziglang/zig.git
synced 2026-01-09 17:05:16 +00:00
std.tar: trim also spaces from the beginning of file size
This commit is contained in:
parent
8ca4a5240e
commit
f64f3423e4
@ -82,7 +82,7 @@ pub const Header = struct {
|
||||
|
||||
pub fn fileSize(header: Header) !u64 {
|
||||
const raw = header.bytes[124..][0..12];
|
||||
const ltrimmed = std.mem.trimLeft(u8, raw, "0");
|
||||
const ltrimmed = std.mem.trimLeft(u8, raw, "0 ");
|
||||
const rtrimmed = std.mem.trimRight(u8, ltrimmed, " \x00");
|
||||
if (rtrimmed.len == 0) return 0;
|
||||
return std.fmt.parseInt(u64, rtrimmed, 8);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user