@@ -46,9 +46,14 @@ Z_BEST_SPEED = ISAL_BEST_SPEED
46
46
Z_BEST_COMPRESSION = ISAL_BEST_COMPRESSION
47
47
Z_DEFAULT_COMPRESSION = ISAL_DEFAULT_COMPRESSION
48
48
49
- DEF_BUF_SIZE = zlib.DEF_BUF_SIZE
50
- DEF_MEM_LEVEL = zlib.DEF_MEM_LEVEL
51
- cdef int DEF_MEM_LEVEL_I = zlib.DEF_MEM_LEVEL # Can not be manipulated by user.
49
+ # Compile time constants with _I (for integer suffix) as names without
50
+ # suffix should be exposed to the user.
51
+ DEF DEF_BUF_SIZE_I = 16 * 1024
52
+ DEF DEF_MEM_LEVEL_I = 8
53
+
54
+ # Expose compile-time constants. Same names as zlib.
55
+ DEF_BUF_SIZE = DEF_BUF_SIZE_I
56
+ DEF_MEM_LEVEL = DEF_MEM_LEVEL_I
52
57
MAX_WBITS = ISAL_DEF_MAX_HIST_BITS
53
58
ISAL_DEFAULT_HIST_BITS= 0
54
59
@@ -204,7 +209,7 @@ def compress(data,
204
209
& stream.gzip_flag)
205
210
206
211
# Initialise output buffer
207
- cdef Py_ssize_t bufsize = DEF_BUF_SIZE
212
+ cdef Py_ssize_t bufsize = DEF_BUF_SIZE_I
208
213
cdef unsigned char * obuf = NULL
209
214
210
215
# initialise input
@@ -422,7 +427,7 @@ cdef class Compress:
422
427
"""
423
428
# Initialise output buffer
424
429
cdef unsigned char * obuf = NULL
425
- cdef Py_ssize_t obuflen = DEF_BUF_SIZE
430
+ cdef Py_ssize_t obuflen = DEF_BUF_SIZE_I
426
431
427
432
# initialise input
428
433
cdef Py_buffer buffer_data
@@ -484,7 +489,7 @@ cdef class Compress:
484
489
else :
485
490
raise IsalError(" Unsupported flush mode" )
486
491
487
- cdef Py_ssize_t length = DEF_BUF_SIZE
492
+ cdef Py_ssize_t length = DEF_BUF_SIZE_I
488
493
cdef unsigned char * obuf = NULL
489
494
490
495
try :
@@ -613,7 +618,7 @@ cdef class Decompress:
613
618
614
619
# Initialise output buffer
615
620
cdef unsigned char * obuf = NULL
616
- cdef Py_ssize_t obuflen = DEF_BUF_SIZE
621
+ cdef Py_ssize_t obuflen = DEF_BUF_SIZE_I
617
622
if obuflen > hard_limit:
618
623
obuflen = hard_limit
619
624
0 commit comments