18
18
/* On success, return value >= 0
19
19
On failure, return -1 */
20
20
static inline Py_ssize_t
21
- Buffer_InitAndGrow (_BlocksOutputBuffer * buffer , Py_ssize_t max_length ,
22
- char * * next_out , uint32_t * avail_out )
21
+ OutputBuffer_InitAndGrow (_BlocksOutputBuffer * buffer , Py_ssize_t max_length ,
22
+ char * * next_out , uint32_t * avail_out )
23
23
{
24
24
Py_ssize_t allocated ;
25
25
@@ -32,8 +32,8 @@ Buffer_InitAndGrow(_BlocksOutputBuffer *buffer, Py_ssize_t max_length,
32
32
/* On success, return value >= 0
33
33
On failure, return -1 */
34
34
static inline Py_ssize_t
35
- Buffer_Grow (_BlocksOutputBuffer * buffer ,
36
- char * * next_out , uint32_t * avail_out )
35
+ OutputBuffer_Grow (_BlocksOutputBuffer * buffer ,
36
+ char * * next_out , uint32_t * avail_out )
37
37
{
38
38
Py_ssize_t allocated ;
39
39
@@ -44,19 +44,19 @@ Buffer_Grow(_BlocksOutputBuffer *buffer,
44
44
}
45
45
46
46
static inline Py_ssize_t
47
- Buffer_GetDataSize (_BlocksOutputBuffer * buffer , uint32_t avail_out )
47
+ OutputBuffer_GetDataSize (_BlocksOutputBuffer * buffer , uint32_t avail_out )
48
48
{
49
49
return _BlocksOutputBuffer_GetDataSize (buffer , (Py_ssize_t ) avail_out );
50
50
}
51
51
52
52
static inline PyObject *
53
- Buffer_Finish (_BlocksOutputBuffer * buffer , uint32_t avail_out )
53
+ OutputBuffer_Finish (_BlocksOutputBuffer * buffer , uint32_t avail_out )
54
54
{
55
55
return _BlocksOutputBuffer_Finish (buffer , (Py_ssize_t ) avail_out );
56
56
}
57
57
58
58
static inline void
59
- Buffer_OnError (_BlocksOutputBuffer * buffer )
59
+ OutputBuffer_OnError (_BlocksOutputBuffer * buffer )
60
60
{
61
61
_BlocksOutputBuffer_OnError (buffer );
62
62
}
@@ -177,7 +177,7 @@ compress(BZ2Compressor *c, char *data, size_t len, int action)
177
177
PyObject * result ;
178
178
_BlocksOutputBuffer buffer = {.list = NULL };
179
179
180
- if (Buffer_InitAndGrow (& buffer , -1 , & c -> bzs .next_out , & c -> bzs .avail_out ) < 0 ) {
180
+ if (OutputBuffer_InitAndGrow (& buffer , -1 , & c -> bzs .next_out , & c -> bzs .avail_out ) < 0 ) {
181
181
goto error ;
182
182
}
183
183
c -> bzs .next_in = data ;
@@ -198,7 +198,7 @@ compress(BZ2Compressor *c, char *data, size_t len, int action)
198
198
break ;
199
199
200
200
if (c -> bzs .avail_out == 0 ) {
201
- if (Buffer_Grow (& buffer , & c -> bzs .next_out , & c -> bzs .avail_out ) < 0 ) {
201
+ if (OutputBuffer_Grow (& buffer , & c -> bzs .next_out , & c -> bzs .avail_out ) < 0 ) {
202
202
goto error ;
203
203
}
204
204
}
@@ -215,13 +215,13 @@ compress(BZ2Compressor *c, char *data, size_t len, int action)
215
215
break ;
216
216
}
217
217
218
- result = Buffer_Finish (& buffer , c -> bzs .avail_out );
218
+ result = OutputBuffer_Finish (& buffer , c -> bzs .avail_out );
219
219
if (result != NULL ) {
220
220
return result ;
221
221
}
222
222
223
223
error :
224
- Buffer_OnError (& buffer );
224
+ OutputBuffer_OnError (& buffer );
225
225
return NULL ;
226
226
}
227
227
@@ -442,7 +442,7 @@ decompress_buf(BZ2Decompressor *d, Py_ssize_t max_length)
442
442
_BlocksOutputBuffer buffer = {.list = NULL };
443
443
bz_stream * bzs = & d -> bzs ;
444
444
445
- if (Buffer_InitAndGrow (& buffer , max_length , & bzs -> next_out , & bzs -> avail_out ) < 0 ) {
445
+ if (OutputBuffer_InitAndGrow (& buffer , max_length , & bzs -> next_out , & bzs -> avail_out ) < 0 ) {
446
446
goto error ;
447
447
}
448
448
@@ -469,21 +469,22 @@ decompress_buf(BZ2Decompressor *d, Py_ssize_t max_length)
469
469
} else if (d -> bzs_avail_in_real == 0 ) {
470
470
break ;
471
471
} else if (bzs -> avail_out == 0 ) {
472
- if (Buffer_GetDataSize (& buffer , bzs -> avail_out ) == max_length )
472
+ if (OutputBuffer_GetDataSize (& buffer , bzs -> avail_out ) == max_length ) {
473
473
break ;
474
- if (Buffer_Grow (& buffer , & bzs -> next_out , & bzs -> avail_out ) < 0 ) {
474
+ }
475
+ if (OutputBuffer_Grow (& buffer , & bzs -> next_out , & bzs -> avail_out ) < 0 ) {
475
476
goto error ;
476
477
}
477
478
}
478
479
}
479
480
480
- result = Buffer_Finish (& buffer , bzs -> avail_out );
481
+ result = OutputBuffer_Finish (& buffer , bzs -> avail_out );
481
482
if (result != NULL ) {
482
483
return result ;
483
484
}
484
485
485
486
error :
486
- Buffer_OnError (& buffer );
487
+ OutputBuffer_OnError (& buffer );
487
488
return NULL ;
488
489
}
489
490
0 commit comments