diff options
Diffstat (limited to 'stdlib/source/library/lux/data/format/tar.lux')
-rw-r--r-- | stdlib/source/library/lux/data/format/tar.lux | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/stdlib/source/library/lux/data/format/tar.lux b/stdlib/source/library/lux/data/format/tar.lux index e60c13e05..802b7e03d 100644 --- a/stdlib/source/library/lux/data/format/tar.lux +++ b/stdlib/source/library/lux/data/format/tar.lux @@ -43,7 +43,7 @@ (let [padding_size (n.- (text.size number) max_size) padding (|> "0" - (list.repeat padding_size) + (list.repeated padding_size) (text.join_with ""))] (format padding number))) @@ -59,7 +59,7 @@ [(def: .public <limit> Nat (|> ..octal_size - (list.repeat <size>) + (list.repeated <size>) (list\fold n.* 1) inc)) @@ -236,7 +236,7 @@ (case end 0 (#try.Success (\ utf8.codec encode "")) _ (do try.monad - [last_char (binary.read/8 end string)] + [last_char (binary.read/8! end string)] (`` (case (.nat last_char) (^ (char (~~ (static ..null)))) (recur (dec end)) @@ -361,33 +361,33 @@ (def: header_size ($_ n.+ - ## name + ... name (..string ..path_size) - ## mode + ... mode (..small_number ..mode_size) - ## uid + ... uid (..small_number ..owner_id_size) - ## gid + ... gid (..small_number ..owner_id_size) - ## size + ... size (..big_number ..content_size) - ## mtime + ... mtime (..big_number ..modification_time_size) - ## chksum + ... chksum (..small_number ..checksum_size) - ## linkflag + ... linkflag ..link_flag_size - ## linkname + ... linkname (..string ..path_size) - ## magic + ... magic (..string ..magic_size) - ## uname + ... uname (..string ..name_size) - ## gname + ... gname (..string ..name_size) - ## devmajor + ... devmajor (..small_number ..device_size) - ## devminor + ... devminor (..small_number ..device_size))) (abstract: Link_Flag @@ -527,7 +527,7 @@ (def: maximum_content_size Nat (|> ..octal_size - (list.repeat ..content_size) + (list.repeated ..content_size) (list\fold n.* 1))) (abstract: .public Content @@ -651,7 +651,7 @@ (def: modification_time (-> Instant Big) (|>> instant.relative - (duration.query duration.second) + (duration.ticks duration.second) .nat ..as_big)) @@ -749,12 +749,12 @@ (def: header_padding_size (n.- header_size block_size)) -## When the checksum gets originally calculated, the assumption is that all the characters in the checksum field -## of the header will be spaces. -## This means that just calculating the checksum of the 512 bytes of the header, when reading them, would yield -## an incorrect result, as the contents of the checksum field would be an actual checksum, instead of just spaces. -## To correct for this, it is necessary to calculate the checksum of just the checksum field, subtract that, and then -## add-in the checksum of the spaces. +... When the checksum gets originally calculated, the assumption is that all the characters in the checksum field +... of the header will be spaces. +... This means that just calculating the checksum of the 512 bytes of the header, when reading them, would yield +... an incorrect result, as the contents of the checksum field would be an actual checksum, instead of just spaces. +... To correct for this, it is necessary to calculate the checksum of just the checksum field, subtract that, and then +... add-in the checksum of the spaces. (def: (expected_checksum checksum header) (-> Checksum Binary Nat) (let [|checksum| (|> checksum @@ -857,8 +857,8 @@ (\ <>.monad map (|>> #..Contiguous) (..file_parser ..contiguous)))) -## It's safe to implement the parser this way because the range of values for Nat is 2^64 -## Whereas the maximum possible value for the checksum of a 512 block is (256 × 512) = 131,072 +... It's safe to implement the parser this way because the range of values for Nat is 2^64 +... Whereas the maximum possible value for the checksum of a 512 block is (256 × 512) = 131,072 (def: end_of_archive_block_parser (Parser Any) (do <>.monad |