[wesnoth_addon_manager] Speedup writing files to disk *a lot* :)
This commit is contained in:
parent
ed83c6b888
commit
b742542b37
1 changed files with 10 additions and 10 deletions
|
@ -180,17 +180,17 @@ class CampaignClient:
|
|||
return data
|
||||
|
||||
def unescape(self, data):
|
||||
data2 = bytearray()
|
||||
# 01 is used as escape character
|
||||
data2 = b""
|
||||
escape = False
|
||||
for c in data:
|
||||
if escape:
|
||||
data2 += bytes([c - 1])
|
||||
escape = False
|
||||
elif c == 1:
|
||||
escape = True
|
||||
else:
|
||||
data2 += bytes([c])
|
||||
pos = 0
|
||||
while True:
|
||||
i = data.find(b"\x01", pos)
|
||||
if i < 0:
|
||||
break
|
||||
data2 += data[pos:i]
|
||||
data2 += bytes([data[i + 1] - 1])
|
||||
pos = i + 2
|
||||
data2 += data[pos:]
|
||||
return data2
|
||||
|
||||
def decode_WML(self, data):
|
||||
|
|
Loading…
Add table
Reference in a new issue