Skip to content

Commit

Permalink
Fix encoding error
Browse files Browse the repository at this point in the history
  • Loading branch information
kusakata authored and tats committed Feb 19, 2021
1 parent 132f207 commit 66d7a43
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions skk2cdb.py
Expand Up @@ -31,14 +31,14 @@ def decode(x):
return a
def encode(a):
a.byteswap()
return str(a)
return a
else:
# little endian
def decode(x):
a = array('I', x)
return a
def encode(a):
return str(a)
return a


## CDB
Expand Down Expand Up @@ -205,15 +205,15 @@ def finish(self):
i = (i+2) % len(a)
a[i] = h
a[i+1] = p
self._fp.write(encode(a).encode())
self._fp.write(encode(a))
# write header
self._fp.seek(0)
a = array('I')
for b1 in self._bucket:
a.append(pos_hash)
a.append(len(b1))
pos_hash += len(b1)*8
self._fp.write(encode(a).encode())
self._fp.write(encode(a))
# close
self._fp.close()
os.rename(self.fntmp, self.fn)
Expand Down

0 comments on commit 66d7a43

Please sign in to comment.