@@ -149,10 +149,10 @@ grow_buffer(PyObject **buf, Py_ssize_t max_length)
149
149
{
150
150
Py_ssize_t size = PyBytes_GET_SIZE (* buf );
151
151
Py_ssize_t newsize = size + (size >> 3 ) + 6 ;
152
-
152
+
153
153
if (max_length > 0 && newsize > max_length )
154
154
newsize = max_length ;
155
-
155
+
156
156
return _PyBytes_Resize (buf , newsize );
157
157
}
158
158
@@ -906,7 +906,7 @@ decompress_buf(Decompressor *d, Py_ssize_t max_length)
906
906
Py_ssize_t data_size = 0 ;
907
907
PyObject * result ;
908
908
lzma_stream * lzs = & d -> lzs ;
909
-
909
+
910
910
if (max_length < 0 || max_length >= INITIAL_BUFFER_SIZE )
911
911
result = PyBytes_FromStringAndSize (NULL , INITIAL_BUFFER_SIZE );
912
912
else
@@ -916,7 +916,7 @@ decompress_buf(Decompressor *d, Py_ssize_t max_length)
916
916
917
917
lzs -> next_out = (uint8_t * )PyBytes_AS_STRING (result );
918
918
lzs -> avail_out = PyBytes_GET_SIZE (result );
919
-
919
+
920
920
for (;;) {
921
921
lzma_ret lzret ;
922
922
@@ -947,7 +947,7 @@ decompress_buf(Decompressor *d, Py_ssize_t max_length)
947
947
goto error ;
948
948
949
949
return result ;
950
-
950
+
951
951
error :
952
952
Py_XDECREF (result );
953
953
return NULL ;
@@ -959,11 +959,11 @@ decompress(Decompressor *d, uint8_t *data, size_t len, Py_ssize_t max_length)
959
959
char input_buffer_in_use ;
960
960
PyObject * result ;
961
961
lzma_stream * lzs = & d -> lzs ;
962
-
962
+
963
963
/* Prepend unconsumed input if necessary */
964
964
if (lzs -> next_in != NULL ) {
965
965
size_t avail_now , avail_total ;
966
-
966
+
967
967
/* Number of bytes we can append to input buffer */
968
968
avail_now = (d -> input_buffer + d -> input_buffer_size )
969
969
- (lzs -> next_in + lzs -> avail_in );
@@ -987,7 +987,7 @@ decompress(Decompressor *d, uint8_t *data, size_t len, Py_ssize_t max_length)
987
987
}
988
988
d -> input_buffer = tmp ;
989
989
d -> input_buffer_size = new_size ;
990
-
990
+
991
991
lzs -> next_in = d -> input_buffer + offset ;
992
992
}
993
993
else if (avail_now < len ) {
@@ -1054,7 +1054,7 @@ decompress(Decompressor *d, uint8_t *data, size_t len, Py_ssize_t max_length)
1054
1054
lzs -> next_in = d -> input_buffer ;
1055
1055
}
1056
1056
}
1057
-
1057
+
1058
1058
return result ;
1059
1059
1060
1060
error :
@@ -1247,7 +1247,7 @@ Decompressor_dealloc(Decompressor *self)
1247
1247
{
1248
1248
if (self -> input_buffer != NULL )
1249
1249
PyMem_Free (self -> input_buffer );
1250
-
1250
+
1251
1251
lzma_end (& self -> lzs );
1252
1252
Py_CLEAR (self -> unused_data );
1253
1253
#ifdef WITH_THREAD
0 commit comments