]> granicus.if.org Git - php/commitdiff
yet more fixes to zpp
authorAnatol Belski <ab@php.net>
Wed, 20 Aug 2014 12:46:14 +0000 (14:46 +0200)
committerAnatol Belski <ab@php.net>
Wed, 20 Aug 2014 12:46:14 +0000 (14:46 +0200)
18 files changed:
ext/standard/basic_functions.c
ext/standard/crypt.c
ext/standard/exec.c
ext/standard/file.c
ext/standard/filters.c
ext/standard/head.c
ext/standard/html.c
ext/standard/http.c
ext/standard/http_fopen_wrapper.c
ext/standard/image.c
ext/standard/info.c
ext/standard/iptc.c
ext/standard/levenshtein.c
ext/standard/mail.c
ext/standard/password.c
ext/standard/php_smart_string.h
ext/standard/streamsfuncs.c
main/php_variables.c

index 69e85a5aa6271ae03f18171bc59d849bbdcd3f71..a00b05d44d35b82e7ba798d1fc6cdaaf4a894620 100644 (file)
@@ -99,7 +99,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
 #endif
 
 #ifndef INADDR_NONE
-#define INADDR_NONE ((unsigned long int) -1)
+#define INADDR_NONE ((php_uint_t) -1)
 #endif
 
 #include "zend_globals.h"
@@ -3914,7 +3914,7 @@ PHP_FUNCTION(ip2long)
 #ifdef HAVE_INET_PTON
        struct in_addr ip;
 #else
-       unsigned long int ip;
+       php_uint_t ip;
 #endif
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &addr, &addr_len) == FAILURE) {
@@ -3950,7 +3950,7 @@ PHP_FUNCTION(long2ip)
        /* "It's a long but it's not, PHP ints are signed */
        char *ip;
        int ip_len;
-       unsigned long n;
+       php_uint_t n;
        struct in_addr myaddr;
 #ifdef HAVE_INET_PTON
        char str[40];
@@ -4428,10 +4428,10 @@ PHP_FUNCTION(usleep)
    Delay for a number of seconds and nano seconds */
 PHP_FUNCTION(time_nanosleep)
 {
-       long tv_sec, tv_nsec;
+       php_int_t tv_sec, tv_nsec;
        struct timespec php_req, php_rem;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &tv_sec, &tv_nsec) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &tv_sec, &tv_nsec) == FAILURE) {
                return;
        }
 
index 86ae9bee13849ae640bff429f5fba9d699c223fd..47436398ff7c4ceca7fc2820b70a8d1d644e3e7c 100644 (file)
@@ -136,7 +136,7 @@ PHP_MSHUTDOWN_FUNCTION(crypt) /* {{{ */
 
 static unsigned char itoa64[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
 
-static void php_to64(char *s, long v, int n) /* {{{ */
+static void php_to64(char *s, php_int_t v, int n) /* {{{ */
 {
        while (--n >= 0) {
                *s++ = itoa64[v&0x3f];
index 87e73ee4f2ee676abae92ec8f5376f47579cf04e..72878f9c9e8cecb105e61eca10928e5f2e2e75f2 100644 (file)
@@ -470,9 +470,9 @@ PHP_FUNCTION(shell_exec)
    Change the priority of the current process */
 PHP_FUNCTION(proc_nice)
 {
-       long pri;
+       php_int_t pri;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &pri) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &pri) == FAILURE) {
                RETURN_FALSE;
        }
 
index c58db9fd64449b85193440a2820acdda842c5343..1b599b84a01b867d9ed1d428348fececcf83e5e6 100644 (file)
@@ -1340,11 +1340,11 @@ PHP_FUNCTION(mkdir)
        char *dir;
        int dir_len;
        zval *zcontext = NULL;
-       long mode = 0777;
+       php_int_t mode = 0777;
        zend_bool recursive = 0;
        php_stream_context *context;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|lbr", &dir, &dir_len, &mode, &recursive, &zcontext) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|ibr", &dir, &dir_len, &mode, &recursive, &zcontext) == FAILURE) {
                RETURN_FALSE;
        }
 
@@ -2454,9 +2454,9 @@ PHP_FUNCTION(fnmatch)
 {
        char *pattern, *filename;
        int pattern_len, filename_len;
-       long flags = 0;
+       php_int_t flags = 0;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp|l", &pattern, &pattern_len, &filename, &filename_len, &flags) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp|i", &pattern, &pattern_len, &filename, &filename_len, &flags) == FAILURE) {
                return;
        }
 
index 9a0dc672c4fbe677c1d722cd7b59f81099c88740..7944cdc4c71ebe57a0e07a6411620441f5a5d309 100644 (file)
@@ -1306,7 +1306,7 @@ static php_conv_err_t php_conv_get_bool_prop_ex(const HashTable *ht, int *pretva
 #if IT_WAS_USED
 static int php_conv_get_int_prop_ex(const HashTable *ht, int *pretval, char *field_name, size_t field_name_len)
 {
-       long l;
+       php_int_t l;
        php_conv_err_t err;
 
        *pretval = 0;
index ec792bee2c1de5cd31bf5beffdc962ef937a6af6..928c26293ed6b8a03025dc3467906a021b60143b 100644 (file)
@@ -41,7 +41,7 @@ PHP_FUNCTION(header)
        zend_bool rep = 1;
        sapi_header_line ctr = {0};
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bl", &ctr.line,
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bi", &ctr.line,
                                &ctr.line_len, &rep, &ctr.response_code) == FAILURE)
                return;
 
@@ -178,11 +178,11 @@ PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, t
 PHP_FUNCTION(setcookie)
 {
        char *name, *value = NULL, *path = NULL, *domain = NULL;
-       long expires = 0;
+       php_int_t expires = 0;
        zend_bool secure = 0, httponly = 0;
        int name_len, value_len = 0, path_len = 0, domain_len = 0;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|slssbb", &name,
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sissbb", &name,
                                                          &name_len, &value, &value_len, &expires, &path,
                                                          &path_len, &domain, &domain_len, &secure, &httponly) == FAILURE) {
                return;
@@ -201,11 +201,11 @@ PHP_FUNCTION(setcookie)
 PHP_FUNCTION(setrawcookie)
 {
        char *name, *value = NULL, *path = NULL, *domain = NULL;
-       long expires = 0;
+       php_int_t expires = 0;
        zend_bool secure = 0, httponly = 0;
        int name_len, value_len = 0, path_len = 0, domain_len = 0;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|slssbb", &name,
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sissbb", &name,
                                                          &name_len, &value, &value_len, &expires, &path,
                                                          &path_len, &domain, &domain_len, &secure, &httponly) == FAILURE) {
                return;
@@ -289,15 +289,15 @@ PHP_FUNCTION(headers_list)
    Sets a response code, or returns the current HTTP response code */
 PHP_FUNCTION(http_response_code)
 {
-       long response_code = 0;
+       php_int_t response_code = 0;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &response_code) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &response_code) == FAILURE) {
                return;
        }
 
        if (response_code)
        {
-               long old_response_code;
+               php_int_t old_response_code;
 
                old_response_code = SG(sapi_headers).http_response_code;
                SG(sapi_headers).http_response_code = response_code;
index abb15f24402b30827d3ef7b16645385e5608bb2c..7df76708a920c4d72a26e1e02975904d8b3e8490 100644 (file)
@@ -790,7 +790,7 @@ static inline int numeric_entity_is_allowed(unsigned uni_cp, int document_type)
  */
 static inline int process_numeric_entity(const char **buf, unsigned *code_point)
 {
-       long code_l;
+       php_int_t code_l;
        int hexadecimal = (**buf == 'x' || **buf == 'X'); /* TODO: XML apparently disallows "X" */
        char *endptr;
 
@@ -804,7 +804,7 @@ static inline int process_numeric_entity(const char **buf, unsigned *code_point)
                return FAILURE;
        }
 
-       code_l = strtol(*buf, &endptr, hexadecimal ? 16 : 10);
+       code_l = ZEND_STRTOI(*buf, &endptr, hexadecimal ? 16 : 10);
        /* we're guaranteed there were valid digits, so *endptr > buf */
        *buf = endptr;
 
@@ -813,7 +813,7 @@ static inline int process_numeric_entity(const char **buf, unsigned *code_point)
 
        /* many more are invalid, but that depends on whether it's HTML
         * (and which version) or XML. */
-       if (code_l > 0x10FFFFL)
+       if (code_l > Z_I(0x10FFFF))
                return FAILURE;
 
        if (code_point != NULL)
@@ -1506,10 +1506,10 @@ PHP_FUNCTION(htmlspecialchars_decode)
 {
        char *str;
        int str_len;
-       long quote_style = ENT_COMPAT;
+       php_int_t quote_style = ENT_COMPAT;
        zend_string *replaced;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &quote_style) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &str, &str_len, &quote_style) == FAILURE) {
                return;
        }
 
@@ -1626,7 +1626,7 @@ static inline void write_s3row_data(
    Returns the internal translation table used by htmlspecialchars and htmlentities */
 PHP_FUNCTION(get_html_translation_table)
 {
-       long all = HTML_SPECIALCHARS,
+       php_int_t all = HTML_SPECIALCHARS,
                 flags = ENT_COMPAT;
        int doctype;
        entity_table_opt entity_table;
@@ -1639,7 +1639,7 @@ PHP_FUNCTION(get_html_translation_table)
         * getting the translated table from data structures that are optimized for
         * random access, not traversal */
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lls",
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|iis",
                        &all, &flags, &charset_hint, &charset_hint_len) == FAILURE) {
                return;
        }
index 27642da738caacf0d5d02b6f774a8e509d04e501..d5eb78e4170d7d8aae1d5b662374f89a4ac18a66 100644 (file)
@@ -241,9 +241,9 @@ PHP_FUNCTION(http_build_query)
        char *prefix = NULL, *arg_sep=NULL;
        int arg_sep_len = 0, prefix_len = 0;
        smart_str formstr = {0};
-       long enc_type = PHP_QUERY_RFC1738;
+       php_int_t enc_type = PHP_QUERY_RFC1738;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ssl", &formdata, &prefix, &prefix_len, &arg_sep, &arg_sep_len, &enc_type) != SUCCESS) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ssi", &formdata, &prefix, &prefix_len, &arg_sep, &arg_sep_len, &enc_type) != SUCCESS) {
                RETURN_FALSE;
        }
 
index 7e8ddd51d4b22abfe54e592210151b6fb250cbee..4359c34efacb1c724763c34ba8b3e73f280c9133 100644 (file)
@@ -749,7 +749,7 @@ finish:
 
                                /* create filter to decode response body */
                                if (!(options & STREAM_ONLY_GET_HEADERS)) {
-                                       long decode = 1;
+                                       php_int_t decode = 1;
 
                                        if (context && (tmpzval = php_stream_context_get_option(context, "http", "auto_decode")) != NULL) {
                                                decode = zend_is_true(tmpzval TSRMLS_CC);
index 87ab458800a5a4184c8b96852e67eb8b0d326b60..24576fd6713e621330a3468c2fbb48b4ac3f1d9e 100644 (file)
@@ -1160,9 +1160,9 @@ PHPAPI char * php_image_type_to_mime_type(int image_type)
    Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype */
 PHP_FUNCTION(image_type_to_mime_type)
 {
-       long p_image_type;
+       php_int_t p_image_type;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &p_image_type) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &p_image_type) == FAILURE) {
                return;
        }
 
@@ -1174,10 +1174,10 @@ PHP_FUNCTION(image_type_to_mime_type)
    Get file extension for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype */
 PHP_FUNCTION(image_type_to_extension)
 {
-       long image_type;
+       php_int_t image_type;
        zend_bool inc_dot=1;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|b", &image_type, &inc_dot) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|b", &image_type, &inc_dot) == FAILURE) {
                RETURN_FALSE;
        }
 
