mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 12:51:18 +00:00
Read integers first when size matches
This commit is contained in:
parent
362441a74a
commit
428cbf56a6
@ -31,21 +31,19 @@ class Vector(bytes, TLObject):
|
|||||||
# i.e., RpcResult body starts with 0x1cb5c415 (Vector Id) - e.g., messages.GetMessagesViews.
|
# i.e., RpcResult body starts with 0x1cb5c415 (Vector Id) - e.g., messages.GetMessagesViews.
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def read_bare(b: BytesIO, size: int) -> Union[int, Any]:
|
def read_bare(b: BytesIO, size: int) -> Union[int, Any]:
|
||||||
try:
|
if size == 4:
|
||||||
return TLObject.read(b)
|
return Int.read(b)
|
||||||
except KeyError:
|
|
||||||
b.seek(-4, 1)
|
if size == 8:
|
||||||
|
return Long.read(b)
|
||||||
|
|
||||||
if size == 4:
|
return TLObject.read(b)
|
||||||
return Int.read(b)
|
|
||||||
else:
|
|
||||||
return Long.read(b)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def read(cls, data: BytesIO, t: Any = None, *args: Any) -> List:
|
def read(cls, data: BytesIO, t: Any = None, *args: Any) -> List:
|
||||||
count = Int.read(data)
|
count = Int.read(data)
|
||||||
left = len(data.read())
|
left = len(data.read())
|
||||||
size = (left // count) if count else 0
|
size = (left / count) if count else 0
|
||||||
data.seek(-left, 1)
|
data.seek(-left, 1)
|
||||||
|
|
||||||
return List(
|
return List(
|
||||||
|
Loading…
Reference in New Issue
Block a user