mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-28 03:13:18 +00:00
[wesnoth_addon_manager] Speedup writing files to disk *a lot* :)
This commit is contained in:
parent
ed83c6b888
commit
b742542b37
@ -180,17 +180,17 @@ class CampaignClient:
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
def unescape(self, data):
|
def unescape(self, data):
|
||||||
|
data2 = bytearray()
|
||||||
# 01 is used as escape character
|
# 01 is used as escape character
|
||||||
data2 = b""
|
pos = 0
|
||||||
escape = False
|
while True:
|
||||||
for c in data:
|
i = data.find(b"\x01", pos)
|
||||||
if escape:
|
if i < 0:
|
||||||
data2 += bytes([c - 1])
|
break
|
||||||
escape = False
|
data2 += data[pos:i]
|
||||||
elif c == 1:
|
data2 += bytes([data[i + 1] - 1])
|
||||||
escape = True
|
pos = i + 2
|
||||||
else:
|
data2 += data[pos:]
|
||||||
data2 += bytes([c])
|
|
||||||
return data2
|
return data2
|
||||||
|
|
||||||
def decode_WML(self, data):
|
def decode_WML(self, data):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user