@@ -147,15 +147,15 @@ compress(BZ2Compressor *c, char *data, size_t len, int action)
147147 c -> bzs .next_in = data ;
148148 c -> bzs .avail_in = 0 ;
149149 c -> bzs .next_out = PyBytes_AS_STRING (result );
150- c -> bzs .avail_out = PyBytes_GET_SIZE ( result ) ;
150+ c -> bzs .avail_out = SMALLCHUNK ;
151151 for (;;) {
152152 char * this_out ;
153153 int bzerror ;
154154
155155 /* On a 64-bit system, len might not fit in avail_in (an unsigned int).
156156 Do compression in chunks of no more than UINT_MAX bytes each. */
157157 if (c -> bzs .avail_in == 0 && len > 0 ) {
158- c -> bzs .avail_in = Py_MIN (len , UINT_MAX );
158+ c -> bzs .avail_in = ( unsigned int ) Py_MIN (len , UINT_MAX );
159159 len -= c -> bzs .avail_in ;
160160 }
161161
@@ -171,7 +171,7 @@ compress(BZ2Compressor *c, char *data, size_t len, int action)
171171 c -> bzs .next_out = PyBytes_AS_STRING (result ) + data_size ;
172172 buffer_left = PyBytes_GET_SIZE (result ) - data_size ;
173173 }
174- c -> bzs .avail_out = Py_MIN (buffer_left , UINT_MAX );
174+ c -> bzs .avail_out = ( unsigned int ) Py_MIN (buffer_left , UINT_MAX );
175175 }
176176
177177 Py_BEGIN_ALLOW_THREADS
@@ -368,10 +368,10 @@ decompress(BZ2Decompressor *d, char *data, size_t len)
368368 d -> bzs .next_in = data ;
369369 /* On a 64-bit system, len might not fit in avail_in (an unsigned int).
370370 Do decompression in chunks of no more than UINT_MAX bytes each. */
371- d -> bzs .avail_in = Py_MIN (len , UINT_MAX );
371+ d -> bzs .avail_in = ( unsigned int ) Py_MIN (len , UINT_MAX );
372372 len -= d -> bzs .avail_in ;
373373 d -> bzs .next_out = PyBytes_AS_STRING (result );
374- d -> bzs .avail_out = PyBytes_GET_SIZE ( result ) ;
374+ d -> bzs .avail_out = SMALLCHUNK ;
375375 for (;;) {
376376 char * this_out ;
377377 int bzerror ;
@@ -397,7 +397,7 @@ decompress(BZ2Decompressor *d, char *data, size_t len)
397397 if (d -> bzs .avail_in == 0 ) {
398398 if (len == 0 )
399399 break ;
400- d -> bzs .avail_in = Py_MIN (len , UINT_MAX );
400+ d -> bzs .avail_in = ( unsigned int ) Py_MIN (len , UINT_MAX );
401401 len -= d -> bzs .avail_in ;
402402 }
403403 if (d -> bzs .avail_out == 0 ) {
@@ -408,7 +408,7 @@ decompress(BZ2Decompressor *d, char *data, size_t len)
408408 d -> bzs .next_out = PyBytes_AS_STRING (result ) + data_size ;
409409 buffer_left = PyBytes_GET_SIZE (result ) - data_size ;
410410 }
411- d -> bzs .avail_out = Py_MIN (buffer_left , UINT_MAX );
411+ d -> bzs .avail_out = ( unsigned int ) Py_MIN (buffer_left , UINT_MAX );
412412 }
413413 }
414414 if (data_size != PyBytes_GET_SIZE (result ))
0 commit comments