index 27bc683ba50e816f2ece8225588928ed681ca053..07c183df8e30934d2cf552b4963dbfd72776f7f5 100644 (file)
@@ -1166,9 +1166,9 @@ void register_phpinfo_constants(INIT_FUNC_ARGS)
    Output a page of useful information about PHP and the current request */
 PHP_FUNCTION(phpinfo)
 {
-       long flag = PHP_INFO_ALL;
+       php_int_t flag = PHP_INFO_ALL;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flag) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &flag) == FAILURE) {
                return;
        }
 
@@ -1210,9 +1210,9 @@ PHP_FUNCTION(phpversion)
    Prints the list of people who've contributed to the PHP project */
 PHP_FUNCTION(phpcredits)
 {
-       long flag = PHP_CREDITS_ALL;
+       php_int_t flag = PHP_CREDITS_ALL;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flag) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &flag) == FAILURE) {
                return;
        }
 
index cea43dd8d3666e620873d4bee1cbb3844e7305aa..9102b4b07ac15370442f148792dfbeeb3c3ccf34 100644 (file)
@@ -179,7 +179,7 @@ PHP_FUNCTION(iptcembed)
 {
        char *iptcdata, *jpeg_file;
        int iptcdata_len, jpeg_file_len;
-       long spool = 0;
+       php_int_t spool = 0;
        FILE *fp;
        unsigned int marker, done = 0;
        int inx;
@@ -187,7 +187,7 @@ PHP_FUNCTION(iptcembed)
        struct stat sb;
        zend_bool written = 0;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sp|l", &iptcdata, &iptcdata_len, &jpeg_file, &jpeg_file_len, &spool) != SUCCESS) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sp|i", &iptcdata, &iptcdata_len, &jpeg_file, &jpeg_file_len, &spool) != SUCCESS) {
                return;
        }
 
@@ -334,8 +334,8 @@ PHP_FUNCTION(iptcparse)
                        if((inx+6) >= str_len) {
                                break;
                        }
