mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-02-19 09:11:48 +00:00
Fix buffer
This commit is contained in:
@@ -363,13 +363,16 @@ public class BufferReader {
|
||||
if count == 0 {
|
||||
return 0
|
||||
}
|
||||
else if count > 0 && count <= 4 || self.offset + UInt(count) <= self.buffer._size {
|
||||
var value: Int32 = 0
|
||||
memcpy(&value, self.buffer.data?.advanced(by: Int(self.offset)), count)
|
||||
self.offset += UInt(count)
|
||||
return value
|
||||
guard count > 0, count <= 4, self.offset + UInt(count) <= self.buffer._size else {
|
||||
return nil
|
||||
}
|
||||
return nil
|
||||
guard let bufferData = self.buffer.data else {
|
||||
return nil
|
||||
}
|
||||
var value: Int32 = 0
|
||||
memcpy(&value, bufferData.advanced(by: Int(self.offset)), count)
|
||||
self.offset += UInt(count)
|
||||
return value
|
||||
}
|
||||
|
||||
public func readBuffer(_ count: Int) -> Buffer? {
|
||||
|
||||
Reference in New Issue
Block a user