]> granicus.if.org Git - php/commitdiff
move all blah++ to ++blah where possible for those with crapass compilers
authorGreg Beaver <cellog@php.net>
Sat, 22 Mar 2008 22:11:49 +0000 (22:11 +0000)
committerGreg Beaver <cellog@php.net>
Sat, 22 Mar 2008 22:11:49 +0000 (22:11 +0000)
ext/phar/dirstream.c
ext/phar/func_interceptors.c
ext/phar/phar.c
ext/phar/phar_internal.h
ext/phar/phar_object.c
ext/phar/tar.c
ext/phar/util.c
ext/phar/zip.c

index 0819237376c7c6e3fdb82bc222be2767926fa878..c33b55d292c305e21494917553a3b755a1164b76 100644 (file)
@@ -79,7 +79,7 @@ static int phar_dir_seek(php_stream *stream, off_t offset, int whence, off_t *ne
                } else {
                        *newoffset = 0;
                        while (*newoffset < offset && zend_hash_move_forward(data) == SUCCESS) {
-                               (*newoffset)++;
+                               ++(*newoffset);
                        }
                        return 0;
                }
index c8d5de4b53241dcbe52b225d300c931ddec123f3..d12c49138203acf9d3254a7c74aaa4296f546ffe 100644 (file)
@@ -337,7 +337,7 @@ void phar_fancy_stat(struct stat *stat_sb, int type, zval *return_value TSRMLS_D
                        if(groups > 0) {
                                gids=(gid_t *)safe_emalloc(groups, sizeof(gid_t), 0);
                                n=getgroups(groups, gids);
-                               for(i=0;i<n;i++){
+                               for(i=0;i<n;++i){
                                        if(stat_sb->st_gid==gids[i]) {
                                                rmask=S_IRGRP;
                                                wmask=S_IWGRP;
index 6365c2ded788e30e8f2c7b1a81d75322a0874d1f..4bfaf76e9226100f78394a3412355177c33968e1 100644 (file)
@@ -141,7 +141,7 @@ ZEND_INI_DISP(phar_ini_extract_list_disp) /*void name(zend_ini_entry *ini_entry,
        
                        if (val) {      
                                *val++ = '\0';
-                               for (q = key; *q; q++) {
+                               for (q = key; *q; ++q) {
                                        *q = tolower(*q);
                                }
                                if (sapi_module.phpinfo_as_text) {
@@ -554,10 +554,10 @@ int phar_open_file(php_stream *fp, char *fname, int fname_len, char *alias, int
                        if (EOF == (nextchar = php_stream_getc(fp)) || (char)nextchar != '\n') {
                                MAPPHAR_ALLOC_FAIL("internal corruption of phar \"%s\" (truncated manifest at stub end)")
                        }
-                       halt_offset++;
+                       ++halt_offset;
                }
                if ((char) nextchar == '\n') {
-                       halt_offset++;
+                       ++halt_offset;
                }
        }
        /* make sure we are at the right location to read the manifest */
@@ -862,7 +862,7 @@ int phar_open_file(php_stream *fp, char *fname, int fname_len, char *alias, int
        entry.phar = mydata;
        entry.fp_type = PHAR_FP;
 
-       for (manifest_index = 0; manifest_index < manifest_count; manifest_index++) {
+       for (manifest_index = 0; manifest_index < manifest_count; ++manifest_index) {
                if (buffer + 4 > endbuffer) {
                        MAPPHAR_FAIL("internal corruption of phar \"%s\" (truncated manifest entry)")
                }
@@ -1436,7 +1436,7 @@ static inline int in_character_class(char ch, const char *delim)
                if (*delim == ch) {
                        return 1;
                }
-               delim++;
+               ++delim;
        }
        return 0;
 }
@@ -1450,7 +1450,7 @@ char *tsrm_strtok_r(char *s, const char *delim, char **last)
        }
 
        while (*s && in_character_class(*s, delim)) {
-               s++;
+               ++s;
        }
        if (!*s) {
                return NULL;
@@ -1459,7 +1459,7 @@ char *tsrm_strtok_r(char *s, const char *delim, char **last)
        token = s;
 
        while (*s && !in_character_class(*s, delim)) {
-               s++;
+               ++s;
        }
        if (!*s) {
                *last = s;
@@ -1540,8 +1540,7 @@ char *phar_fix_filepath(char *path, int *new_len, int use_cwd TSRMLS_DC) /* {{{
        if (new_phar_len == 0) {
                new_phar = (char *) erealloc(new_phar, new_phar_len+1+1);
                new_phar[new_phar_len] = '/';
-               new_phar[new_phar_len+1] = '\0';
-               new_phar_len++;
+               new_phar[++new_phar_len] = '\0';
        }
        *new_len = new_phar_len;
        return new_phar;
@@ -2042,7 +2041,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, long len, int convert,
                }
                newcrc32 = ~0;
                mytime = entry->uncompressed_filesize;
-               for (loc = 0;loc < mytime; loc++) {
+               for (loc = 0;loc < mytime; ++loc) {
                        CRC32(newcrc32, php_stream_getc(file));
                }
                entry->crc32 = ~newcrc32;
index 4e642f58c0d996a21cdcf209304547fc5f286fe4..ebab7fdd266a4fdc97103bc087b656329b167727 100755 (executable)
@@ -354,7 +354,7 @@ static inline void phar_unixify_path_separators(char *path, int path_len)
        char *s;
 
        /* unixify win paths */
-       for (s = path; s - path < path_len; s++) {
+       for (s = path; s - path < path_len; ++s) {
                if (*s == '\\') {
                        *s = '/';
                }
index 8fa35795003533bdecc4f1a5d9f52cf46aa5708c..2ef163b9654c4fcb20c58d5a1fc315fb3008b3e8 100755 (executable)
@@ -66,7 +66,7 @@ static int phar_file_type(HashTable *mimes, char *file, char **mime_type TSRMLS_
                /* no file extension = assume text/plain */
                return PHAR_MIME_OTHER;
        }
-       ext++;
+       ++ext;
        if (SUCCESS != zend_hash_find(mimes, ext, strlen(ext), (void **) &mime)) {
                *mime_type = "application/octet-stream";
                return PHAR_MIME_OTHER;
@@ -392,7 +392,7 @@ static void phar_postprocess_ru_web(char *fname, int fname_len, char **entry, in
                        if (u) {
                                u[0] = '/';
                                *ru = estrndup(u, u_len+1);
-                               u_len++;
+                               ++u_len;
                                u[0] = '\0';
                        } else {
                                *ru = NULL;
@@ -534,7 +534,7 @@ PHP_METHOD(Phar, webPhar)
        if (!basename) {
                basename = fname;
        } else {
-               basename++;
+               ++basename;
        }
 
        if ((strlen(sapi_module.name) == sizeof("cgi-fcgi")-1 && !strncmp(sapi_module.name, "cgi-fcgi", sizeof("cgi-fcgi")-1))
@@ -598,7 +598,7 @@ PHP_METHOD(Phar, webPhar)
                fci.param_count = 1;
                fci.params = zp;
 #if PHP_VERSION_ID < 50300
-               params->refcount++;
+               ++(params->refcount);
 #else
                Z_ADDREF_P(params);
 #endif
@@ -657,7 +657,7 @@ PHP_METHOD(Phar, webPhar)
                        entry_len = index_php_len;
                        if (entry[0] != '/') {
                                spprintf(&entry, 0, "/%s", index_php);
-                               entry_len++;
+                               ++entry_len;
                        }
                } else {
                        /* assume "index.php" is starting point */
@@ -1094,7 +1094,7 @@ static void phar_spl_foreign_clone(spl_filesystem_object *src, spl_filesystem_ob
 {
        phar_archive_data *phar_data = (phar_archive_data *) dst->oth;
 
-       phar_data->refcount++;
+       ++(phar_data->refcount);
 }
 /* }}} */
 
@@ -1179,7 +1179,7 @@ PHP_METHOD(Phar, __construct)
        }
 
        is_data = phar_data->is_data;
-       phar_data->refcount++;
+       ++(phar_data->refcount);
        phar_obj->arc.archive = phar_data;
        phar_obj->spl.oth_handler = &phar_spl_foreign_handler;
 
index a30998f96b921d477e782bb4e6d9259389ce40d8..17b6a7e9fcfba31dbce13f73c14241c8b977f9cf 100644 (file)
@@ -25,13 +25,13 @@ static php_uint32 phar_tar_number(char *buf, int len) /* {{{ */
        int i = 0;
 
        while (i < len && buf[i] == ' ') {
-               i++;
+               ++i;
        }
        while (i < len &&
               buf[i] >= '0' &&
               buf[i] <= '7') {
                num = num * 8 + (buf[i] - '0');
-               i++;
+               ++i;
        }
        return num;
 }
@@ -91,7 +91,7 @@ static php_uint32 phar_tar_checksum(char *buf, int len) /* {{{ */
 
        while (buf != end) {
                sum += (unsigned char)*buf;
-               buf++;
+               ++buf;
        }
        return sum;
 }
index d11d020f9a9c4f7531c21ec7b6e0bc84eca9b58e..aa3801ae0ff8579958c2eb6bf6d7e42f33eb4131 100644 (file)
@@ -137,12 +137,12 @@ void phar_rename_archive(phar_archive_data *phar, char *ext, zend_bool compress
        }
 
        if (ext[0] == '.') {
-               ext++;
+               ++ext;
        }
 
        oldpath = estrndup(phar->fname, phar->fname_len);
        oldname = strrchr(phar->fname, '/');
-       oldname++;
+       ++oldname;
 
        basename = estrndup(oldname, strlen(oldname));
        spprintf(&newname, 0, "%s.%s", strtok(basename, "."), ext);
@@ -361,7 +361,7 @@ doit:
                }
        }
        /* test for stream wrappers and return */
-       for (p = filename; p - filename < filename_len && (isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'); p++, n++);
+       for (p = filename; p - filename < filename_len && (isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'); ++p, ++n);
        if (n < filename_len - 3 && (*p == ':') && (!strncmp("//", p+1, 2) || ( filename_len > 4 && !memcmp("data", filename, 4)))) {
                /* found stream wrapper, this is an absolute path until stream wrappers implement realpath */
                return estrndup(filename, filename_len);
@@ -378,7 +378,7 @@ doit:
                        maybe_stream = 0;
                        goto not_stream;
                }
-               for (p = ptr, n = 0; p < end && (isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'); p++, n++);
+               for (p = ptr, n = 0; p < end && (isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'); ++p, ++n);
 
                if (n == end - ptr && *p && !strncmp("//", p+1, 2)) {
                        is_stream_wrapper = 1;
@@ -413,9 +413,7 @@ not_stream:
 
                if (!is_stream_wrapper && maybe_stream) {
                        /* search for stream wrapper */
-                       for (p = trypath, n = 0; isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'; p++) {
-                               n++;
-                       }
+                       for (p = trypath, n = 0; isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'; ++p, ++n);
                }
 
                if (is_stream_wrapper || (n < len - 3 && (*p == ':') && (n > 1) && (!strncmp("//", p+1, 2) || !memcmp("data", trypath, 4)))) {
@@ -475,7 +473,7 @@ not_stream:
                        memcpy(trypath+exec_fname_length + 1, filename, filename_len+1);
 
                        /* search for stream wrapper */
-                       for (p = trypath; isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'; p++, n++);
+                       for (p = trypath; isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'; ++p, ++n);
                        if (n < exec_fname_length - 3 && (*p == ':') && (n > 1) && (!strncmp("//", p+1, 2) || !memcmp("data", trypath, 4))) {
                                char *actual;
        
@@ -582,8 +580,8 @@ int phar_get_entry_data(phar_entry_data **ret, char *fname, int fname_len, char
                (*ret)->internal_file = entry;
                (*ret)->is_zip = entry->is_zip;
                (*ret)->is_tar = entry->is_tar;
-               entry->phar->refcount++;
-               entry->fp_refcount++;
+               ++(entry->phar->refcount);
+               ++(entry->fp_refcount);
                return SUCCESS;
        }
        if (entry->fp_type == PHAR_MOD) {
@@ -620,8 +618,8 @@ int phar_get_entry_data(phar_entry_data **ret, char *fname, int fname_len, char
        (*ret)->is_tar = entry->is_tar;
        (*ret)->fp = phar_get_efp(entry TSRMLS_CC);
        (*ret)->zero = entry->offset;
-       entry->fp_refcount++;
-       entry->phar->refcount++;
+       ++(entry->fp_refcount);
+       ++(entry->phar->refcount);
        return SUCCESS;
 }
 /* }}} */
@@ -701,7 +699,7 @@ phar_entry_data *phar_get_or_create_entry_data(char *fname, int fname_len, char
                return NULL;
        }
 
-       phar->refcount++;
+       ++(phar->refcount);
        ret->phar = phar;
        ret->fp = entry->fp;
        ret->position = ret->zero = 0;
index d7d3891b1cc9588ac7d5fb7e8c029080ef64e375..243b176e22c112361a81bee20d9022207f3b7082 100644 (file)
@@ -233,7 +233,7 @@ foundit:
                        return FAILURE
 
        /* add each central directory item to the manifest */
-       for (i = 0; i < locator.count; i++) {
+       for (i = 0; i < locator.count; ++i) {
                phar_zip_central_dir_file zipentry;
 
                if (sizeof(zipentry) != php_stream_read(fp, (char *) &zipentry, sizeof(zipentry))) {
@@ -485,7 +485,7 @@ static int phar_zip_changed_apply(void *data, void *arg TSRMLS_DC) /* {{{ */
                efp = phar_get_efp(entry TSRMLS_CC);
 
                newcrc32 = ~0;
-               for (loc = 0;loc < entry->uncompressed_filesize; loc++) {
+               for (loc = 0;loc < entry->uncompressed_filesize; ++loc) {
                        CRC32(newcrc32, php_stream_getc(efp));
                }
                entry->crc32 = ~newcrc32;