Skip to content

Minor updates on types #19364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions main/fopen_wrappers.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
24 changes: 12 additions & 12 deletions main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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";
Expand All @@ -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)) {
Expand Down Expand Up @@ -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);
Expand All @@ -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;
}
}
}
Expand Down
7 changes: 2 additions & 5 deletions main/php_content_types.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
/* }}} */
4 changes: 2 additions & 2 deletions main/php_content_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
4 changes: 2 additions & 2 deletions main/rfc1867.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion main/streams/filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion main/streams/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion main/streams/php_stream_filter_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions main/streams/streams.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down