diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index fc0dbb9a984e..b01ae2d5045e 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -541,14 +541,14 @@ PHPAPI zend_string *php_resolve_path(const char *filename, size_t filename_lengt ptr = path; while (ptr && *ptr) { /* Check for stream wrapper */ - int is_stream_wrapper = 0; + bool is_stream_wrapper = false; for (p = ptr; isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'; p++); if ((*p == ':') && (p - ptr > 1) && (p[1] == '/') && (p[2] == '/')) { /* .:// or ..:// is not a stream wrapper */ if (p[-1] != '.' || p[-2] != '.' || p - 2 != ptr) { p += 3; - is_stream_wrapper = 1; + is_stream_wrapper = true; } } end = strchr(p, DEFAULT_DIR_SEPARATOR); diff --git a/main/main.c b/main/main.c index 04715d1916ee..6d86ac09efbd 100644 --- a/main/main.c +++ b/main/main.c @@ -1010,10 +1010,10 @@ PHPAPI ZEND_COLD void php_verror(const char *docref, const char *params, int typ const char *space = ""; const char *class_name = ""; const char *function; - int origin_len; + size_t origin_len; char *origin; zend_string *message; - int is_function = 0; + bool is_function = false; /* get error text into buffer and escape for html if necessary */ 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 switch (EG(current_execute_data)->opline->extended_value) { case ZEND_EVAL: function = "eval"; - is_function = 1; + is_function = true; break; case ZEND_INCLUDE: function = "include"; - is_function = 1; + is_function = true; break; case ZEND_INCLUDE_ONCE: function = "include_once"; - is_function = 1; + is_function = true; break; case ZEND_REQUIRE: function = "require"; - is_function = 1; + is_function = true; break; case ZEND_REQUIRE_ONCE: function = "require_once"; - is_function = 1; + is_function = true; break; default: function = "Unknown"; @@ -1077,9 +1077,9 @@ PHPAPI ZEND_COLD void php_verror(const char *docref, const char *params, int typ /* if we still have memory then format the origin */ if (is_function) { - origin_len = (int)spprintf(&origin, 0, "%s%s%s(%s)", class_name, space, function, params); + origin_len = spprintf(&origin, 0, "%s%s%s(%s)", class_name, space, function, params); } else { - origin_len = (int)spprintf(&origin, 0, "%s", function); + origin_len = spprintf(&origin, 0, "%s", function); } if (PG(html_errors)) { @@ -2093,13 +2093,13 @@ void dummy_invalid_parameter_handler( unsigned int line, uintptr_t pReserved) { - static int called = 0; + static bool called = false; char buf[1024]; int len; if (!called) { if(PG(windows_show_crt_warning)) { - called = 1; + called = true; if (function) { if (file) { 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( len = _snprintf(buf, sizeof(buf)-1, "Invalid CRT parameter detected (function not known)"); } zend_error(E_WARNING, "%s", buf); - called = 0; + called = false; } } } diff --git a/main/php_content_types.c b/main/php_content_types.c index f01841986728..a481906a2c03 100644 --- a/main/php_content_types.c +++ b/main/php_content_types.c @@ -41,20 +41,17 @@ SAPI_API SAPI_POST_READER_FUNC(php_default_post_reader) /* }}} */ /* {{{ php_startup_sapi_content_types */ -int php_startup_sapi_content_types(void) +void php_startup_sapi_content_types(void) { sapi_register_default_post_reader(php_default_post_reader); sapi_register_treat_data(php_default_treat_data); sapi_register_input_filter(php_default_input_filter, NULL); - return SUCCESS; } /* }}} */ /* {{{ php_setup_sapi_content_types */ -int php_setup_sapi_content_types(void) +void php_setup_sapi_content_types(void) { sapi_register_post_entries(php_post_entries); - - return SUCCESS; } /* }}} */ diff --git a/main/php_content_types.h b/main/php_content_types.h index 6aab33e29421..261985c3ac01 100644 --- a/main/php_content_types.h +++ b/main/php_content_types.h @@ -21,7 +21,7 @@ SAPI_API SAPI_POST_READER_FUNC(php_default_post_reader); SAPI_API SAPI_POST_HANDLER_FUNC(php_std_post_handler); -int php_startup_sapi_content_types(void); -int php_setup_sapi_content_types(void); +void php_startup_sapi_content_types(void); +void php_setup_sapi_content_types(void); #endif /* PHP_CONTENT_TYPES_H */ diff --git a/main/rfc1867.c b/main/rfc1867.c index 84b8788bbf7c..cf234a2276dc 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -1214,7 +1214,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) { zval file_size, error_type; - int size_overflow = 0; + bool size_overflow = false; char file_size_buf[65]; ZVAL_LONG(&error_type, cancel_upload); @@ -1235,7 +1235,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) file_size_buf[__len] = '\0'; } #endif - size_overflow = 1; + size_overflow = true; } else { ZVAL_LONG(&file_size, total_bytes); diff --git a/main/streams/filter.c b/main/streams/filter.c index abfc5c26ae12..276fcc94a9a1 100644 --- a/main/streams/filter.c +++ b/main/streams/filter.c @@ -70,7 +70,7 @@ PHPAPI int php_stream_filter_register_factory_volatile(zend_string *filterpatter PHPAPI php_stream_bucket *php_stream_bucket_new(php_stream *stream, char *buf, size_t buflen, uint8_t own_buf, uint8_t buf_persistent) { - int is_persistent = php_stream_is_persistent(stream); + bool is_persistent = php_stream_is_persistent(stream); php_stream_bucket *bucket; bucket = (php_stream_bucket*)pemalloc(sizeof(php_stream_bucket), is_persistent); diff --git a/main/streams/memory.c b/main/streams/memory.c index 785109db6582..f0fb6579eb13 100644 --- a/main/streams/memory.c +++ b/main/streams/memory.c @@ -619,7 +619,7 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con size_t mlen, dlen, plen, vlen, ilen; zend_off_t newoffs; zval meta; - int base64 = 0; + bool base64 = false; zend_string *base64_comma = NULL; ZEND_ASSERT(mode); diff --git a/main/streams/php_stream_filter_api.h b/main/streams/php_stream_filter_api.h index ee6ab75f38c2..b982c8226468 100644 --- a/main/streams/php_stream_filter_api.h +++ b/main/streams/php_stream_filter_api.h @@ -45,7 +45,7 @@ struct _php_stream_bucket { size_t buflen; /* if non-zero, buf should be pefreed when the bucket is destroyed */ uint8_t own_buf; - uint8_t is_persistent; + bool is_persistent; /* destroy this struct when refcount falls to zero */ int refcount; diff --git a/main/streams/streams.c b/main/streams/streams.c index 2eef790863f6..8df481b20a5f 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -2023,16 +2023,16 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const php_stream_wrapper *plain_files_wrapper = (php_stream_wrapper*)&php_plain_files_wrapper; if (protocol) { - int localhost = 0; + bool localhost = false; if (!strncasecmp(path, "file://localhost/", 17)) { - localhost = 1; + localhost = true; } #ifdef PHP_WIN32 if (localhost == 0 && path[n+3] != '\0' && path[n+3] != '/' && path[n+4] != ':') { #else - if (localhost == 0 && path[n+3] != '\0' && path[n+3] != '/') { + if (localhost == false && path[n+3] != '\0' && path[n+3] != '/') { #endif if (options & REPORT_ERRORS) { php_error_docref(NULL, E_WARNING, "Remote host file access not supported, %s", path);