mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Fix buffer
This commit is contained in:
parent
2bed5fab18
commit
8e9cd79855
1 changed files with 9 additions and 6 deletions
|
|
@ -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? {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue