mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
Fixed compilation warnings
This commit is contained in:
parent
4ac29543d6
commit
adc95c5114
36 changed files with 109 additions and 102 deletions
|
@ -620,7 +620,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, connect)(MYSQLND_CONN_DATA * conn,
|
||||||
|
|
||||||
DBG_INF_FMT("host=%s user=%s db=%s port=%u flags=%u persistent=%u state=%u",
|
DBG_INF_FMT("host=%s user=%s db=%s port=%u flags=%u persistent=%u state=%u",
|
||||||
hostname.s?hostname.s:"", username.s?username.s:"", database.s?database.s:"", port, mysql_flags,
|
hostname.s?hostname.s:"", username.s?username.s:"", database.s?database.s:"", port, mysql_flags,
|
||||||
conn? conn->persistent:0, conn? GET_CONNECTION_STATE(&conn->state):-1);
|
conn? conn->persistent:0, conn? (int)GET_CONNECTION_STATE(&conn->state):-1);
|
||||||
|
|
||||||
if (GET_CONNECTION_STATE(&conn->state) > CONN_ALLOCED) {
|
if (GET_CONNECTION_STATE(&conn->state) > CONN_ALLOCED) {
|
||||||
DBG_INF("Connecting on a connected handle.");
|
DBG_INF("Connecting on a connected handle.");
|
||||||
|
|
|
@ -60,6 +60,7 @@ static struct st_mysqlnd_typeii_plugin_example mysqlnd_example_plugin =
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
NULL, /* methods */
|
NULL, /* methods */
|
||||||
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,7 @@ ps_fetch_float(zval * zv, const MYSQLND_FIELD * const field, const unsigned int
|
||||||
# define NOT_FIXED_DEC 31
|
# define NOT_FIXED_DEC 31
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dval = mysql_float_to_double(fval, (field->decimals >= NOT_FIXED_DEC) ? -1 : field->decimals);
|
dval = mysql_float_to_double(fval, (field->decimals >= NOT_FIXED_DEC) ? -1 : (int)field->decimals);
|
||||||
|
|
||||||
ZVAL_DOUBLE(zv, dval);
|
ZVAL_DOUBLE(zv, dval);
|
||||||
DBG_VOID_RETURN;
|
DBG_VOID_RETURN;
|
||||||
|
|
|
@ -1611,7 +1611,7 @@ php_mysqlnd_rowp_read_binary_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, zv
|
||||||
MYSQLND_INC_CONN_STATISTIC_W_VALUE2(stats, statistic, 1,
|
MYSQLND_INC_CONN_STATISTIC_W_VALUE2(stats, statistic, 1,
|
||||||
STAT_BYTES_RECEIVED_PURE_DATA_PS,
|
STAT_BYTES_RECEIVED_PURE_DATA_PS,
|
||||||
(Z_TYPE_P(current_field) == IS_STRING)?
|
(Z_TYPE_P(current_field) == IS_STRING)?
|
||||||
Z_STRLEN_P(current_field) : (p - orig_p));
|
Z_STRLEN_P(current_field) : (size_t)(p - orig_p));
|
||||||
|
|
||||||
if (!((bit<<=1) & 255)) {
|
if (!((bit<<=1) & 255)) {
|
||||||
bit = 1; /* to the following byte */
|
bit = 1; /* to the following byte */
|
||||||
|
|
|
@ -6528,7 +6528,7 @@ PHP_FUNCTION(pg_convert)
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
static int do_exec(smart_str *querystr, int expect, PGconn *pg_link, zend_ulong opt) /* {{{ */
|
static int do_exec(smart_str *querystr, ExecStatusType expect, PGconn *pg_link, zend_ulong opt) /* {{{ */
|
||||||
{
|
{
|
||||||
if (opt & PGSQL_DML_ASYNC) {
|
if (opt & PGSQL_DML_ASYNC) {
|
||||||
if (PQsendQuery(pg_link, ZSTR_VAL(querystr->s))) {
|
if (PQsendQuery(pg_link, ZSTR_VAL(querystr->s))) {
|
||||||
|
|
|
@ -1030,7 +1030,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
|
||||||
PHAR_GET_32(buffer, len);
|
PHAR_GET_32(buffer, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(len > endbuffer - buffer) {
|
if(len > (size_t)(endbuffer - buffer)) {
|
||||||
MAPPHAR_FAIL("internal corruption of phar \"%s\" (trying to read past buffer end)");
|
MAPPHAR_FAIL("internal corruption of phar \"%s\" (trying to read past buffer end)");
|
||||||
}
|
}
|
||||||
if (phar_parse_metadata(&buffer, &mydata->metadata, len) == FAILURE) {
|
if (phar_parse_metadata(&buffer, &mydata->metadata, len) == FAILURE) {
|
||||||
|
@ -1071,7 +1071,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
|
||||||
entry.manifest_pos = manifest_index;
|
entry.manifest_pos = manifest_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry.filename_len + 20 > endbuffer - buffer) {
|
if (entry.filename_len + 20 > (size_t)(endbuffer - buffer)) {
|
||||||
MAPPHAR_FAIL("internal corruption of phar \"%s\" (truncated manifest entry)");
|
MAPPHAR_FAIL("internal corruption of phar \"%s\" (truncated manifest entry)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1113,7 +1113,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
|
||||||
} else {
|
} else {
|
||||||
entry.metadata_len = 0;
|
entry.metadata_len = 0;
|
||||||
}
|
}
|
||||||
if (len > endbuffer - buffer) {
|
if (len > (size_t)(endbuffer - buffer)) {
|
||||||
pefree(entry.filename, entry.is_persistent);
|
pefree(entry.filename, entry.is_persistent);
|
||||||
MAPPHAR_FAIL("internal corruption of phar \"%s\" (truncated manifest entry)");
|
MAPPHAR_FAIL("internal corruption of phar \"%s\" (truncated manifest entry)");
|
||||||
}
|
}
|
||||||
|
|
|
@ -305,7 +305,7 @@ PHP_FUNCTION(shmop_size)
|
||||||
PHP_FUNCTION(shmop_write)
|
PHP_FUNCTION(shmop_write)
|
||||||
{
|
{
|
||||||
struct php_shmop *shmop;
|
struct php_shmop *shmop;
|
||||||
int writesize;
|
zend_long writesize;
|
||||||
zend_long offset;
|
zend_long offset;
|
||||||
zend_string *data;
|
zend_string *data;
|
||||||
zval *shmid;
|
zval *shmid;
|
||||||
|
@ -328,7 +328,7 @@ PHP_FUNCTION(shmop_write)
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
writesize = (ZSTR_LEN(data) < shmop->size - offset) ? ZSTR_LEN(data) : shmop->size - offset;
|
writesize = ((zend_long)ZSTR_LEN(data) < shmop->size - offset) ? (zend_long)ZSTR_LEN(data) : shmop->size - offset;
|
||||||
memcpy(shmop->addr + offset, ZSTR_VAL(data), writesize);
|
memcpy(shmop->addr + offset, ZSTR_VAL(data), writesize);
|
||||||
|
|
||||||
RETURN_LONG(writesize);
|
RETURN_LONG(writesize);
|
||||||
|
|
|
@ -2077,12 +2077,11 @@ static HashTable *php_snmp_get_properties(zval *object)
|
||||||
HashTable *props;
|
HashTable *props;
|
||||||
zval rv;
|
zval rv;
|
||||||
zend_string *key;
|
zend_string *key;
|
||||||
zend_ulong num_key;
|
|
||||||
|
|
||||||
obj = Z_SNMP_P(object);
|
obj = Z_SNMP_P(object);
|
||||||
props = zend_std_get_properties(object);
|
props = zend_std_get_properties(object);
|
||||||
|
|
||||||
ZEND_HASH_FOREACH_KEY_PTR(&php_snmp_properties, num_key, key, hnd) {
|
ZEND_HASH_FOREACH_STR_KEY_PTR(&php_snmp_properties, key, hnd) {
|
||||||
if (!hnd->read_func || hnd->read_func(obj, &rv) != SUCCESS) {
|
if (!hnd->read_func || hnd->read_func(obj, &rv) != SUCCESS) {
|
||||||
ZVAL_NULL(&rv);
|
ZVAL_NULL(&rv);
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,7 +177,7 @@ encodePtr get_encoder_ex(sdlPtr sdl, const char *nscat, int len)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
sdlBindingPtr get_binding_from_type(sdlPtr sdl, int type)
|
sdlBindingPtr get_binding_from_type(sdlPtr sdl, sdlBindingType type)
|
||||||
{
|
{
|
||||||
sdlBindingPtr binding;
|
sdlBindingPtr binding;
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ static int is_wsdl_element(xmlNodePtr node)
|
||||||
void sdl_set_uri_credentials(sdlCtx *ctx, char *uri)
|
void sdl_set_uri_credentials(sdlCtx *ctx, char *uri)
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
int l1, l2;
|
size_t l1, l2;
|
||||||
zval context;
|
zval context;
|
||||||
zval *header = NULL;
|
zval *header = NULL;
|
||||||
|
|
||||||
|
@ -235,11 +235,11 @@ void sdl_set_uri_credentials(sdlCtx *ctx, char *uri)
|
||||||
s = strstr(ctx->sdl->source, "://");
|
s = strstr(ctx->sdl->source, "://");
|
||||||
if (!s) return;
|
if (!s) return;
|
||||||
s = strchr(s+3, '/');
|
s = strchr(s+3, '/');
|
||||||
l1 = s ? (s - ctx->sdl->source) : strlen(ctx->sdl->source);
|
l1 = s ? (size_t)(s - ctx->sdl->source) : strlen(ctx->sdl->source);
|
||||||
s = strstr((char*)uri, "://");
|
s = strstr((char*)uri, "://");
|
||||||
if (!s) return;
|
if (!s) return;
|
||||||
s = strchr(s+3, '/');
|
s = strchr(s+3, '/');
|
||||||
l2 = s ? (s - (char*)uri) : strlen((char*)uri);
|
l2 = s ? (size_t)(s - (char*)uri) : strlen((char*)uri);
|
||||||
if (l1 != l2) {
|
if (l1 != l2) {
|
||||||
/* check for http://...:80/ */
|
/* check for http://...:80/ */
|
||||||
if (l1 > 11 &&
|
if (l1 > 11 &&
|
||||||
|
@ -3156,7 +3156,7 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, zend_long cache_wsdl)
|
||||||
char fn[MAXPATHLEN];
|
char fn[MAXPATHLEN];
|
||||||
sdlPtr sdl = NULL;
|
sdlPtr sdl = NULL;
|
||||||
char* old_error_code = SOAP_GLOBAL(error_code);
|
char* old_error_code = SOAP_GLOBAL(error_code);
|
||||||
int uri_len = 0;
|
size_t uri_len = 0;
|
||||||
php_stream_context *context=NULL;
|
php_stream_context *context=NULL;
|
||||||
zval *tmp, *proxy_host, *proxy_port, orig_context, new_context;
|
zval *tmp, *proxy_host, *proxy_port, orig_context, new_context;
|
||||||
smart_str headers = {0};
|
smart_str headers = {0};
|
||||||
|
@ -3329,7 +3329,7 @@ cache_in_memory:
|
||||||
SOAP_GLOBAL(mem_cache) = malloc(sizeof(HashTable));
|
SOAP_GLOBAL(mem_cache) = malloc(sizeof(HashTable));
|
||||||
zend_hash_init(SOAP_GLOBAL(mem_cache), 0, NULL, delete_psdl, 1);
|
zend_hash_init(SOAP_GLOBAL(mem_cache), 0, NULL, delete_psdl, 1);
|
||||||
} else if (SOAP_GLOBAL(cache_limit) > 0 &&
|
} else if (SOAP_GLOBAL(cache_limit) > 0 &&
|
||||||
SOAP_GLOBAL(cache_limit) <= zend_hash_num_elements(SOAP_GLOBAL(mem_cache))) {
|
SOAP_GLOBAL(cache_limit) <= (zend_long)zend_hash_num_elements(SOAP_GLOBAL(mem_cache))) {
|
||||||
/* in-memory cache overflow */
|
/* in-memory cache overflow */
|
||||||
sdl_cache_bucket *q;
|
sdl_cache_bucket *q;
|
||||||
time_t latest = t;
|
time_t latest = t;
|
||||||
|
|
|
@ -260,7 +260,7 @@ encodePtr get_encoder_from_prefix(sdlPtr sdl, xmlNodePtr data, const xmlChar *ty
|
||||||
encodePtr get_encoder(sdlPtr sdl, const char *ns, const char *type);
|
encodePtr get_encoder(sdlPtr sdl, const char *ns, const char *type);
|
||||||
encodePtr get_encoder_ex(sdlPtr sdl, const char *nscat, int len);
|
encodePtr get_encoder_ex(sdlPtr sdl, const char *nscat, int len);
|
||||||
|
|
||||||
sdlBindingPtr get_binding_from_type(sdlPtr sdl, int type);
|
sdlBindingPtr get_binding_from_type(sdlPtr sdl, sdlBindingType type);
|
||||||
sdlBindingPtr get_binding_from_name(sdlPtr sdl, char *name, char *ns);
|
sdlBindingPtr get_binding_from_name(sdlPtr sdl, char *name, char *ns);
|
||||||
|
|
||||||
void delete_sdl(void *handle);
|
void delete_sdl(void *handle);
|
||||||
|
|
|
@ -2157,7 +2157,7 @@ static void soap_error_handler(int error_num, const char *error_filename, const
|
||||||
zval fault;
|
zval fault;
|
||||||
char* code = SOAP_GLOBAL(error_code);
|
char* code = SOAP_GLOBAL(error_code);
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
int buffer_len;
|
size_t buffer_len;
|
||||||
#ifdef va_copy
|
#ifdef va_copy
|
||||||
va_list argcopy;
|
va_list argcopy;
|
||||||
#endif
|
#endif
|
||||||
|
@ -2172,7 +2172,7 @@ static void soap_error_handler(int error_num, const char *error_filename, const
|
||||||
buffer_len = vslprintf(buffer, sizeof(buffer)-1, format, args);
|
buffer_len = vslprintf(buffer, sizeof(buffer)-1, format, args);
|
||||||
#endif
|
#endif
|
||||||
buffer[sizeof(buffer)-1]=0;
|
buffer[sizeof(buffer)-1]=0;
|
||||||
if (buffer_len > sizeof(buffer) - 1 || buffer_len < 0) {
|
if (buffer_len > sizeof(buffer) - 1 || buffer_len == (size_t)-1) {
|
||||||
buffer_len = sizeof(buffer) - 1;
|
buffer_len = sizeof(buffer) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2238,7 +2238,7 @@ static void soap_error_handler(int error_num, const char *error_filename, const
|
||||||
!service->send_errors) {
|
!service->send_errors) {
|
||||||
strcpy(buffer, "Internal Error");
|
strcpy(buffer, "Internal Error");
|
||||||
} else {
|
} else {
|
||||||
int buffer_len;
|
size_t buffer_len;
|
||||||
zval outbuflen;
|
zval outbuflen;
|
||||||
|
|
||||||
#ifdef va_copy
|
#ifdef va_copy
|
||||||
|
@ -2249,7 +2249,7 @@ static void soap_error_handler(int error_num, const char *error_filename, const
|
||||||
buffer_len = vslprintf(buffer, sizeof(buffer)-1, format, args);
|
buffer_len = vslprintf(buffer, sizeof(buffer)-1, format, args);
|
||||||
#endif
|
#endif
|
||||||
buffer[sizeof(buffer)-1]=0;
|
buffer[sizeof(buffer)-1]=0;
|
||||||
if (buffer_len > sizeof(buffer) - 1 || buffer_len < 0) {
|
if (buffer_len > sizeof(buffer) - 1 || buffer_len == (size_t)-1) {
|
||||||
buffer_len = sizeof(buffer) - 1;
|
buffer_len = sizeof(buffer) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -225,7 +225,7 @@ static unsigned from_array_iterate(const zval *arr,
|
||||||
/* Note i starts at 1, not 0! */
|
/* Note i starts at 1, not 0! */
|
||||||
i = 1;
|
i = 1;
|
||||||
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(arr), elem) {
|
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(arr), elem) {
|
||||||
if (snprintf(buf, sizeof(buf), "element #%u", i) >= sizeof(buf)) {
|
if ((size_t)snprintf(buf, sizeof(buf), "element #%u", i) >= sizeof(buf)) {
|
||||||
memcpy(buf, "element", sizeof("element"));
|
memcpy(buf, "element", sizeof("element"));
|
||||||
}
|
}
|
||||||
zend_llist_add_element(&ctx->keys, &bufp);
|
zend_llist_add_element(&ctx->keys, &bufp);
|
||||||
|
@ -937,7 +937,7 @@ static void from_zval_write_control_array(const zval *arr, char *msghdr_c, ser_c
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (snprintf(buf, sizeof(buf), "element #%u", (unsigned)i++) >= sizeof(buf)) {
|
if ((size_t)snprintf(buf, sizeof(buf), "element #%u", (unsigned)i++) >= sizeof(buf)) {
|
||||||
memcpy(buf, "element", sizeof("element"));
|
memcpy(buf, "element", sizeof("element"));
|
||||||
}
|
}
|
||||||
zend_llist_add_element(&ctx->keys, &bufp);
|
zend_llist_add_element(&ctx->keys, &bufp);
|
||||||
|
@ -1019,7 +1019,7 @@ static void to_zval_read_control_array(const char *msghdr_c, zval *zv, res_conte
|
||||||
ZVAL_NULL(&tmp);
|
ZVAL_NULL(&tmp);
|
||||||
elem = zend_hash_next_index_insert(Z_ARRVAL_P(zv), &tmp);
|
elem = zend_hash_next_index_insert(Z_ARRVAL_P(zv), &tmp);
|
||||||
|
|
||||||
if (snprintf(buf, sizeof(buf), "element #%u", (unsigned)i++) >= sizeof(buf)) {
|
if ((size_t)snprintf(buf, sizeof(buf), "element #%u", (unsigned)i++) >= sizeof(buf)) {
|
||||||
memcpy(buf, "element", sizeof("element"));
|
memcpy(buf, "element", sizeof("element"));
|
||||||
}
|
}
|
||||||
zend_llist_add_element(&ctx->keys, &bufp);
|
zend_llist_add_element(&ctx->keys, &bufp);
|
||||||
|
@ -1061,7 +1061,7 @@ static void from_zval_write_msghdr_buffer_size(const zval *elem, char *msghdr_c,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lval < 0 || lval > MAX_USER_BUFF_SIZE) {
|
if (lval < 0 || (zend_ulong)lval > MAX_USER_BUFF_SIZE) {
|
||||||
do_from_zval_err(ctx, "the buffer size must be between 1 and " ZEND_LONG_FMT "; "
|
do_from_zval_err(ctx, "the buffer size must be between 1 and " ZEND_LONG_FMT "; "
|
||||||
"given " ZEND_LONG_FMT, (zend_long)MAX_USER_BUFF_SIZE, lval);
|
"given " ZEND_LONG_FMT, (zend_long)MAX_USER_BUFF_SIZE, lval);
|
||||||
return;
|
return;
|
||||||
|
@ -1236,7 +1236,7 @@ static void from_zval_write_ifindex(const zval *zv, char *uinteger, ser_context
|
||||||
unsigned ret = 0;
|
unsigned ret = 0;
|
||||||
|
|
||||||
if (Z_TYPE_P(zv) == IS_LONG) {
|
if (Z_TYPE_P(zv) == IS_LONG) {
|
||||||
if (Z_LVAL_P(zv) < 0 || Z_LVAL_P(zv) > UINT_MAX) { /* allow 0 (unspecified interface) */
|
if (Z_LVAL_P(zv) < 0 || (zend_ulong)Z_LVAL_P(zv) > UINT_MAX) { /* allow 0 (unspecified interface) */
|
||||||
do_from_zval_err(ctx, "the interface index cannot be negative or "
|
do_from_zval_err(ctx, "the interface index cannot be negative or "
|
||||||
"larger than %u; given " ZEND_LONG_FMT, UINT_MAX, Z_LVAL_P(zv));
|
"larger than %u; given " ZEND_LONG_FMT, UINT_MAX, Z_LVAL_P(zv));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -90,7 +90,7 @@ static int php_get_if_index_from_zval(zval *val, unsigned *out)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (Z_TYPE_P(val) == IS_LONG) {
|
if (Z_TYPE_P(val) == IS_LONG) {
|
||||||
if (Z_LVAL_P(val) < 0 || Z_LVAL_P(val) > UINT_MAX) {
|
if (Z_LVAL_P(val) < 0 || (zend_ulong)Z_LVAL_P(val) > UINT_MAX) {
|
||||||
php_error_docref(NULL, E_WARNING,
|
php_error_docref(NULL, E_WARNING,
|
||||||
"the interface index cannot be negative or larger than %u;"
|
"the interface index cannot be negative or larger than %u;"
|
||||||
" given " ZEND_LONG_FMT, UINT_MAX, Z_LVAL_P(val));
|
" given " ZEND_LONG_FMT, UINT_MAX, Z_LVAL_P(val));
|
||||||
|
|
|
@ -304,8 +304,8 @@ PHP_FUNCTION(socket_cmsg_space)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry->var_el_size > 0 && n > (ZEND_LONG_MAX - (zend_long)entry->size -
|
if (entry->var_el_size > 0 && n > (zend_long)((ZEND_LONG_MAX - entry->size -
|
||||||
(zend_long)CMSG_SPACE(0) - 15L) / entry->var_el_size) {
|
CMSG_SPACE(0) - 15L) / entry->var_el_size)) {
|
||||||
/* the -15 is to account for any padding CMSG_SPACE may add after the data */
|
/* the -15 is to account for any padding CMSG_SPACE may add after the data */
|
||||||
php_error_docref0(NULL, E_WARNING, "The value for the "
|
php_error_docref0(NULL, E_WARNING, "The value for the "
|
||||||
"third argument (" ZEND_LONG_FMT ") is too large", n);
|
"third argument (" ZEND_LONG_FMT ") is too large", n);
|
||||||
|
|
|
@ -66,7 +66,7 @@ int php_set_inet6_addr(struct sockaddr_in6 *sin6, char *string, php_socket *php_
|
||||||
unsigned scope_id = 0;
|
unsigned scope_id = 0;
|
||||||
|
|
||||||
if (IS_LONG == is_numeric_string(scope, strlen(scope), &lval, &dval, 0)) {
|
if (IS_LONG == is_numeric_string(scope, strlen(scope), &lval, &dval, 0)) {
|
||||||
if (lval > 0 && lval <= UINT_MAX) {
|
if (lval > 0 && (zend_ulong)lval <= UINT_MAX) {
|
||||||
scope_id = lval;
|
scope_id = lval;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1659,9 +1659,9 @@ PHP_FUNCTION(socket_send)
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = send(php_sock->bsd_socket, buf, (buf_len < len ? buf_len : len), flags);
|
retval = send(php_sock->bsd_socket, buf, (buf_len < (size_t)len ? buf_len : (size_t)len), flags);
|
||||||
|
|
||||||
if (retval == -1) {
|
if (retval == (size_t)-1) {
|
||||||
PHP_SOCKET_ERROR(php_sock, "unable to write to socket", errno);
|
PHP_SOCKET_ERROR(php_sock, "unable to write to socket", errno);
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1827,7 +1827,7 @@ PHP_FUNCTION(socket_sendto)
|
||||||
s_un.sun_family = AF_UNIX;
|
s_un.sun_family = AF_UNIX;
|
||||||
snprintf(s_un.sun_path, 108, "%s", addr);
|
snprintf(s_un.sun_path, 108, "%s", addr);
|
||||||
|
|
||||||
retval = sendto(php_sock->bsd_socket, buf, (len > buf_len) ? buf_len : len, flags, (struct sockaddr *) &s_un, SUN_LEN(&s_un));
|
retval = sendto(php_sock->bsd_socket, buf, ((size_t)len > buf_len) ? buf_len : (size_t)len, flags, (struct sockaddr *) &s_un, SUN_LEN(&s_un));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
|
@ -1843,7 +1843,7 @@ PHP_FUNCTION(socket_sendto)
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = sendto(php_sock->bsd_socket, buf, (len > buf_len) ? buf_len : len, flags, (struct sockaddr *) &sin, sizeof(sin));
|
retval = sendto(php_sock->bsd_socket, buf, ((size_t)len > buf_len) ? buf_len : (size_t)len, flags, (struct sockaddr *) &sin, sizeof(sin));
|
||||||
break;
|
break;
|
||||||
#if HAVE_IPV6
|
#if HAVE_IPV6
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
|
@ -1859,7 +1859,7 @@ PHP_FUNCTION(socket_sendto)
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = sendto(php_sock->bsd_socket, buf, (len > buf_len) ? buf_len : len, flags, (struct sockaddr *) &sin6, sizeof(sin6));
|
retval = sendto(php_sock->bsd_socket, buf, ((size_t)len > buf_len) ? buf_len : (size_t)len, flags, (struct sockaddr *) &sin6, sizeof(sin6));
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -2286,7 +2286,7 @@ long_str:
|
||||||
|
|
||||||
Z_TYPE_INFO(tmp) = IS_LONG;
|
Z_TYPE_INFO(tmp) = IS_LONG;
|
||||||
if (low > high) { /* Negative steps */
|
if (low > high) { /* Negative steps */
|
||||||
if (low - high < lstep) {
|
if ((zend_ulong)(low - high) < lstep) {
|
||||||
err = 1;
|
err = 1;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
@ -2300,7 +2300,7 @@ long_str:
|
||||||
}
|
}
|
||||||
} ZEND_HASH_FILL_END();
|
} ZEND_HASH_FILL_END();
|
||||||
} else if (high > low) { /* Positive steps */
|
} else if (high > low) { /* Positive steps */
|
||||||
if (high - low < lstep) {
|
if ((zend_ulong)(high - low) < lstep) {
|
||||||
err = 1;
|
err = 1;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
@ -2336,7 +2336,7 @@ static void php_array_data_shuffle(zval *array) /* {{{ */
|
||||||
Bucket *p, temp;
|
Bucket *p, temp;
|
||||||
HashTable *hash;
|
HashTable *hash;
|
||||||
zend_long rnd_idx;
|
zend_long rnd_idx;
|
||||||
uint32_t n_left;
|
zend_long n_left;
|
||||||
|
|
||||||
n_elems = zend_hash_num_elements(Z_ARRVAL_P(array));
|
n_elems = zend_hash_num_elements(Z_ARRVAL_P(array));
|
||||||
|
|
||||||
|
@ -2429,12 +2429,12 @@ PHP_FUNCTION(shuffle)
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
static void php_splice(HashTable *in_hash, int offset, int length, HashTable *replace, HashTable *removed) /* {{{ */
|
static void php_splice(HashTable *in_hash, zend_long offset, zend_long length, HashTable *replace, HashTable *removed) /* {{{ */
|
||||||
{
|
{
|
||||||
HashTable out_hash; /* Output hashtable */
|
HashTable out_hash; /* Output hashtable */
|
||||||
int num_in, /* Number of entries in the input hashtable */
|
zend_long num_in; /* Number of entries in the input hashtable */
|
||||||
pos; /* Current position in the hashtable */
|
zend_long pos; /* Current position in the hashtable */
|
||||||
uint idx;
|
uint32_t idx;
|
||||||
Bucket *p; /* Pointer to hash bucket */
|
Bucket *p; /* Pointer to hash bucket */
|
||||||
zval *entry; /* Hash entry */
|
zval *entry; /* Hash entry */
|
||||||
uint32_t iter_pos = zend_hash_iterators_lower_pos(in_hash, 0);
|
uint32_t iter_pos = zend_hash_iterators_lower_pos(in_hash, 0);
|
||||||
|
@ -2473,7 +2473,7 @@ static void php_splice(HashTable *in_hash, int offset, int length, HashTable *re
|
||||||
zend_hash_add_new(&out_hash, p->key, entry);
|
zend_hash_add_new(&out_hash, p->key, entry);
|
||||||
}
|
}
|
||||||
if (idx == iter_pos) {
|
if (idx == iter_pos) {
|
||||||
if (idx != pos) {
|
if ((zend_long)idx != pos) {
|
||||||
zend_hash_iterators_update(in_hash, idx, pos);
|
zend_hash_iterators_update(in_hash, idx, pos);
|
||||||
}
|
}
|
||||||
iter_pos = zend_hash_iterators_lower_pos(in_hash, iter_pos + 1);
|
iter_pos = zend_hash_iterators_lower_pos(in_hash, iter_pos + 1);
|
||||||
|
@ -2543,7 +2543,7 @@ static void php_splice(HashTable *in_hash, int offset, int length, HashTable *re
|
||||||
zend_hash_add_new(&out_hash, p->key, entry);
|
zend_hash_add_new(&out_hash, p->key, entry);
|
||||||
}
|
}
|
||||||
if (idx == iter_pos) {
|
if (idx == iter_pos) {
|
||||||
if (idx != pos) {
|
if ((zend_long)idx != pos) {
|
||||||
zend_hash_iterators_update(in_hash, idx, pos);
|
zend_hash_iterators_update(in_hash, idx, pos);
|
||||||
}
|
}
|
||||||
iter_pos = zend_hash_iterators_lower_pos(in_hash, iter_pos + 1);
|
iter_pos = zend_hash_iterators_lower_pos(in_hash, iter_pos + 1);
|
||||||
|
@ -2902,7 +2902,7 @@ PHP_FUNCTION(array_splice)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Perform splice */
|
/* Perform splice */
|
||||||
php_splice(Z_ARRVAL_P(array), (int)offset, (int)length, repl_array ? Z_ARRVAL_P(repl_array) : NULL, rem_hash);
|
php_splice(Z_ARRVAL_P(array), offset, length, repl_array ? Z_ARRVAL_P(repl_array) : NULL, rem_hash);
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
@ -3047,7 +3047,7 @@ PHPAPI int php_array_merge_recursive(HashTable *dest, HashTable *src) /* {{{ */
|
||||||
convert_to_array_ex(dest_zval);
|
convert_to_array_ex(dest_zval);
|
||||||
add_next_index_null(dest_zval);
|
add_next_index_null(dest_zval);
|
||||||
} else if (Z_TYPE_P(dest_zval) == IS_ARRAY) {
|
} else if (Z_TYPE_P(dest_zval) == IS_ARRAY) {
|
||||||
if (UNEXPECTED(Z_ARRVAL_P(dest_zval)->nNextFreeElement > Z_ARRVAL_P(dest_zval)->nNumUsed)) {
|
if (UNEXPECTED(Z_ARRVAL_P(dest_zval)->nNextFreeElement > (zend_long)Z_ARRVAL_P(dest_zval)->nNumUsed)) {
|
||||||
Z_ARRVAL_P(dest_zval)->nNextFreeElement = Z_ARRVAL_P(dest_zval)->nNumUsed;
|
Z_ARRVAL_P(dest_zval)->nNextFreeElement = Z_ARRVAL_P(dest_zval)->nNumUsed;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -4954,7 +4954,7 @@ PHP_FUNCTION(array_multisort)
|
||||||
/* Make sure the arrays are of the same size. */
|
/* Make sure the arrays are of the same size. */
|
||||||
array_size = zend_hash_num_elements(Z_ARRVAL_P(arrays[0]));
|
array_size = zend_hash_num_elements(Z_ARRVAL_P(arrays[0]));
|
||||||
for (i = 0; i < num_arrays; i++) {
|
for (i = 0; i < num_arrays; i++) {
|
||||||
if (zend_hash_num_elements(Z_ARRVAL_P(arrays[i])) != array_size) {
|
if (zend_hash_num_elements(Z_ARRVAL_P(arrays[i])) != (uint32_t)array_size) {
|
||||||
php_error_docref(NULL, E_WARNING, "Array sizes are inconsistent");
|
php_error_docref(NULL, E_WARNING, "Array sizes are inconsistent");
|
||||||
MULTISORT_ABORT;
|
MULTISORT_ABORT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5138,7 +5138,8 @@ ZEND_API void php_get_highlight_struct(zend_syntax_highlighter_ini *syntax_highl
|
||||||
PHP_FUNCTION(highlight_file)
|
PHP_FUNCTION(highlight_file)
|
||||||
{
|
{
|
||||||
char *filename;
|
char *filename;
|
||||||
size_t filename_len, ret;
|
size_t filename_len;
|
||||||
|
int ret;
|
||||||
zend_syntax_highlighter_ini syntax_highlighter_ini;
|
zend_syntax_highlighter_ini syntax_highlighter_ini;
|
||||||
zend_bool i = 0;
|
zend_bool i = 0;
|
||||||
|
|
||||||
|
@ -5181,7 +5182,7 @@ PHP_FUNCTION(php_strip_whitespace)
|
||||||
char *filename;
|
char *filename;
|
||||||
size_t filename_len;
|
size_t filename_len;
|
||||||
zend_lex_state original_lex_state;
|
zend_lex_state original_lex_state;
|
||||||
zend_file_handle file_handle = {{0}};
|
zend_file_handle file_handle;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &filename, &filename_len) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &filename, &filename_len) == FAILURE) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
|
@ -5189,6 +5190,7 @@ PHP_FUNCTION(php_strip_whitespace)
|
||||||
|
|
||||||
php_output_start_default();
|
php_output_start_default();
|
||||||
|
|
||||||
|
memset(&file_handle, 0, sizeof(file_handle));
|
||||||
file_handle.type = ZEND_HANDLE_FILENAME;
|
file_handle.type = ZEND_HANDLE_FILENAME;
|
||||||
file_handle.filename = filename;
|
file_handle.filename = filename;
|
||||||
file_handle.free_filename = 0;
|
file_handle.free_filename = 0;
|
||||||
|
|
|
@ -73,7 +73,7 @@ static void browscap_entry_dtor_persistent(zval *zvalue) /* {{{ */ {
|
||||||
|
|
||||||
static void convert_browscap_pattern(zval *pattern, int persistent) /* {{{ */
|
static void convert_browscap_pattern(zval *pattern, int persistent) /* {{{ */
|
||||||
{
|
{
|
||||||
int i, j=0;
|
size_t i, j=0;
|
||||||
char *t;
|
char *t;
|
||||||
zend_string *res;
|
zend_string *res;
|
||||||
char *lc_pattern;
|
char *lc_pattern;
|
||||||
|
@ -216,7 +216,7 @@ static void php_browscap_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callb
|
||||||
|
|
||||||
static int browscap_read_file(char *filename, browser_data *browdata, int persistent) /* {{{ */
|
static int browscap_read_file(char *filename, browser_data *browdata, int persistent) /* {{{ */
|
||||||
{
|
{
|
||||||
zend_file_handle fh = {{0}};
|
zend_file_handle fh;
|
||||||
|
|
||||||
if (filename == NULL || filename[0] == '\0') {
|
if (filename == NULL || filename[0] == '\0') {
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
|
@ -232,6 +232,7 @@ static int browscap_read_file(char *filename, browser_data *browdata, int persis
|
||||||
:browscap_entry_dtor_request),
|
:browscap_entry_dtor_request),
|
||||||
persistent, 0);
|
persistent, 0);
|
||||||
|
|
||||||
|
memset(&fh, 0, sizeof(fh));
|
||||||
fh.handle.fp = VCWD_FOPEN(filename, "r");
|
fh.handle.fp = VCWD_FOPEN(filename, "r");
|
||||||
fh.opened_path = NULL;
|
fh.opened_path = NULL;
|
||||||
fh.free_filename = 0;
|
fh.free_filename = 0;
|
||||||
|
|
|
@ -626,7 +626,7 @@ _crypt_extended_r(const char *key, const char *setting,
|
||||||
* and padding with zeros.
|
* and padding with zeros.
|
||||||
*/
|
*/
|
||||||
q = (u_char *) keybuf;
|
q = (u_char *) keybuf;
|
||||||
while (q - (u_char *) keybuf < sizeof(keybuf)) {
|
while ((size_t)(q - (u_char *) keybuf) < sizeof(keybuf)) {
|
||||||
*q++ = *key << 1;
|
*q++ = *key << 1;
|
||||||
if (*key)
|
if (*key)
|
||||||
key++;
|
key++;
|
||||||
|
@ -667,7 +667,7 @@ _crypt_extended_r(const char *key, const char *setting,
|
||||||
* And XOR with the next 8 characters of the key.
|
* And XOR with the next 8 characters of the key.
|
||||||
*/
|
*/
|
||||||
q = (u_char *) keybuf;
|
q = (u_char *) keybuf;
|
||||||
while (q - (u_char *) keybuf < sizeof(keybuf) && *key)
|
while ((size_t)(q - (u_char *) keybuf) < sizeof(keybuf) && *key)
|
||||||
*q++ ^= *key++ << 1;
|
*q++ ^= *key++ << 1;
|
||||||
|
|
||||||
if (des_setkey((char *) keybuf, data))
|
if (des_setkey((char *) keybuf, data))
|
||||||
|
|
|
@ -439,7 +439,7 @@ PHP_FUNCTION(glob)
|
||||||
size_t pattern_len;
|
size_t pattern_len;
|
||||||
zend_long flags = 0;
|
zend_long flags = 0;
|
||||||
glob_t globbuf;
|
glob_t globbuf;
|
||||||
int n;
|
size_t n;
|
||||||
int ret;
|
int ret;
|
||||||
zend_bool basedir_limit = 0;
|
zend_bool basedir_limit = 0;
|
||||||
|
|
||||||
|
|
|
@ -54,14 +54,14 @@
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int cmd_max_len;
|
static size_t cmd_max_len;
|
||||||
|
|
||||||
/* {{{ PHP_MINIT_FUNCTION(exec) */
|
/* {{{ PHP_MINIT_FUNCTION(exec) */
|
||||||
PHP_MINIT_FUNCTION(exec)
|
PHP_MINIT_FUNCTION(exec)
|
||||||
{
|
{
|
||||||
#ifdef _SC_ARG_MAX
|
#ifdef _SC_ARG_MAX
|
||||||
cmd_max_len = sysconf(_SC_ARG_MAX);
|
cmd_max_len = sysconf(_SC_ARG_MAX);
|
||||||
if (-1 == cmd_max_len) {
|
if ((size_t)-1 == cmd_max_len) {
|
||||||
#ifdef _POSIX_ARG_MAX
|
#ifdef _POSIX_ARG_MAX
|
||||||
cmd_max_len = _POSIX_ARG_MAX;
|
cmd_max_len = _POSIX_ARG_MAX;
|
||||||
#else
|
#else
|
||||||
|
@ -278,7 +278,7 @@ PHP_FUNCTION(passthru)
|
||||||
*/
|
*/
|
||||||
PHPAPI zend_string *php_escape_shell_cmd(char *str)
|
PHPAPI zend_string *php_escape_shell_cmd(char *str)
|
||||||
{
|
{
|
||||||
register int x, y;
|
register size_t x, y;
|
||||||
size_t l = strlen(str);
|
size_t l = strlen(str);
|
||||||
uint64_t estimate = (2 * (uint64_t)l) + 1;
|
uint64_t estimate = (2 * (uint64_t)l) + 1;
|
||||||
zend_string *cmd;
|
zend_string *cmd;
|
||||||
|
@ -385,7 +385,7 @@ PHPAPI zend_string *php_escape_shell_cmd(char *str)
|
||||||
*/
|
*/
|
||||||
PHPAPI zend_string *php_escape_shell_arg(char *str)
|
PHPAPI zend_string *php_escape_shell_arg(char *str)
|
||||||
{
|
{
|
||||||
int x, y = 0;
|
size_t x, y = 0;
|
||||||
size_t l = strlen(str);
|
size_t l = strlen(str);
|
||||||
zend_string *cmd;
|
zend_string *cmd;
|
||||||
uint64_t estimate = (4 * (uint64_t)l) + 3;
|
uint64_t estimate = (4 * (uint64_t)l) + 3;
|
||||||
|
|
|
@ -576,7 +576,7 @@ PHP_FUNCTION(file_put_contents)
|
||||||
char *filename;
|
char *filename;
|
||||||
size_t filename_len;
|
size_t filename_len;
|
||||||
zval *data;
|
zval *data;
|
||||||
zend_long numbytes = 0;
|
size_t numbytes = 0;
|
||||||
zend_long flags = 0;
|
zend_long flags = 0;
|
||||||
zval *zcontext = NULL;
|
zval *zcontext = NULL;
|
||||||
php_stream_context *context = NULL;
|
php_stream_context *context = NULL;
|
||||||
|
@ -695,7 +695,7 @@ PHP_FUNCTION(file_put_contents)
|
||||||
}
|
}
|
||||||
php_stream_close(stream);
|
php_stream_close(stream);
|
||||||
|
|
||||||
if (numbytes < 0) {
|
if (numbytes == (size_t)-1) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -828,11 +828,11 @@ static int php_stream_ftp_url_stat(php_stream_wrapper *wrapper, const char *url,
|
||||||
struct tm tm, tmbuf, *gmt;
|
struct tm tm, tmbuf, *gmt;
|
||||||
time_t stamp;
|
time_t stamp;
|
||||||
|
|
||||||
while (p - tmp_line < sizeof(tmp_line) && !isdigit(*p)) {
|
while ((size_t)(p - tmp_line) < sizeof(tmp_line) && !isdigit(*p)) {
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p - tmp_line > sizeof(tmp_line)) {
|
if ((size_t)(p - tmp_line) > sizeof(tmp_line)) {
|
||||||
goto mdtm_error;
|
goto mdtm_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1177,7 +1177,8 @@ static php_stream_wrapper_ops ftp_stream_wops = {
|
||||||
php_stream_ftp_unlink, /* unlink */
|
php_stream_ftp_unlink, /* unlink */
|
||||||
php_stream_ftp_rename, /* rename */
|
php_stream_ftp_rename, /* rename */
|
||||||
php_stream_ftp_mkdir, /* mkdir */
|
php_stream_ftp_mkdir, /* mkdir */
|
||||||
php_stream_ftp_rmdir /* rmdir */
|
php_stream_ftp_rmdir, /* rmdir */
|
||||||
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
PHPAPI php_stream_wrapper php_stream_ftp_wrapper = {
|
PHPAPI php_stream_wrapper php_stream_ftp_wrapper = {
|
||||||
|
|
|
@ -969,7 +969,8 @@ static php_stream_wrapper_ops http_stream_wops = {
|
||||||
NULL, /* unlink */
|
NULL, /* unlink */
|
||||||
NULL, /* rename */
|
NULL, /* rename */
|
||||||
NULL, /* mkdir */
|
NULL, /* mkdir */
|
||||||
NULL /* rmdir */
|
NULL, /* rmdir */
|
||||||
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
PHPAPI php_stream_wrapper php_stream_http_wrapper = {
|
PHPAPI php_stream_wrapper php_stream_http_wrapper = {
|
||||||
|
|
|
@ -191,7 +191,7 @@ PHP_FUNCTION(iptcembed)
|
||||||
zend_long spool = 0;
|
zend_long spool = 0;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
unsigned int marker, done = 0;
|
unsigned int marker, done = 0;
|
||||||
int inx;
|
size_t inx;
|
||||||
zend_string *spoolbuf = NULL;
|
zend_string *spoolbuf = NULL;
|
||||||
unsigned char *poi = NULL;
|
unsigned char *poi = NULL;
|
||||||
zend_stat_t sb;
|
zend_stat_t sb;
|
||||||
|
@ -314,7 +314,7 @@ PHP_FUNCTION(iptcembed)
|
||||||
Parse binary IPTC-data into associative array */
|
Parse binary IPTC-data into associative array */
|
||||||
PHP_FUNCTION(iptcparse)
|
PHP_FUNCTION(iptcparse)
|
||||||
{
|
{
|
||||||
int inx = 0, len;
|
size_t inx = 0, len;
|
||||||
unsigned int tagsfound = 0;
|
unsigned int tagsfound = 0;
|
||||||
unsigned char *buffer, recnum, dataset;
|
unsigned char *buffer, recnum, dataset;
|
||||||
char *str, key[16];
|
char *str, key[16];
|
||||||
|
@ -358,7 +358,7 @@ PHP_FUNCTION(iptcparse)
|
||||||
inx += 2;
|
inx += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((len < 0) || (len > str_len) || (inx + len) > str_len) {
|
if ((len > str_len) || (inx + len) > str_len) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -168,7 +168,7 @@ static char Lookahead(char *word, int how_far)
|
||||||
static int metaphone(unsigned char *word, size_t word_len, zend_long max_phonemes, zend_string **phoned_word, int traditional)
|
static int metaphone(unsigned char *word, size_t word_len, zend_long max_phonemes, zend_string **phoned_word, int traditional)
|
||||||
{
|
{
|
||||||
int w_idx = 0; /* point in the phonization we're at. */
|
int w_idx = 0; /* point in the phonization we're at. */
|
||||||
int p_idx = 0; /* end of the phoned phrase */
|
size_t p_idx = 0; /* end of the phoned phrase */
|
||||||
size_t max_buffer_len = 0; /* maximum length of the destination buffer */
|
size_t max_buffer_len = 0; /* maximum length of the destination buffer */
|
||||||
|
|
||||||
/*-- Parameter checks --*/
|
/*-- Parameter checks --*/
|
||||||
|
@ -265,7 +265,7 @@ static int metaphone(unsigned char *word, size_t word_len, zend_long max_phoneme
|
||||||
|
|
||||||
/* On to the metaphoning */
|
/* On to the metaphoning */
|
||||||
for (; Curr_Letter != '\0' &&
|
for (; Curr_Letter != '\0' &&
|
||||||
(max_phonemes == 0 || Phone_Len < max_phonemes);
|
(max_phonemes == 0 || Phone_Len < (size_t)max_phonemes);
|
||||||
w_idx++) {
|
w_idx++) {
|
||||||
/* How many letters to skip because an eariler encoding handled
|
/* How many letters to skip because an eariler encoding handled
|
||||||
* multiple letters */
|
* multiple letters */
|
||||||
|
|
|
@ -92,7 +92,7 @@ static int little_endian_longlong_map[8];
|
||||||
*/
|
*/
|
||||||
static void php_pack(zval *val, size_t size, int *map, char *output)
|
static void php_pack(zval *val, size_t size, int *map, char *output)
|
||||||
{
|
{
|
||||||
int i;
|
size_t i;
|
||||||
char *v;
|
char *v;
|
||||||
|
|
||||||
convert_to_long_ex(val);
|
convert_to_long_ex(val);
|
||||||
|
@ -112,13 +112,14 @@ static void php_pack(zval *val, size_t size, int *map, char *output)
|
||||||
PHP_FUNCTION(pack)
|
PHP_FUNCTION(pack)
|
||||||
{
|
{
|
||||||
zval *argv = NULL;
|
zval *argv = NULL;
|
||||||
int num_args = 0, i;
|
int num_args = 0;
|
||||||
|
size_t i;
|
||||||
int currentarg;
|
int currentarg;
|
||||||
char *format;
|
char *format;
|
||||||
size_t formatlen;
|
size_t formatlen;
|
||||||
char *formatcodes;
|
char *formatcodes;
|
||||||
int *formatargs;
|
int *formatargs;
|
||||||
int formatcount = 0;
|
size_t formatcount = 0;
|
||||||
int outputpos = 0, outputsize = 0;
|
int outputpos = 0, outputsize = 0;
|
||||||
zend_string *output;
|
zend_string *output;
|
||||||
|
|
||||||
|
@ -334,7 +335,7 @@ PHP_FUNCTION(pack)
|
||||||
case 'a':
|
case 'a':
|
||||||
case 'A':
|
case 'A':
|
||||||
case 'Z': {
|
case 'Z': {
|
||||||
int arg_cp = (code != 'Z') ? arg : MAX(0, arg - 1);
|
size_t arg_cp = (code != 'Z') ? arg : MAX(0, arg - 1);
|
||||||
|
|
||||||
zend_string *str = zval_get_string(&argv[currentarg++]);
|
zend_string *str = zval_get_string(&argv[currentarg++]);
|
||||||
|
|
||||||
|
@ -356,7 +357,7 @@ PHP_FUNCTION(pack)
|
||||||
char *v = ZSTR_VAL(str);
|
char *v = ZSTR_VAL(str);
|
||||||
|
|
||||||
outputpos--;
|
outputpos--;
|
||||||
if(arg > ZSTR_LEN(str)) {
|
if ((size_t)arg > ZSTR_LEN(str)) {
|
||||||
php_error_docref(NULL, E_WARNING, "Type %c: not enough characters in string", code);
|
php_error_docref(NULL, E_WARNING, "Type %c: not enough characters in string", code);
|
||||||
arg = ZSTR_LEN(str);
|
arg = ZSTR_LEN(str);
|
||||||
}
|
}
|
||||||
|
@ -519,7 +520,7 @@ static zend_long php_unpack(char *data, size_t size, int issigned, int *map)
|
||||||
{
|
{
|
||||||
zend_long result;
|
zend_long result;
|
||||||
char *cresult = (char *) &result;
|
char *cresult = (char *) &result;
|
||||||
int i;
|
size_t i;
|
||||||
|
|
||||||
result = issigned ? -1 : 0;
|
result = issigned ? -1 : 0;
|
||||||
|
|
||||||
|
@ -726,7 +727,7 @@ PHP_FUNCTION(unpack)
|
||||||
switch ((int) type) {
|
switch ((int) type) {
|
||||||
case 'a': {
|
case 'a': {
|
||||||
/* a will not strip any trailing whitespace or null padding */
|
/* a will not strip any trailing whitespace or null padding */
|
||||||
size_t len = inputlen - inputpos; /* Remaining string */
|
zend_long len = inputlen - inputpos; /* Remaining string */
|
||||||
|
|
||||||
/* If size was given take minimum of len and size */
|
/* If size was given take minimum of len and size */
|
||||||
if ((size >= 0) && (len > size)) {
|
if ((size >= 0) && (len > size)) {
|
||||||
|
@ -768,7 +769,7 @@ PHP_FUNCTION(unpack)
|
||||||
case 'Z': {
|
case 'Z': {
|
||||||
/* Z will strip everything after the first null character */
|
/* Z will strip everything after the first null character */
|
||||||
char pad = '\0';
|
char pad = '\0';
|
||||||
size_t s,
|
zend_long s,
|
||||||
len = inputlen - inputpos; /* Remaining string */
|
len = inputlen - inputpos; /* Remaining string */
|
||||||
|
|
||||||
/* If size was given take minimum of len and size */
|
/* If size was given take minimum of len and size */
|
||||||
|
@ -792,11 +793,11 @@ PHP_FUNCTION(unpack)
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
case 'H': {
|
case 'H': {
|
||||||
size_t len = (inputlen - inputpos) * 2; /* Remaining */
|
zend_long len = (inputlen - inputpos) * 2; /* Remaining */
|
||||||
int nibbleshift = (type == 'h') ? 0 : 4;
|
int nibbleshift = (type == 'h') ? 0 : 4;
|
||||||
int first = 1;
|
int first = 1;
|
||||||
char *buf;
|
char *buf;
|
||||||
size_t ipos, opos;
|
zend_long ipos, opos;
|
||||||
|
|
||||||
/* If size was given take minimum of len and size */
|
/* If size was given take minimum of len and size */
|
||||||
if (size >= 0 && len > (size * 2)) {
|
if (size >= 0 && len > (size * 2)) {
|
||||||
|
|
|
@ -194,7 +194,7 @@ PHP_FUNCTION(password_needs_rehash)
|
||||||
|
|
||||||
algo = php_password_determine_algo(hash, (size_t) hash_len);
|
algo = php_password_determine_algo(hash, (size_t) hash_len);
|
||||||
|
|
||||||
if (algo != new_algo) {
|
if ((zend_long)algo != new_algo) {
|
||||||
RETURN_TRUE;
|
RETURN_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,8 +224,8 @@ PHP_FUNCTION(password_needs_rehash)
|
||||||
Verify a hash created using crypt() or password_hash() */
|
Verify a hash created using crypt() or password_hash() */
|
||||||
PHP_FUNCTION(password_verify)
|
PHP_FUNCTION(password_verify)
|
||||||
{
|
{
|
||||||
int status = 0, i;
|
int status = 0;
|
||||||
size_t password_len, hash_len;
|
size_t i, password_len, hash_len;
|
||||||
char *password, *hash;
|
char *password, *hash;
|
||||||
zend_string *ret;
|
zend_string *ret;
|
||||||
|
|
||||||
|
|
|
@ -437,7 +437,8 @@ static php_stream_wrapper_ops php_stdio_wops = {
|
||||||
NULL, /* unlink */
|
NULL, /* unlink */
|
||||||
NULL, /* rename */
|
NULL, /* rename */
|
||||||
NULL, /* mkdir */
|
NULL, /* mkdir */
|
||||||
NULL /* rmdir */
|
NULL, /* rmdir */
|
||||||
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
PHPAPI php_stream_wrapper php_stream_php_wrapper = {
|
PHPAPI php_stream_wrapper php_stream_php_wrapper = {
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
|
|
||||||
#define PHP_CLASS_ATTRIBUTES \
|
#define PHP_CLASS_ATTRIBUTES \
|
||||||
zend_string *class_name; \
|
zend_string *class_name; \
|
||||||
zend_bool incomplete_class = 0
|
zend_bool incomplete_class ZEND_ATTRIBUTE_UNUSED = 0
|
||||||
|
|
||||||
#define INCOMPLETE_CLASS "__PHP_Incomplete_Class"
|
#define INCOMPLETE_CLASS "__PHP_Incomplete_Class"
|
||||||
#define MAGIC_MEMBER "__PHP_Incomplete_Class_Name"
|
#define MAGIC_MEMBER "__PHP_Incomplete_Class_Name"
|
||||||
|
|
|
@ -978,7 +978,7 @@ PHP_FUNCTION(wordwrap)
|
||||||
newtext = zend_string_init(ZSTR_VAL(text), ZSTR_LEN(text), 0);
|
newtext = zend_string_init(ZSTR_VAL(text), ZSTR_LEN(text), 0);
|
||||||
|
|
||||||
laststart = lastspace = 0;
|
laststart = lastspace = 0;
|
||||||
for (current = 0; current < ZSTR_LEN(text); current++) {
|
for (current = 0; current < (zend_long)ZSTR_LEN(text); current++) {
|
||||||
if (ZSTR_VAL(text)[current] == breakchar[0]) {
|
if (ZSTR_VAL(text)[current] == breakchar[0]) {
|
||||||
laststart = lastspace = current + 1;
|
laststart = lastspace = current + 1;
|
||||||
} else if (ZSTR_VAL(text)[current] == ' ') {
|
} else if (ZSTR_VAL(text)[current] == ' ') {
|
||||||
|
@ -1010,7 +1010,7 @@ PHP_FUNCTION(wordwrap)
|
||||||
newtextlen = 0;
|
newtextlen = 0;
|
||||||
|
|
||||||
laststart = lastspace = 0;
|
laststart = lastspace = 0;
|
||||||
for (current = 0; current < ZSTR_LEN(text); current++) {
|
for (current = 0; current < (zend_long)ZSTR_LEN(text); current++) {
|
||||||
if (chk <= 0) {
|
if (chk <= 0) {
|
||||||
alloced += (size_t) (((ZSTR_LEN(text) - current + 1)/linelength + 1) * breakchar_len) + 1;
|
alloced += (size_t) (((ZSTR_LEN(text) - current + 1)/linelength + 1) * breakchar_len) + 1;
|
||||||
newtext = zend_string_extend(newtext, alloced, 0);
|
newtext = zend_string_extend(newtext, alloced, 0);
|
||||||
|
@ -1754,7 +1754,7 @@ PHP_FUNCTION(pathinfo)
|
||||||
|
|
||||||
p = zend_memrchr(ZSTR_VAL(ret), '.', ZSTR_LEN(ret));
|
p = zend_memrchr(ZSTR_VAL(ret), '.', ZSTR_LEN(ret));
|
||||||
|
|
||||||
idx = p ? (p - ZSTR_VAL(ret)) : ZSTR_LEN(ret);
|
idx = p ? (p - ZSTR_VAL(ret)) : (ptrdiff_t)ZSTR_LEN(ret);
|
||||||
add_assoc_stringl(&tmp, "filename", ZSTR_VAL(ret), idx);
|
add_assoc_stringl(&tmp, "filename", ZSTR_VAL(ret), idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2131,7 +2131,7 @@ PHP_FUNCTION(strrpos)
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
p = ZSTR_VAL(haystack);
|
p = ZSTR_VAL(haystack);
|
||||||
if (-offset < needle_len) {
|
if ((size_t)-offset < needle_len) {
|
||||||
e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack);
|
e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack);
|
||||||
} else {
|
} else {
|
||||||
e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack) + offset + needle_len;
|
e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack) + offset + needle_len;
|
||||||
|
@ -2232,7 +2232,7 @@ PHP_FUNCTION(strripos)
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
p = ZSTR_VAL(haystack_dup);
|
p = ZSTR_VAL(haystack_dup);
|
||||||
if (-offset < ZSTR_LEN(needle)) {
|
if ((size_t)-offset < ZSTR_LEN(needle)) {
|
||||||
e = ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack);
|
e = ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack);
|
||||||
} else {
|
} else {
|
||||||
e = ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack) + offset + ZSTR_LEN(needle);
|
e = ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack) + offset + ZSTR_LEN(needle);
|
||||||
|
@ -2412,7 +2412,7 @@ PHP_FUNCTION(substr)
|
||||||
|
|
||||||
if (f > (zend_long)ZSTR_LEN(str)) {
|
if (f > (zend_long)ZSTR_LEN(str)) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
} else if (f < 0 && -f > ZSTR_LEN(str)) {
|
} else if (f < 0 && (size_t)-f > ZSTR_LEN(str)) {
|
||||||
f = 0;
|
f = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2518,7 +2518,7 @@ PHP_FUNCTION(substr_replace)
|
||||||
if (f < 0) {
|
if (f < 0) {
|
||||||
f = 0;
|
f = 0;
|
||||||
}
|
}
|
||||||
} else if (f > Z_STRLEN_P(str)) {
|
} else if ((size_t)f > Z_STRLEN_P(str)) {
|
||||||
f = Z_STRLEN_P(str);
|
f = Z_STRLEN_P(str);
|
||||||
}
|
}
|
||||||
/* if "length" position is negative, set it to the length
|
/* if "length" position is negative, set it to the length
|
||||||
|
@ -2531,7 +2531,7 @@ PHP_FUNCTION(substr_replace)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l > Z_STRLEN_P(str) || (l < 0 && (size_t)(-l) > Z_STRLEN_P(str))) {
|
if ((size_t)l > Z_STRLEN_P(str) || (l < 0 && (size_t)(-l) > Z_STRLEN_P(str))) {
|
||||||
l = Z_STRLEN_P(str);
|
l = Z_STRLEN_P(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4212,8 +4212,8 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines)
|
||||||
char *str;
|
char *str;
|
||||||
char *heb_str, *tmp, *target;
|
char *heb_str, *tmp, *target;
|
||||||
size_t block_start, block_end, block_type, block_length, i;
|
size_t block_start, block_end, block_type, block_length, i;
|
||||||
zend_long max_chars=0;
|
zend_long max_chars=0, char_count;
|
||||||
size_t begin, end, char_count, orig_begin;
|
size_t begin, end, orig_begin;
|
||||||
size_t str_len;
|
size_t str_len;
|
||||||
zend_string *broken_str;
|
zend_string *broken_str;
|
||||||
|
|
||||||
|
@ -5324,7 +5324,7 @@ PHP_FUNCTION(substr_count)
|
||||||
if (length <= 0) {
|
if (length <= 0) {
|
||||||
length += (haystack_len - offset);
|
length += (haystack_len - offset);
|
||||||
}
|
}
|
||||||
if ((length <= 0) || (length > (haystack_len - offset))) {
|
if ((length <= 0) || ((size_t)length > (haystack_len - offset))) {
|
||||||
php_error_docref(NULL, E_WARNING, "Invalid length value");
|
php_error_docref(NULL, E_WARNING, "Invalid length value");
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -5746,7 +5746,7 @@ PHP_FUNCTION(substr_compare)
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmp_len = (size_t) (len ? len : MAX(ZSTR_LEN(s2), (ZSTR_LEN(s1) - offset)));
|
cmp_len = len ? (size_t)len : MAX(ZSTR_LEN(s2), (ZSTR_LEN(s1) - offset));
|
||||||
|
|
||||||
if (!cs) {
|
if (!cs) {
|
||||||
RETURN_LONG(zend_binary_strncmp(ZSTR_VAL(s1) + offset, (ZSTR_LEN(s1) - offset), ZSTR_VAL(s2), ZSTR_LEN(s2), cmp_len));
|
RETURN_LONG(zend_binary_strncmp(ZSTR_VAL(s1) + offset, (ZSTR_LEN(s1) - offset), ZSTR_VAL(s2), ZSTR_LEN(s2), cmp_len));
|
||||||
|
|
|
@ -416,7 +416,7 @@ PHP_FUNCTION(is_callable)
|
||||||
retval = zend_is_callable_ex(var, NULL, check_flags, &name, NULL, &error);
|
retval = zend_is_callable_ex(var, NULL, check_flags, &name, NULL, &error);
|
||||||
zval_dtor(callable_name);
|
zval_dtor(callable_name);
|
||||||
//??? is it necessary to be consistent with old PHP ("\0" support)
|
//??? is it necessary to be consistent with old PHP ("\0" support)
|
||||||
if (UNEXPECTED(ZSTR_LEN(name)) != strlen(ZSTR_VAL(name))) {
|
if (UNEXPECTED(ZSTR_LEN(name) != strlen(ZSTR_VAL(name)))) {
|
||||||
ZVAL_STRINGL(callable_name, ZSTR_VAL(name), strlen(ZSTR_VAL(name)));
|
ZVAL_STRINGL(callable_name, ZSTR_VAL(name), strlen(ZSTR_VAL(name)));
|
||||||
zend_string_release(name);
|
zend_string_release(name);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -452,7 +452,7 @@ static void php_stream_bucket_attach(int append, INTERNAL_FUNCTION_PARAMETERS)
|
||||||
if (!bucket->own_buf) {
|
if (!bucket->own_buf) {
|
||||||
bucket = php_stream_bucket_make_writeable(bucket);
|
bucket = php_stream_bucket_make_writeable(bucket);
|
||||||
}
|
}
|
||||||
if ((int)bucket->buflen != Z_STRLEN_P(pzdata)) {
|
if (bucket->buflen != Z_STRLEN_P(pzdata)) {
|
||||||
bucket->buf = perealloc(bucket->buf, Z_STRLEN_P(pzdata), bucket->is_persistent);
|
bucket->buf = perealloc(bucket->buf, Z_STRLEN_P(pzdata), bucket->is_persistent);
|
||||||
bucket->buflen = Z_STRLEN_P(pzdata);
|
bucket->buflen = Z_STRLEN_P(pzdata);
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,7 +169,7 @@ PHP_FUNCTION(shm_attach)
|
||||||
|
|
||||||
/* get the id from a specified key or create new shared memory */
|
/* get the id from a specified key or create new shared memory */
|
||||||
if ((shm_id = shmget(shm_key, 0, 0)) < 0) {
|
if ((shm_id = shmget(shm_key, 0, 0)) < 0) {
|
||||||
if (shm_size < sizeof(sysvshm_chunk_head)) {
|
if (shm_size < (zend_long)sizeof(sysvshm_chunk_head)) {
|
||||||
php_error_docref(NULL, E_WARNING, "failed for key 0x" ZEND_XLONG_FMT ": memorysize too small", shm_key);
|
php_error_docref(NULL, E_WARNING, "failed for key 0x" ZEND_XLONG_FMT ": memorysize too small", shm_key);
|
||||||
efree(shm_list_ptr);
|
efree(shm_list_ptr);
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
|
|
|
@ -638,7 +638,7 @@ PHP_XML_API zend_string *xml_utf8_decode(const XML_Char *s, size_t len, const XM
|
||||||
c = '?';
|
c = '?';
|
||||||
}
|
}
|
||||||
|
|
||||||
ZSTR_VAL(str)[ZSTR_LEN(str)++] = decoder ? decoder(c) : c;
|
ZSTR_VAL(str)[ZSTR_LEN(str)++] = decoder ? (unsigned int)decoder(c) : c;
|
||||||
}
|
}
|
||||||
ZSTR_VAL(str)[ZSTR_LEN(str)] = '\0';
|
ZSTR_VAL(str)[ZSTR_LEN(str)] = '\0';
|
||||||
if (ZSTR_LEN(str) < len) {
|
if (ZSTR_LEN(str) < len) {
|
||||||
|
@ -864,7 +864,7 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Z_ISUNDEF(parser->data)) {
|
if (!Z_ISUNDEF(parser->data)) {
|
||||||
int i;
|
size_t i;
|
||||||
int doprint = 0;
|
int doprint = 0;
|
||||||
zend_string *decoded_value;
|
zend_string *decoded_value;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue