mirror of
https://github.com/GayPizzaSpecifications/darwin-apk.git
synced 2025-08-03 13:31:32 +00:00
we are trapped in the tar (i made it 1ms faster yay for me the ratboy genius)
This commit is contained in:
@ -36,15 +36,13 @@ public struct TarReader {
|
|||||||
let size = try Self.readSize(tarBlock)
|
let size = try Self.readSize(tarBlock)
|
||||||
|
|
||||||
// Read file data
|
// Read file data
|
||||||
var data = Data(count: size)
|
var data = Data()
|
||||||
if size > 0 {
|
if size > 0 {
|
||||||
try data.withUnsafeMutableBytes {
|
data = try stream.read(size)
|
||||||
guard size == (try stream.read(
|
guard size == data.count else {
|
||||||
$0.baseAddress!.assumingMemoryBound(to: UInt8.self),
|
throw TarError.unexpectedEndOfStream
|
||||||
maxLength: size)) else {
|
|
||||||
throw TarError.unexpectedEndOfStream
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Seek to next block boundry
|
// Seek to next block boundry
|
||||||
let blockN1 = Self.tarBlockSize - 1
|
let blockN1 = Self.tarBlockSize - 1
|
||||||
let seekAmount = blockN1 - ((size + blockN1) % Self.tarBlockSize) // 511 − ((size − 1) & 0x1FF)
|
let seekAmount = blockN1 - ((size + blockN1) % Self.tarBlockSize) // 511 − ((size − 1) & 0x1FF)
|
||||||
|
Reference in New Issue
Block a user