-                       len = (((long) buffer[ inx + 2 ]) << 24) + (((long) buffer[ inx + 3 ]) << 16) + 
-                                 (((long) buffer[ inx + 4 ]) <<  8) + (((long) buffer[ inx + 5 ]));
+                       len = (((php_int_t) buffer[ inx + 2 ]) << 24) + (((php_int_t) buffer[ inx + 3 ]) << 16) + 
+                                 (((php_int_t) buffer[ inx + 4 ]) <<  8) + (((php_int_t) buffer[ inx + 5 ]));
                        inx += 6;
                } else { /* short tag */
                        len = (((unsigned short) buffer[ inx ])<<8) | (unsigned short)buffer[ inx+1 ];
index 86ce0f2fbec9e3624b712062d09e00a8907e3473..232366e0301f95318562a540ddc5719e81773592 100644 (file)
@@ -95,7 +95,7 @@ PHP_FUNCTION(levenshtein)
        char *str1, *str2;
        char *callback_name;
        int str1_len, str2_len, callback_len;
-       long cost_ins, cost_rep, cost_del;
+       php_int_t cost_ins, cost_rep, cost_del;
        int distance = -1;
 
        switch (argc) {
@@ -107,7 +107,7 @@ PHP_FUNCTION(levenshtein)
                        break;
 
                case 5: /* more general version: calc cost by ins/rep/del weights */
-                       if (zend_parse_parameters(5 TSRMLS_CC, "sslll", &str1, &str1_len, &str2, &str2_len, &cost_ins, &cost_rep, &cost_del) == FAILURE) {
+                       if (zend_parse_parameters(5 TSRMLS_CC, "ssiii", &str1, &str1_len, &str2, &str2_len, &cost_ins, &cost_rep, &cost_del) == FAILURE) {
                                return;
                        }
                        distance = reference_levdist(str1, str1_len, str2, str2_len, cost_ins, cost_rep, cost_del);
index b08c4858e8623f6b64a9585c9736edf871a03ece..1bd2fa9016cfe1f264b5905f01b1591f92036d00 100644 (file)
@@ -72,7 +72,7 @@
                *p = ' ';                                                               \
        }                                                                                       \
 
-extern long php_getuid(TSRMLS_D);
+extern php_int_t php_getuid(TSRMLS_D);
 
 /* {{{ proto int ezmlm_hash(string addr)
    Calculate EZMLM list hash value. */
index d001e475f0893b60f8f455cf5279683a8d32d98b..23e0ae425980d6d6ff021c6c70c1fdddc21d4ec9 100644 (file)
@@ -195,8 +195,8 @@ PHP_FUNCTION(password_get_info)
        switch (algo) {
                case PHP_PASSWORD_BCRYPT:
                        {
-                               long cost = PHP_PASSWORD_BCRYPT_COST;
-                               sscanf(hash, "$2y$%ld$", &cost);
+                               php_int_t cost = PHP_PASSWORD_BCRYPT_COST;
+                               sscanf(hash, "$2y$" ZEND_INT_FMT "$", &cost);
                                add_assoc_int(&options, "cost", cost);
                        }
                        break;
@@ -214,14 +214,14 @@ PHP_FUNCTION(password_get_info)
 
 PHP_FUNCTION(password_needs_rehash)
 {
-       long new_algo = 0;
+       php_int_t new_algo = 0;
        php_password_algo algo;
        int hash_len;
        char *hash;
        HashTable *options = 0;
        zval *option_buffer;
        
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|H", &hash, &hash_len, &new_algo, &options) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|H", &hash, &hash_len, &new_algo, &options) == FAILURE) {
                return;
        }
 
@@ -239,7 +239,7 @@ PHP_FUNCTION(password_needs_rehash)
        switch (algo) {
                case PHP_PASSWORD_BCRYPT:
                        {
-                               long new_cost = PHP_PASSWORD_BCRYPT_COST, cost = 0;
+                               php_int_t new_cost = PHP_PASSWORD_BCRYPT_COST, cost = 0;
                                
                                if (options && (option_buffer = zend_symtable_str_find(options, "cost", sizeof("cost")-1)) != NULL) {
                                        if (Z_TYPE_P(option_buffer) != IS_INT) {
@@ -253,7 +253,7 @@ PHP_FUNCTION(password_needs_rehash)
                                        }
                                }
 
-                               sscanf(hash, "$2y$%ld$", &cost);
+                               sscanf(hash, "$2y$" ZEND_INT_FMT "$", &cost);
                                if (cost != new_cost) {
                                        RETURN_TRUE;
                                }
@@ -307,21 +307,21 @@ Hash a password */
 PHP_FUNCTION(password_hash)
 {
        char *hash_format, *hash, *salt, *password;
-       long algo = 0;
+       php_int_t algo = 0;
        int password_len = 0, hash_len;
        size_t salt_len = 0, required_salt_len = 0, hash_format_len;
        HashTable *options = 0;
        zval *option_buffer;
        zend_string *result;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|H", &password, &password_len, &algo, &options) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|H", &password, &password_len, &algo, &options) == FAILURE) {
                return;
        }
 
        switch (algo) {
                case PHP_PASSWORD_BCRYPT:
                {
-                       long cost = PHP_PASSWORD_BCRYPT_COST;
+                       php_int_t cost = PHP_PASSWORD_BCRYPT_COST;
        
                        if (options && (option_buffer = zend_symtable_str_find(options, "cost", sizeof("cost")-1)) != NULL) {
                                if (Z_TYPE_P(option_buffer) != IS_INT) {
@@ -336,7 +336,7 @@ PHP_FUNCTION(password_hash)
                        }
        
                        if (cost < 4 || cost > 31) {
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid bcrypt cost parameter specified: %ld", cost);
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid bcrypt cost parameter specified: " ZEND_INT_FMT, cost);
                                RETURN_NULL();
                        }
                        
@@ -348,7 +348,7 @@ PHP_FUNCTION(password_hash)
                break;
                case PHP_PASSWORD_UNKNOWN:
                default:
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown password hashing algorithm: %ld", algo);
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown password hashing algorithm: " ZEND_INT_FMT, algo);
                        RETURN_NULL();
        }
 
index 02ba9fe84e2a1616a474b045d749fe1917663c55..83d59054dde26a06d364c3eeb66effad9f8ac7a0 100644 (file)
        __dest->len = __nl;                                                                                             \
 } while (0)
 
-static inline char *smart_string_print_long(char *buf, long num) {
+static inline char *smart_string_print_long(char *buf, php_int_t num) {
        char *r; 
        _zend_print_signed_to_buf(buf, num, unsigned long, r); 
        return r;
 }
 
-static inline char *smart_string_print_unsigned(char *buf, long num) {
+static inline char *smart_string_print_unsigned(char *buf, php_int_t num) {
        char *r; 
        _zend_print_unsigned_to_buf(buf, num, unsigned long, r); 
        return r;
index 95c4c49aecc0b6172a94b82e2283e755cee291a4..baa28a14b1b120a2c021e95058438e00f395c5d3 100644 (file)
@@ -51,11 +51,11 @@ static php_stream_context *decode_context_param(zval *contextresource TSRMLS_DC)
    Creates a pair of connected, indistinguishable socket streams */
 PHP_FUNCTION(stream_socket_pair)
 {
-       long domain, type, protocol;
+       php_int_t domain, type, protocol;
        php_stream *s1, *s2;
        php_socket_t pair[2];
 
-       if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll",
+       if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii",
                        &domain, &type, &protocol)) {
                RETURN_FALSE;
        }
@@ -96,13 +96,13 @@ PHP_FUNCTION(stream_socket_client)
        char *hashkey = NULL;
        php_stream *stream = NULL;
        int err;
-       long flags = PHP_STREAM_CLIENT_CONNECT;
+       php_int_t flags = PHP_STREAM_CLIENT_CONNECT;
        zend_string *errstr = NULL;
        php_stream_context *context = NULL;
 
        RETVAL_FALSE;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z/z/dlr", &host, &host_len, &zerrno, &zerrstr, &timeout, &flags, &zcontext) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z/z/dir", &host, &host_len, &zerrno, &zerrstr, &timeout, &flags, &zcontext) == FAILURE) {
                RETURN_FALSE;
        }
 
@@ -180,13 +180,13 @@ PHP_FUNCTION(stream_socket_server)
        zval *zerrno = NULL, *zerrstr = NULL, *zcontext = NULL;
        php_stream *stream = NULL;
        int err = 0;
-       long flags = STREAM_XPORT_BIND | STREAM_XPORT_LISTEN;
+       php_int_t flags = STREAM_XPORT_BIND | STREAM_XPORT_LISTEN;
        zend_string *errstr = NULL;
        php_stream_context *context = NULL;
 
        RETVAL_FALSE;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z/z/lr", &host, &host_len, &zerrno, &zerrstr, &flags, &zcontext) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z/z/ir", &host, &host_len, &zerrno, &zerrstr, &flags, &zcontext) == FAILURE) {
                RETURN_FALSE;
        }
 
@@ -321,13 +321,13 @@ PHP_FUNCTION(stream_socket_sendto)
 {
        php_stream *stream;
        zval *zstream;
-       long flags = 0;
+       php_int_t flags = 0;
        char *data, *target_addr = NULL;
        int datalen, target_addr_len = 0;
        php_sockaddr_storage sa;
        socklen_t sl = 0;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|ls", &zstream, &data, &datalen, &flags, &target_addr, &target_addr_len) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|is", &zstream, &data, &datalen, &flags, &target_addr, &target_addr_len) == FAILURE) {
                RETURN_FALSE;
        }
        php_stream_from_zval(stream, zstream);
@@ -351,12 +351,12 @@ PHP_FUNCTION(stream_socket_recvfrom)
        php_stream *stream;
        zval *zstream, *zremote = NULL;
        zend_string *remote_addr = NULL;
-       long to_read = 0;
+       php_int_t to_read = 0;
        zend_string *read_buf;
-       long flags = 0;
+       php_int_t flags = 0;
        int recvd;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|lz/", &zstream, &to_read, &flags, &zremote) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|iz/", &zstream, &to_read, &flags, &zremote) == FAILURE) {
                RETURN_FALSE;
        }
 
