]> granicus.if.org Git - php/commitdiff
Fixed compiler warnings in the standard library
authorKalle Sommer Nielsen <kalle@php.net>
Thu, 23 Sep 2010 03:45:36 +0000 (03:45 +0000)
committerKalle Sommer Nielsen <kalle@php.net>
Thu, 23 Sep 2010 03:45:36 +0000 (03:45 +0000)
ext/standard/array.c
ext/standard/crypt_blowfish.c
ext/standard/crypt_sha256.c
ext/standard/crypt_sha512.c
ext/standard/html.c
ext/standard/iptc.c
ext/standard/url_scanner_ex.c
ext/standard/url_scanner_ex.re

index ee3c5ae75aa454d438350dda526d374f2da93eb0..f0c20c3121c4270914023a962d5052e30f79ff55 100644 (file)
@@ -629,7 +629,7 @@ static int php_array_user_compare(const void *a, const void *b TSRMLS_DC) /* {{{
 PHP_FUNCTION(usort)
 {
        zval *array;
-       int refcount;
+       unsigned int refcount;
        PHP_ARRAY_CMP_FUNC_VARS;
 
        PHP_ARRAY_CMP_FUNC_BACKUP();
@@ -672,7 +672,7 @@ PHP_FUNCTION(usort)
 PHP_FUNCTION(uasort)
 {
        zval *array;
-       int refcount;
+       unsigned int refcount;
        PHP_ARRAY_CMP_FUNC_VARS;
 
        PHP_ARRAY_CMP_FUNC_BACKUP();
@@ -768,7 +768,7 @@ static int php_array_user_key_compare(const void *a, const void *b TSRMLS_DC) /*
 PHP_FUNCTION(uksort)
 {
        zval *array;
-       int refcount;
+       unsigned int refcount;
        PHP_ARRAY_CMP_FUNC_VARS;
 
        PHP_ARRAY_CMP_FUNC_BACKUP();
index 6f728ed7952f51051c28c66487f6125947469746..6c99a396d50065d990256e65090fdb911f46fd25 100644 (file)
@@ -745,7 +745,7 @@ char *php_crypt_gensalt_blowfish_rn(unsigned long count,
        output[1] = '2';
        output[2] = 'a';
        output[3] = '$';
-       output[4] = '0' + count / 10;
+       output[4] = (char) ('0' + count / 10);
        output[5] = '0' + count % 10;
        output[6] = '$';
 
index f9daed909a601c4cb8b4e01e61df6efab3cac14d..26260992ef0948218bdb0cedec25074c62daa4f0 100644 (file)
@@ -470,7 +470,7 @@ char * php_sha256_crypt_r(const char *key, const char *salt, char *buffer, int b
        sha256_init_ctx(&alt_ctx);
 
        /* For every character in the password add the entire password.  */
-       for (cnt = 0; cnt < 16 + alt_result[0]; ++cnt) {
+       for (cnt = 0; cnt < (size_t) (16 + alt_result[0]); ++cnt) {
                sha256_process_bytes(salt, salt_len, &alt_ctx);
        }
 
index f78ff03981dc2a8711d284b80d0d17c7c89fb0f0..a51e11a37c208a9fd6c72a8be7934c752ffcc572 100644 (file)
@@ -506,7 +506,7 @@ php_sha512_crypt_r(const char *key, const char *salt, char *buffer, int buflen)
        sha512_init_ctx(&alt_ctx);
 
        /* For every character in the password add the entire password.  */
-       for (cnt = 0; cnt < 16 + alt_result[0]; ++cnt) {
+       for (cnt = 0; cnt < (size_t) (16 + alt_result[0]); ++cnt) {
                sha512_process_bytes(salt, salt_len, &alt_ctx);
        }
 
index d9ccff9dd0a81703a6746ebf6f59518018bd3e3c..f937e1dd3b5d36f09f55fab18ec10f4297aee1a8 100644 (file)
@@ -915,8 +915,8 @@ size_t php_utf32_utf8(unsigned char *buf, int k)
  */
 PHPAPI char *php_unescape_html_entities(unsigned char *old, int oldlen, int *newlen, int all, int quote_style, char *hint_charset TSRMLS_DC)
 {
-       int retlen;
-       int j, k;
+       int retlen, j;
+       unsigned int k;
        char *replaced, *ret, *p, *q, *lim, *next;
        enum entity_charset charset = determine_charset(hint_charset TSRMLS_CC);
        unsigned char replacement[15];
@@ -1355,7 +1355,7 @@ PHP_FUNCTION(htmlspecialchars_decode)
                        if (!memcmp(p, basic_entities_dec[j].entity, basic_entities_dec[j].entitylen)) {
                                int e_len = basic_entities_dec[j].entitylen - 1;
                
-                               *p++ = basic_entities_dec[j].charcode;
+                               *p++ = (char) basic_entities_dec[j].charcode;
                                memmove(p, p + e_len, (e - p - e_len));
                                e -= e_len;
                                goto done;
@@ -1412,7 +1412,8 @@ PHP_FUNCTION(htmlentities)
 PHP_FUNCTION(get_html_translation_table)
 {
        long which = HTML_SPECIALCHARS, quote_style = ENT_COMPAT;
-       int i, j;
+       unsigned int i;
+       int j;
        char ind[2];
        enum entity_charset charset = determine_charset(NULL TSRMLS_CC);
 
index d863e3dd8f1eacbc4df45c55fdc8562eee7da9d2..16a1602900cbb95fae6ad5f15a0e821f23c91f34 100644 (file)
@@ -181,7 +181,8 @@ PHP_FUNCTION(iptcembed)
        int iptcdata_len, jpeg_file_len;
        long spool = 0;
        FILE *fp;
-       unsigned int marker, done = 0, inx;
+       unsigned int marker, done = 0;
+       int inx;
        unsigned char *spoolbuf = NULL, *poi = NULL;
        struct stat sb;
        zend_bool written = 0;
@@ -295,7 +296,8 @@ PHP_FUNCTION(iptcembed)
    Parse binary IPTC-data into associative array */
 PHP_FUNCTION(iptcparse)
 {
-       unsigned int inx = 0, len, tagsfound = 0;
+       int inx = 0, len;
+       unsigned int tagsfound = 0;
        unsigned char *buffer, recnum, dataset, key[ 16 ];
        char *str;
        int str_len;
index e589a6edea3a52a3d466e1e0c495cf85c7dcce0c..0618138f15e1176383d79b188e0e7e903044fafd 100644 (file)
@@ -309,7 +309,7 @@ static void handle_form(STD_PARA)
 static inline void handle_tag(STD_PARA) 
 {
        int ok = 0;
-       int i;
+       unsigned int i;
 
        ctx->tag.len = 0;
        smart_str_appendl(&ctx->tag, start, YYCURSOR - start);
index 44879dab9ac04d15faa726b76146b56c5dee89b8..5cc16c7ece07129d5f310134528f67bf5cdb3cf8 100644 (file)
@@ -245,7 +245,7 @@ static void handle_form(STD_PARA)
 static inline void handle_tag(STD_PARA) 
 {
        int ok = 0;
-       int i;
+       unsigned int i;
 
        ctx->tag.len = 0;
        smart_str_appendl(&ctx->tag, start, YYCURSOR - start);