Skip to content

Commit 573fac9

Browse files
Minor updates on types
1 parent 98e0dbc commit 573fac9

File tree

9 files changed

+26
-29
lines changed

9 files changed

+26
-29
lines changed

main/fopen_wrappers.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,14 +541,14 @@ PHPAPI zend_string *php_resolve_path(const char *filename, size_t filename_lengt
541541
ptr = path;
542542
while (ptr && *ptr) {
543543
/* Check for stream wrapper */
544-
int is_stream_wrapper = 0;
544+
bool is_stream_wrapper = false;
545545

546546
for (p = ptr; isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'; p++);
547547
if ((*p == ':') && (p - ptr > 1) && (p[1] == '/') && (p[2] == '/')) {
548548
/* .:// or ..:// is not a stream wrapper */
549549
if (p[-1] != '.' || p[-2] != '.' || p - 2 != ptr) {
550550
p += 3;
551-
is_stream_wrapper = 1;
551+
is_stream_wrapper = true;
552552
}
553553
}
554554
end = strchr(p, DEFAULT_DIR_SEPARATOR);

main/main.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,10 +1010,10 @@ PHPAPI ZEND_COLD void php_verror(const char *docref, const char *params, int typ
10101010
const char *space = "";
10111011
const char *class_name = "";
10121012
const char *function;
1013-
int origin_len;
1013+
size_t origin_len;
10141014
char *origin;
10151015
zend_string *message;
1016-
int is_function = 0;
1016+
bool is_function = false;
10171017

10181018
/* get error text into buffer and escape for html if necessary */
10191019
zend_string *buffer = vstrpprintf(0, format, args);
@@ -1045,23 +1045,23 @@ PHPAPI ZEND_COLD void php_verror(const char *docref, const char *params, int typ
10451045
switch (EG(current_execute_data)->opline->extended_value) {
10461046
case ZEND_EVAL:
10471047
function = "eval";
1048-
is_function = 1;
1048+
is_function = true;
10491049
break;
10501050
case ZEND_INCLUDE:
10511051
function = "include";
1052-
is_function = 1;
1052+
is_function = true;
10531053
break;
10541054
case ZEND_INCLUDE_ONCE:
10551055
function = "include_once";
1056-
is_function = 1;
1056+
is_function = true;
10571057
break;
10581058
case ZEND_REQUIRE:
10591059
function = "require";
1060-
is_function = 1;
1060+
is_function = true;
10611061
break;
10621062
case ZEND_REQUIRE_ONCE:
10631063
function = "require_once";
1064-
is_function = 1;
1064+
is_function = true;
10651065
break;
10661066
default:
10671067
function = "Unknown";
@@ -1077,9 +1077,9 @@ PHPAPI ZEND_COLD void php_verror(const char *docref, const char *params, int typ
10771077

10781078
/* if we still have memory then format the origin */
10791079
if (is_function) {
1080-
origin_len = (int)spprintf(&origin, 0, "%s%s%s(%s)", class_name, space, function, params);
1080+
origin_len = spprintf(&origin, 0, "%s%s%s(%s)", class_name, space, function, params);
10811081
} else {
1082-
origin_len = (int)spprintf(&origin, 0, "%s", function);
1082+
origin_len = spprintf(&origin, 0, "%s", function);
10831083
}
10841084

10851085
if (PG(html_errors)) {
@@ -2093,13 +2093,13 @@ void dummy_invalid_parameter_handler(
20932093
unsigned int line,
20942094
uintptr_t pReserved)
20952095
{
2096-
static int called = 0;
2096+
static bool called = false;
20972097
char buf[1024];
20982098
int len;
20992099

21002100
if (!called) {
21012101
if(PG(windows_show_crt_warning)) {
2102-
called = 1;
2102+
called = true;
21032103
if (function) {
21042104
if (file) {
21052105
len = _snprintf(buf, sizeof(buf)-1, "Invalid parameter detected in CRT function '%ws' (%ws:%u)", function, file, line);
@@ -2110,7 +2110,7 @@ void dummy_invalid_parameter_handler(
21102110
len = _snprintf(buf, sizeof(buf)-1, "Invalid CRT parameter detected (function not known)");
21112111
}
21122112
zend_error(E_WARNING, "%s", buf);
2113-
called = 0;
2113+
called = false;
21142114
}
21152115
}
21162116
}

main/php_content_types.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,17 @@ SAPI_API SAPI_POST_READER_FUNC(php_default_post_reader)
4141
/* }}} */
4242

4343
/* {{{ php_startup_sapi_content_types */
44-
int php_startup_sapi_content_types(void)
44+
void php_startup_sapi_content_types(void)
4545
{
4646
sapi_register_default_post_reader(php_default_post_reader);
4747
sapi_register_treat_data(php_default_treat_data);
4848
sapi_register_input_filter(php_default_input_filter, NULL);
49-
return SUCCESS;
5049
}
5150
/* }}} */
5251

5352
/* {{{ php_setup_sapi_content_types */
54-
int php_setup_sapi_content_types(void)
53+
void php_setup_sapi_content_types(void)
5554
{
5655
sapi_register_post_entries(php_post_entries);
57-
58-
return SUCCESS;
5956
}
6057
/* }}} */

main/php_content_types.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
SAPI_API SAPI_POST_READER_FUNC(php_default_post_reader);
2323
SAPI_API SAPI_POST_HANDLER_FUNC(php_std_post_handler);
24-
int php_startup_sapi_content_types(void);
25-
int php_setup_sapi_content_types(void);
24+
void php_startup_sapi_content_types(void);
25+
void php_setup_sapi_content_types(void);
2626

2727
#endif /* PHP_CONTENT_TYPES_H */

main/rfc1867.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler)
12141214

12151215
{
12161216
zval file_size, error_type;
1217-
int size_overflow = 0;
1217+
bool size_overflow = false;
12181218
char file_size_buf[65];
12191219

12201220
ZVAL_LONG(&error_type, cancel_upload);
@@ -1235,7 +1235,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler)
12351235
file_size_buf[__len] = '\0';
12361236
}
12371237
#endif
1238-
size_overflow = 1;
1238+
size_overflow = true;
12391239

12401240
} else {
12411241
ZVAL_LONG(&file_size, total_bytes);

main/streams/filter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ PHPAPI int php_stream_filter_register_factory_volatile(zend_string *filterpatter
7070

7171
PHPAPI php_stream_bucket *php_stream_bucket_new(php_stream *stream, char *buf, size_t buflen, uint8_t own_buf, uint8_t buf_persistent)
7272
{
73-
int is_persistent = php_stream_is_persistent(stream);
73+
bool is_persistent = php_stream_is_persistent(stream);
7474
php_stream_bucket *bucket;
7575

7676
bucket = (php_stream_bucket*)pemalloc(sizeof(php_stream_bucket), is_persistent);

main/streams/memory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con
619619
size_t mlen, dlen, plen, vlen, ilen;
620620
zend_off_t newoffs;
621621
zval meta;
622-
int base64 = 0;
622+
bool base64 = false;
623623
zend_string *base64_comma = NULL;
624624

625625
ZEND_ASSERT(mode);

main/streams/php_stream_filter_api.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct _php_stream_bucket {
4545
size_t buflen;
4646
/* if non-zero, buf should be pefreed when the bucket is destroyed */
4747
uint8_t own_buf;
48-
uint8_t is_persistent;
48+
bool is_persistent;
4949

5050
/* destroy this struct when refcount falls to zero */
5151
int refcount;

main/streams/streams.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2023,16 +2023,16 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const
20232023
php_stream_wrapper *plain_files_wrapper = (php_stream_wrapper*)&php_plain_files_wrapper;
20242024

20252025
if (protocol) {
2026-
int localhost = 0;
2026+
bool localhost = false;
20272027

20282028
if (!strncasecmp(path, "file://localhost/", 17)) {
2029-
localhost = 1;
2029+
localhost = true;
20302030
}
20312031

20322032
#ifdef PHP_WIN32
20332033
if (localhost == 0 && path[n+3] != '\0' && path[n+3] != '/' && path[n+4] != ':') {
20342034
#else
2035-
if (localhost == 0 && path[n+3] != '\0' && path[n+3] != '/') {
2035+
if (localhost == false && path[n+3] != '\0' && path[n+3] != '/') {
20362036
#endif
20372037
if (options & REPORT_ERRORS) {
20382038
php_error_docref(NULL, E_WARNING, "Remote host file access not supported, %s", path);

0 commit comments

Comments
 (0)