From: Greg Beaver Date: Sat, 22 Mar 2008 22:11:49 +0000 (+0000) Subject: move all blah++ to ++blah where possible for those with crapass compilers X-Git-Tag: RELEASE_2_0_0a1~36 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6cef8da201e5aa819cf79a8c1fc506f567f94637;p=php move all blah++ to ++blah where possible for those with crapass compilers --- diff --git a/ext/phar/dirstream.c b/ext/phar/dirstream.c index 0819237376..c33b55d292 100644 --- a/ext/phar/dirstream.c +++ b/ext/phar/dirstream.c @@ -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; } diff --git a/ext/phar/func_interceptors.c b/ext/phar/func_interceptors.c index c8d5de4b53..d12c491382 100644 --- a/ext/phar/func_interceptors.c +++ b/ext/phar/func_interceptors.c @@ -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;ist_gid==gids[i]) { rmask=S_IRGRP; wmask=S_IWGRP; diff --git a/ext/phar/phar.c b/ext/phar/phar.c index 6365c2ded7..4bfaf76e92 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -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; diff --git a/ext/phar/phar_internal.h b/ext/phar/phar_internal.h index 4e642f58c0..ebab7fdd26 100755 --- a/ext/phar/phar_internal.h +++ b/ext/phar/phar_internal.h @@ -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 = '/'; } diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 8fa3579500..2ef163b965 100755 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -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; diff --git a/ext/phar/tar.c b/ext/phar/tar.c index a30998f96b..17b6a7e9fc 100644 --- a/ext/phar/tar.c +++ b/ext/phar/tar.c @@ -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; } diff --git a/ext/phar/util.c b/ext/phar/util.c index d11d020f9a..aa3801ae0f 100644 --- a/ext/phar/util.c +++ b/ext/phar/util.c @@ -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; diff --git a/ext/phar/zip.c b/ext/phar/zip.c index d7d3891b1c..243b176e22 100644 --- a/ext/phar/zip.c +++ b/ext/phar/zip.c @@ -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;