@@ -398,11 +398,11 @@ PHP_FUNCTION(stream_get_contents)
 {
        php_stream      *stream;
        zval            *zsrc;
-       long            maxlen          = PHP_STREAM_COPY_ALL,
+       php_int_t               maxlen          = PHP_STREAM_COPY_ALL,
                                desiredpos      = -1L;
        zend_string *contents;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ll", &zsrc, &maxlen, &desiredpos) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ii", &zsrc, &maxlen, &desiredpos) == FAILURE) {
                RETURN_FALSE;
        }
 
@@ -446,11 +446,11 @@ PHP_FUNCTION(stream_copy_to_stream)
 {
        php_stream *src, *dest;
        zval *zsrc, *zdest;
-       long maxlen = PHP_STREAM_COPY_ALL, pos = 0;
+       php_int_t maxlen = PHP_STREAM_COPY_ALL, pos = 0;
        size_t len;
        int ret;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|ll", &zsrc, &zdest, &maxlen, &pos) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|ii", &zsrc, &zdest, &maxlen, &pos) == FAILURE) {
                RETURN_FALSE;
        }
 
@@ -458,7 +458,7 @@ PHP_FUNCTION(stream_copy_to_stream)
        php_stream_from_zval(dest, zdest);
 
        if (pos > 0 && php_stream_seek(src, pos, SEEK_SET) < 0) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to position %ld in the stream", pos);
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to position " ZEND_INT_FMT " in the stream", pos);
                RETURN_FALSE;
        }
 
