|
@@ -90,8 +90,8 @@ cdef class CompressorBase:
|
|
|
|
|
|
def decompress(self, data):
|
|
|
"""
|
|
|
- Decompress *data* (bytes) and return bytes result. The leading Compressor ID
|
|
|
- bytes need to be present.
|
|
|
+ Decompress *data* (preferably a memoryview, bytes also acceptable) and return bytes result.
|
|
|
+ The leading Compressor ID bytes need to be present.
|
|
|
|
|
|
Only handles input generated by _this_ Compressor - for a general purpose
|
|
|
decompression method see *Compressor.decompress*.
|
|
@@ -202,9 +202,9 @@ class LZ4(DecidingCompressor):
|
|
|
return NONE_COMPRESSOR, None
|
|
|
|
|
|
def decompress(self, idata):
|
|
|
+ idata = super().decompress(idata)
|
|
|
if not isinstance(idata, bytes):
|
|
|
idata = bytes(idata) # code below does not work with memoryview
|
|
|
- idata = super().decompress(idata)
|
|
|
cdef int isize = len(idata)
|
|
|
cdef int osize
|
|
|
cdef int rsize
|
|
@@ -304,9 +304,9 @@ class ZSTD(DecidingCompressor):
|
|
|
return NONE_COMPRESSOR, None
|
|
|
|
|
|
def decompress(self, idata):
|
|
|
+ idata = super().decompress(idata)
|
|
|
if not isinstance(idata, bytes):
|
|
|
idata = bytes(idata) # code below does not work with memoryview
|
|
|
- idata = super().decompress(idata)
|
|
|
cdef int isize = len(idata)
|
|
|
cdef unsigned long long osize
|
|
|
cdef unsigned long long rsize
|
|
@@ -489,8 +489,6 @@ class ObfuscateSize(CompressorBase):
|
|
|
return super().compress(obfuscated_data) # add ID header
|
|
|
|
|
|
def decompress(self, data):
|
|
|
- if not isinstance(data, memoryview):
|
|
|
- data = memoryview(data)
|
|
|
obfuscated_data = super().decompress(data) # remove obfuscator ID header
|
|
|
compr_size = self.header_fmt.unpack(obfuscated_data[0:self.header_len])[0]
|
|
|
compressed_data = obfuscated_data[self.header_len:self.header_len+compr_size]
|