修复了大量存在的问题,增加了假鸭子类型等等机制
This commit is contained in:
@@ -119,8 +119,8 @@ class zdeflate_stream:
|
||||
|
||||
|
||||
def write_dynamic_block(self, data: UINT8PTR, length: t.CSizeT, final: t.CInt):
|
||||
lit_freqs: list[t.CInt, 288]
|
||||
dist_freqs: list[t.CInt, 32]
|
||||
lit_freqs: t.CArray[t.CInt, 288]
|
||||
dist_freqs: t.CArray[t.CInt, 32]
|
||||
zdeflate_count_freqs(lit_freqs, dist_freqs, self, data, length)
|
||||
hlit: t.CInt = 286
|
||||
while hlit > 257 and lit_freqs[hlit - 1] == 0: hlit -= 1
|
||||
@@ -130,11 +130,11 @@ class zdeflate_stream:
|
||||
dist_tree = zhuff.zhuff_tree()
|
||||
lit_tree.build_codes(lit_freqs, hlit, zdef.ZDEFLATE_MAX_BITS)
|
||||
dist_tree.build_codes(dist_freqs, hdist, zdef.ZDEFLATE_MAX_BITS)
|
||||
all_lengths: list[t.CInt, 288 + 32]
|
||||
all_lengths: t.CArray[t.CInt, 288 + 32]
|
||||
for i in range(hlit): all_lengths[i] = lit_tree.codes[i].bits
|
||||
for i in range(hdist): all_lengths[hlit + i] = dist_tree.codes[i].bits
|
||||
total_lengths: t.CInt = hlit + hdist
|
||||
cl_freqs: list[t.CInt, 19]
|
||||
cl_freqs: t.CArray[t.CInt, 19]
|
||||
zdeflate_count_cl_freqs(all_lengths, total_lengths, cl_freqs)
|
||||
cl_tree = zhuff.zhuff_tree()
|
||||
cl_tree.build_codes(cl_freqs, 19, 7)
|
||||
|
||||
Reference in New Issue
Block a user