1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

zlib: Use true / false instead of 1 / 0 when assigning to bool

Changes done with Coccinelle:

    @@
    bool b;
    @@

    - b = 0
    + b = false

    @@
    bool b;
    @@

    - b = 1
    + b = true
This commit is contained in:
Tim Düsterhus
2025-09-23 22:53:43 +02:00
committed by Tim Düsterhus
parent eddb0f5e8a
commit 4934355b6d
2 changed files with 7 additions and 7 deletions

View File

@@ -805,7 +805,7 @@ static bool zlib_create_dictionary_string(HashTable *options, char **dict, size_
case IS_ARRAY: {
HashTable *dictionary = Z_ARR_P(option_buffer);
bool result = 1;
bool result = true;
if (zend_hash_num_elements(dictionary) > 0) {
zend_string **strings = safe_emalloc(zend_hash_num_elements(dictionary), sizeof(zend_string *), 0);
@@ -815,18 +815,18 @@ static bool zlib_create_dictionary_string(HashTable *options, char **dict, size_
ZEND_HASH_FOREACH_VAL(dictionary, cur) {
zend_string *string = zval_try_get_string(cur);
if (string == NULL) {
result = 0;
result = false;
break;
}
*dictlen += ZSTR_LEN(string) + 1;
strings[total++] = string;
if (ZSTR_LEN(string) == 0) {
result = 0;
result = false;
zend_argument_value_error(2, "must not contain empty strings");
break;
}
if (zend_str_has_nul_byte(string)) {
result = 0;
result = false;
zend_argument_value_error(2, "must not contain strings with null bytes");
break;
}

View File

@@ -238,7 +238,7 @@ static php_stream_filter_status_t php_zlib_deflate_filter(
status = Z_OK;
while (status == Z_OK) {
status = deflate(&(data->strm), (flags & PSFS_FLAG_FLUSH_CLOSE ? Z_FINISH : Z_SYNC_FLUSH));
data->finished = 1;
data->finished = true;
if (data->strm.avail_out < data->outbuf_len) {
size_t bucketlen = data->outbuf_len - data->strm.avail_out;
@@ -335,7 +335,7 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f
}
/* RFC 1951 Inflate */
data->finished = '\0';
data->finished = false;
status = inflateInit2(&(data->strm), windowBits);
fops = &php_zlib_inflate_ops;
} else if (strcasecmp(filtername, "zlib.deflate") == 0) {
@@ -399,7 +399,7 @@ factory_setlevel:
}
}
status = deflateInit2(&(data->strm), level, Z_DEFLATED, windowBits, memLevel, 0);
data->finished = 1;
data->finished = true;
fops = &php_zlib_deflate_ops;
} else {
status = Z_DATA_ERROR;