@@ -723,10 +723,10 @@ PHP_FUNCTION(stream_select)
        fd_set                  rfds, wfds, efds;
        php_socket_t    max_fd = 0;
        int                             retval, sets = 0;
-       long                    usec = 0;
+       php_int_t                       usec = 0;
        int                             set_count, max_set_count = 0;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/!a/!a/!z!|l", &r_array, &w_array, &e_array, &sec, &usec) == FAILURE)
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/!a/!a/!z!|i", &r_array, &w_array, &e_array, &sec, &usec) == FAILURE)
                return;
 
        FD_ZERO(&rfds);
@@ -1118,12 +1118,12 @@ static void apply_filter_to_stream(int append, INTERNAL_FUNCTION_PARAMETERS)
        php_stream *stream;
        char *filtername;
        int filternamelen;
-       long read_write = 0;
+       php_int_t read_write = 0;
        zval *filterparams = NULL;
        php_stream_filter *filter = NULL;
        int ret;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|lz", &zstream,
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|iz", &zstream,
                                &filtername, &filternamelen, &read_write, &filterparams) == FAILURE) {
                RETURN_FALSE;
        }
@@ -1242,12 +1242,12 @@ PHP_FUNCTION(stream_get_line)
 {
        char *str = NULL;
        int str_len = 0;
-       long max_length;
+       php_int_t max_length;
        zval *zstream;
        zend_string *buf;
        php_stream *stream;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|s", &zstream, &max_length, &str, &str_len) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|s", &zstream, &max_length, &str, &str_len) == FAILURE) {
                RETURN_FALSE;
        }
 
@@ -1276,10 +1276,10 @@ PHP_FUNCTION(stream_set_blocking)
 {
        zval *arg1;
        int block;
-       long arg2;
+       php_int_t arg2;
        php_stream *stream;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &arg1, &arg2) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &arg1, &arg2) == FAILURE) {
                return;
        }
 
