From 9998df34a842204c041606c8e49c39e3f630f8a5 Mon Sep 17 00:00:00 2001 From: aleroux Date: Fri, 27 Jan 2023 10:10:19 +0100 Subject: [PATCH] =?UTF-8?q?Update=20QNameDictionaryTextRecord=20encoding?= =?UTF-8?q?=20to=20Protocol=20Version=20V8.0=20=E2=80=93=202019/03/13?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit see https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-winerrata/6babfe2e-3c59-4ab0-87a2-443f75ea7e8b --- wcf/records/text.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/wcf/records/text.py b/wcf/records/text.py index b6a5d82..36d34c7 100644 --- a/wcf/records/text.py +++ b/wcf/records/text.py @@ -370,14 +370,11 @@ def __init__(self, prefix, index): def to_bytes(self): """ >>> QNameDictionaryTextRecord('b', 2).to_bytes() - b'\\xbc\\x01\\x00\\x00\\x02' + b'\\xbc\\x01\\x02' """ bt = struct.pack(b'> 16) & 0xFF, - (self.index >> 8) & 0xFF, - (self.index >> 0) & 0xFF) + bt += MultiByteInt31(self.index).to_bytes() return bytes(bt) def __str__(self): @@ -391,13 +388,12 @@ def __str__(self): def parse(cls, fp): """ >>> from io import BytesIO - >>> fp = BytesIO(b'\\x01\\x00\\x00\\x02') + >>> fp = BytesIO(b'\\x01\\x02') >>> str(QNameDictionaryTextRecord.parse(fp)) 'b:Envelope' """ prefix = chr(struct.unpack(b'