@@ -109,7 +109,7 @@ static void php_brotli_context_init(php_brotli_context *ctx)
109
109
}
110
110
111
111
static int php_brotli_context_create_encoder_ex (php_brotli_context * ctx ,
112
- long quality , int lgwin ,
112
+ long level , int lgwin ,
113
113
long mode , int fail )
114
114
{
115
115
ctx -> encoder = BrotliEncoderCreateInstance (NULL , NULL , NULL );
@@ -119,18 +119,18 @@ static int php_brotli_context_create_encoder_ex(php_brotli_context *ctx,
119
119
return FAILURE ;
120
120
}
121
121
122
- if (quality < BROTLI_MIN_QUALITY || quality > BROTLI_MAX_QUALITY ) {
122
+ if (level < BROTLI_MIN_QUALITY || level > BROTLI_MAX_QUALITY ) {
123
123
php_error_docref (NULL , E_WARNING ,
124
- "%s compression quality (%ld)%s:"
124
+ "%s compression level (%ld)%s:"
125
125
" must be within %d..%d" ,
126
126
(fail ? "failed to" : "brotli: set" ),
127
- (long )quality ,
127
+ (long )level ,
128
128
(fail ? "" : " to BROTLI_COMPRESS_LEVEL_DEFAULT" ),
129
129
BROTLI_MIN_QUALITY , BROTLI_MAX_QUALITY );
130
130
if (fail ) {
131
131
return FAILURE ;
132
132
}
133
- quality = BROTLI_DEFAULT_QUALITY ;
133
+ level = BROTLI_DEFAULT_QUALITY ;
134
134
}
135
135
if (lgwin == 0 ) {
136
136
lgwin = BROTLI_DEFAULT_WINDOW ;
@@ -152,7 +152,7 @@ static int php_brotli_context_create_encoder_ex(php_brotli_context *ctx,
152
152
mode = BROTLI_MODE_GENERIC ;
153
153
}
154
154
155
- if (!BrotliEncoderSetParameter (ctx -> encoder , BROTLI_PARAM_QUALITY , quality )
155
+ if (!BrotliEncoderSetParameter (ctx -> encoder , BROTLI_PARAM_QUALITY , level )
156
156
|| !BrotliEncoderSetParameter (ctx -> encoder , BROTLI_PARAM_LGWIN , lgwin )
157
157
|| !BrotliEncoderSetParameter (ctx -> encoder , BROTLI_PARAM_MODE , mode )) {
158
158
php_error_docref (NULL , E_WARNING ,
@@ -164,8 +164,8 @@ static int php_brotli_context_create_encoder_ex(php_brotli_context *ctx,
164
164
return SUCCESS ;
165
165
}
166
166
167
- #define php_brotli_context_create_encoder (ctx , quality , lgwin , mode ) \
168
- php_brotli_context_create_encoder_ex(ctx, quality , lgwin, mode, 0)
167
+ #define php_brotli_context_create_encoder (ctx , level , lgwin , mode ) \
168
+ php_brotli_context_create_encoder_ex(ctx, level , lgwin, mode, 0)
169
169
170
170
static int php_brotli_context_create_decoder (php_brotli_context * ctx )
171
171
{
@@ -228,7 +228,7 @@ static int php_brotli_output_encoding(void)
228
228
static int php_brotli_output_handler (void * * handler_context ,
229
229
php_output_context * output_context )
230
230
{
231
- long quality = BROTLI_DEFAULT_QUALITY ;
231
+ long level = BROTLI_DEFAULT_QUALITY ;
232
232
php_brotli_context * ctx = * (php_brotli_context * * )handler_context ;
233
233
234
234
if (!php_brotli_output_encoding ()) {
@@ -246,13 +246,13 @@ static int php_brotli_output_handler(void **handler_context,
246
246
return FAILURE ;
247
247
}
248
248
249
- quality = BROTLI_G (output_compression_level );
250
- if (quality < BROTLI_MIN_QUALITY || quality > BROTLI_MAX_QUALITY ) {
251
- quality = BROTLI_DEFAULT_QUALITY ;
249
+ level = BROTLI_G (output_compression_level );
250
+ if (level < BROTLI_MIN_QUALITY || level > BROTLI_MAX_QUALITY ) {
251
+ level = BROTLI_DEFAULT_QUALITY ;
252
252
}
253
253
254
254
if (output_context -> op & PHP_OUTPUT_HANDLER_START ) {
255
- if (php_brotli_context_create_encoder (ctx , quality , 0 , 0 ) != SUCCESS ) {
255
+ if (php_brotli_context_create_encoder (ctx , level , 0 , 0 ) != SUCCESS ) {
256
256
return FAILURE ;
257
257
}
258
258
}
@@ -325,7 +325,7 @@ static int php_brotli_output_handler(void **handler_context,
325
325
} else {
326
326
// restart
327
327
if (php_brotli_context_create_encoder (ctx ,
328
- quality , 0 , 0 ) != SUCCESS ) {
328
+ level , 0 , 0 ) != SUCCESS ) {
329
329
return FAILURE ;
330
330
}
331
331
}
@@ -1501,7 +1501,7 @@ static ZEND_FUNCTION(brotli_uncompress_add)
1501
1501
static int APC_SERIALIZER_NAME (brotli )(APC_SERIALIZER_ARGS )
1502
1502
{
1503
1503
int result ;
1504
- int lgwin = BROTLI_DEFAULT_WINDOW , quality = BROTLI_DEFAULT_QUALITY ;
1504
+ int lgwin = BROTLI_DEFAULT_WINDOW , level = BROTLI_DEFAULT_QUALITY ;
1505
1505
php_serialize_data_t var_hash ;
1506
1506
smart_str var = {0 };
1507
1507
BrotliEncoderMode mode = BROTLI_MODE_GENERIC ;
@@ -1516,7 +1516,7 @@ static int APC_SERIALIZER_NAME(brotli)(APC_SERIALIZER_ARGS)
1516
1516
* buf_len = BrotliEncoderMaxCompressedSize (ZSTR_LEN (var .s ));
1517
1517
* buf = (char * ) emalloc (* buf_len );
1518
1518
1519
- if (!BrotliEncoderCompress (quality , lgwin , mode ,
1519
+ if (!BrotliEncoderCompress (level , lgwin , mode ,
1520
1520
ZSTR_LEN (var .s ),
1521
1521
(const uint8_t * ) ZSTR_VAL (var .s ),
1522
1522
buf_len , (uint8_t * ) * buf )) {
0 commit comments