mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Fix a couple compile warnings
This commit is contained in:
@@ -1761,7 +1761,7 @@ static int copy_function_name(zval *zv TSRMLS_DC, int num_args, va_list args, ze
|
||||
Returns an array of all defined functions */
|
||||
ZEND_FUNCTION(get_defined_functions)
|
||||
{
|
||||
zval internal, user, *ret;
|
||||
zval internal, user;
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
|
||||
@@ -5126,7 +5126,7 @@ PHP_FUNCTION(php_strip_whitespace)
|
||||
char *filename;
|
||||
size_t filename_len;
|
||||
zend_lex_state original_lex_state;
|
||||
zend_file_handle file_handle = {0};
|
||||
zend_file_handle file_handle = {{0}};
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
|
||||
@@ -221,7 +221,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 TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_file_handle fh = {0};
|
||||
zend_file_handle fh = {{0}};
|
||||
|
||||
if (filename == NULL || filename[0] == '\0') {
|
||||
return FAILURE;
|
||||
@@ -379,15 +379,13 @@ static int browser_reg_compare(zval *browser TSRMLS_DC, int num_args, va_list ar
|
||||
number of characters changed in the user agent being checked versus
|
||||
the previous match found and the current match. */
|
||||
if (Z_TYPE_P(found_browser_entry) == IS_ARRAY) {
|
||||
int i, prev_len = 0, curr_len = 0, ua_len;
|
||||
zval *current_match;
|
||||
size_t i, prev_len = 0, curr_len = 0;
|
||||
zval *current_match = zend_hash_str_find(Z_ARRVAL_P(browser), "browser_name_pattern", sizeof("browser_name_pattern")-1);
|
||||
|
||||
if ((current_match = zend_hash_str_find(Z_ARRVAL_P(browser), "browser_name_pattern", sizeof("browser_name_pattern")-1)) == NULL) {
|
||||
if (!current_match) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ua_len = lookup_browser_length;
|
||||
|
||||
for (i = 0; i < Z_STRLEN_P(previous_match); i++) {
|
||||
switch (Z_STRVAL_P(previous_match)[i]) {
|
||||
case '?':
|
||||
|
||||
@@ -201,11 +201,11 @@ _cyr_mac = {
|
||||
* d - x-cp866
|
||||
* m - x-mac-cyrillic
|
||||
*****************************************************************************/
|
||||
static char * php_convert_cyr_string(unsigned char *str, int length, char from, char to TSRMLS_DC)
|
||||
static char * php_convert_cyr_string(unsigned char *str, size_t length, char from, char to TSRMLS_DC)
|
||||
{
|
||||
const unsigned char *from_table, *to_table;
|
||||
unsigned char tmp;
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
from_table = NULL;
|
||||
to_table = NULL;
|
||||
@@ -258,8 +258,7 @@ static char * php_convert_cyr_string(unsigned char *str, int length, char from,
|
||||
if (!str)
|
||||
return (char *)str;
|
||||
|
||||
for( i = 0; i<length; i++)
|
||||
{
|
||||
for (i = 0; i < length; i++) {
|
||||
tmp = (from_table == NULL)? str[i] : from_table[ str[i] ];
|
||||
str[i] = (to_table == NULL) ? tmp : to_table[tmp + 256];
|
||||
}
|
||||
@@ -281,7 +280,7 @@ PHP_FUNCTION(convert_cyr_string)
|
||||
|
||||
str = zend_string_init(input, input_len, 0);
|
||||
|
||||
php_convert_cyr_string(str->val, str->len, fr_cs[0], to_cs[0] TSRMLS_CC);
|
||||
php_convert_cyr_string((unsigned char *) str->val, str->len, fr_cs[0], to_cs[0] TSRMLS_CC);
|
||||
RETVAL_NEW_STR(str);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -535,7 +535,7 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t
|
||||
}
|
||||
if (n) {
|
||||
memcpy(tp->val + l2 , cp + l1 + 1, n);
|
||||
add_next_index_stringl(&entries, cp + l1 + 1, n);
|
||||
add_next_index_stringl(&entries, (char *) cp + l1 + 1, n);
|
||||
}
|
||||
l1 = l1 + n + 1;
|
||||
l2 = l2 + n;
|
||||
|
||||
@@ -300,8 +300,8 @@ PHP_FUNCTION(iptcparse)
|
||||
{
|
||||
int inx = 0, len;
|
||||
unsigned int tagsfound = 0;
|
||||
unsigned char *buffer, recnum, dataset, key[ 16 ];
|
||||
char *str;
|
||||
unsigned char *buffer, recnum, dataset;
|
||||
char *str, key[16];
|
||||
size_t str_len;
|
||||
zval values, *element;
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ PHP_NAMED_FUNCTION(php_if_md5)
|
||||
PHP_MD5Update(&context, arg->val, arg->len);
|
||||
PHP_MD5Final(digest, &context);
|
||||
if (raw_output) {
|
||||
RETURN_STRINGL(digest, 16);
|
||||
RETURN_STRINGL((char *) digest, 16);
|
||||
} else {
|
||||
make_digest_ex(md5str, digest, 16);
|
||||
RETVAL_STRING(md5str);
|
||||
@@ -112,7 +112,7 @@ PHP_NAMED_FUNCTION(php_if_md5_file)
|
||||
PHP_MD5Final(digest, &context);
|
||||
|
||||
if (raw_output) {
|
||||
RETURN_STRINGL(digest, 16);
|
||||
RETURN_STRINGL((char *) digest, 16);
|
||||
} else {
|
||||
make_digest_ex(md5str, digest, 16);
|
||||
RETVAL_STRING(md5str);
|
||||
|
||||
@@ -46,10 +46,10 @@ PHP_FUNCTION(sha1)
|
||||
|
||||
sha1str[0] = '\0';
|
||||
PHP_SHA1Init(&context);
|
||||
PHP_SHA1Update(&context, arg->val, arg->len);
|
||||
PHP_SHA1Update(&context, (unsigned char *) arg->val, arg->len);
|
||||
PHP_SHA1Final(digest, &context);
|
||||
if (raw_output) {
|
||||
RETURN_STRINGL(digest, 20);
|
||||
RETURN_STRINGL((char *) digest, 20);
|
||||
} else {
|
||||
make_digest_ex(sha1str, digest, 20);
|
||||
RETVAL_STRING(sha1str);
|
||||
@@ -71,7 +71,7 @@ PHP_FUNCTION(sha1_file)
|
||||
unsigned char buf[1024];
|
||||
unsigned char digest[20];
|
||||
PHP_SHA1_CTX context;
|
||||
int n;
|
||||
size_t n;
|
||||
php_stream *stream;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|b", &arg, &arg_len, &raw_output) == FAILURE) {
|
||||
@@ -85,7 +85,7 @@ PHP_FUNCTION(sha1_file)
|
||||
|
||||
PHP_SHA1Init(&context);
|
||||
|
||||
while ((n = php_stream_read(stream, buf, sizeof(buf))) > 0) {
|
||||
while ((n = php_stream_read(stream, (char *) buf, sizeof(buf))) > 0) {
|
||||
PHP_SHA1Update(&context, buf, n);
|
||||
}
|
||||
|
||||
@@ -93,12 +93,8 @@ PHP_FUNCTION(sha1_file)
|
||||
|
||||
php_stream_close(stream);
|
||||
|
||||
if (n<0) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (raw_output) {
|
||||
RETURN_STRINGL(digest, 20);
|
||||
RETURN_STRINGL((char *) digest, 20);
|
||||
} else {
|
||||
make_digest_ex(sha1str, digest, 20);
|
||||
RETVAL_STRING(sha1str);
|
||||
|
||||
@@ -3983,7 +3983,7 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines)
|
||||
|
||||
while (1) {
|
||||
char_count=0;
|
||||
while ((!max_chars || max_chars > 0 && char_count < max_chars) && begin > 0) {
|
||||
while ((!max_chars || (max_chars > 0 && char_count < max_chars)) && begin > 0) {
|
||||
char_count++;
|
||||
begin--;
|
||||
if (begin <= 0 || _isnewline(heb_str[begin])) {
|
||||
|
||||
Reference in New Issue
Block a user