@@ -1302,12 +1302,12 @@ PHP_FUNCTION(stream_set_blocking)
 PHP_FUNCTION(stream_set_timeout)
 {
        zval *socket;
-       long seconds, microseconds = 0;
+       php_int_t seconds, microseconds = 0;
        struct timeval t;
        php_stream *stream;
        int argc = ZEND_NUM_ARGS();
 
-       if (zend_parse_parameters(argc TSRMLS_CC, "rl|l", &socket, &seconds, &microseconds) == FAILURE) {
+       if (zend_parse_parameters(argc TSRMLS_CC, "ri|i", &socket, &seconds, &microseconds) == FAILURE) {
                return;
        }
 
@@ -1337,11 +1337,11 @@ PHP_FUNCTION(stream_set_write_buffer)
 {
        zval *arg1;
        int ret;
-       long arg2;
+       php_int_t arg2;
        size_t buff;
        php_stream *stream;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &arg1, &arg2) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &arg1, &arg2) == FAILURE) {
                RETURN_FALSE;
        }
 
@@ -1365,16 +1365,16 @@ PHP_FUNCTION(stream_set_write_buffer)
 PHP_FUNCTION(stream_set_chunk_size)
 {
        int                     ret;
-       long            csize;
+       php_int_t               csize;
        zval            *zstream;
        php_stream      *stream;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zstream, &csize) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &zstream, &csize) == FAILURE) {
                RETURN_FALSE;
        }
 
        if (csize <= 0) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "The chunk size must be a positive integer, given %ld", csize);
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "The chunk size must be a positive integer, given " ZEND_INT_FMT, csize);
                RETURN_FALSE;
        }
        /* stream.chunk_size is actually a size_t, but php_stream_set_option 
@@ -1390,7 +1390,7 @@ PHP_FUNCTION(stream_set_chunk_size)
 
        ret = php_stream_set_option(stream, PHP_STREAM_OPTION_SET_CHUNK_SIZE, (int)csize, NULL);
        
-       RETURN_INT(ret > 0 ? (long)ret : (long)EOF);
+       RETURN_INT(ret > 0 ? (php_int_t)ret : (php_int_t)EOF);
 }
 /* }}} */
 
@@ -1400,11 +1400,11 @@ PHP_FUNCTION(stream_set_read_buffer)
 {
        zval *arg1;
        int ret;
-       long arg2;
+       php_int_t arg2;
        size_t buff;
        php_stream *stream;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &arg1, &arg2) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &arg1, &arg2) == FAILURE) {
                RETURN_FALSE;
        }
 
@@ -1427,13 +1427,13 @@ PHP_FUNCTION(stream_set_read_buffer)
    Enable or disable a specific kind of crypto on the stream */
 PHP_FUNCTION(stream_socket_enable_crypto)
 {
-       long cryptokind = 0;
+       php_int_t cryptokind = 0;
        zval *zstream, *zsessstream = NULL;
        php_stream *stream, *sessstream = NULL;
        zend_bool enable, cryptokindnull;
        int ret;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb|l!r", &zstream, &enable, &cryptokind, &cryptokindnull, &zsessstream) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb|i!r", &zstream, &enable, &cryptokind, &cryptokindnull, &zsessstream) == FAILURE) {
                RETURN_FALSE;
        }
 
@@ -1558,11 +1558,11 @@ PHP_FUNCTION(stream_supports_lock)
        disallowed. */
 PHP_FUNCTION(stream_socket_shutdown)
 {
-       long how;
+       php_int_t how;
        zval *zstream;
        php_stream *stream;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zstream, &how) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &zstream, &how) == FAILURE) {
                RETURN_FALSE;
        }
 
index 8a38e97d6092c90f5a972016f7f6c54b9e78505a..949bd6c6b02c8e1cdb6288d2150383a2f1a44d21 100644 (file)
@@ -358,7 +358,7 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data)
        zval array;
        int free_buffer = 0;
        char *strtok_buf = NULL;
-       long count = 0;
+       php_int_t count = 0;
        
        ZVAL_UNDEF(&array);
        switch (arg) {