mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Temp
This commit is contained in:
@@ -46,7 +46,9 @@ private final class MediaBoxFileMap {
|
||||
|
||||
var data = Data(count: Int(4 + count * 2 * 4))
|
||||
let dataCount = data.count
|
||||
if !(data.withUnsafeMutableBytes { (bytes: UnsafeMutablePointer<UInt8>) -> Bool in
|
||||
if !(data.withUnsafeMutableBytes { rawBytes -> Bool in
|
||||
let bytes = rawBytes.baseAddress!.assumingMemoryBound(to: UInt8.self)
|
||||
|
||||
guard fd.read(bytes, dataCount) == dataCount else {
|
||||
return false
|
||||
}
|
||||
@@ -337,8 +339,6 @@ final class MediaBoxPartialFile {
|
||||
} else {
|
||||
assertionFailure()
|
||||
}
|
||||
} catch {
|
||||
assertionFailure()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -364,7 +364,9 @@ final class MediaBoxPartialFile {
|
||||
assert(self.queue.isCurrent())
|
||||
|
||||
self.fd.seek(position: Int64(offset))
|
||||
let written = data.withUnsafeBytes { (bytes: UnsafePointer<UInt8>) -> Int in
|
||||
let written = data.withUnsafeBytes { rawBytes -> Int in
|
||||
let bytes = rawBytes.baseAddress!.assumingMemoryBound(to: UInt8.self)
|
||||
|
||||
return self.fd.write(bytes.advanced(by: dataRange.lowerBound), count: dataRange.count)
|
||||
}
|
||||
assert(written == dataRange.count)
|
||||
@@ -457,7 +459,8 @@ final class MediaBoxPartialFile {
|
||||
self.fd.seek(position: Int64(actualRange.lowerBound))
|
||||
var data = Data(count: actualRange.count)
|
||||
let dataCount = data.count
|
||||
let readBytes = data.withUnsafeMutableBytes { (bytes: UnsafeMutablePointer<Int8>) -> Int in
|
||||
let readBytes = data.withUnsafeMutableBytes { rawBytes -> Int in
|
||||
let bytes = rawBytes.baseAddress!.assumingMemoryBound(to: Int8.self)
|
||||
return self.fd.read(bytes, dataCount)
|
||||
}
|
||||
if readBytes == data.count {
|
||||
|
||||
Reference in New Issue
Block a user