diff options
author | Guenter Knauf <guenter@php.net> | 2009-08-26 02:16:41 +0000 |
---|---|---|
committer | Guenter Knauf <guenter@php.net> | 2009-08-26 02:16:41 +0000 |
commit | 7a4e20ca25e014777744ecd419baa1bea7e017e1 (patch) | |
tree | be12eadb468f6b52c8792848ffb930ad28dccc95 /ext/zip/php_zip.c | |
parent | ef5691ff42772f4cbed0e0dce4c81e3754bef9c0 (diff) | |
download | php-git-7a4e20ca25e014777744ecd419baa1bea7e017e1.tar.gz |
fix bug #48640: cleaned up ifdef whoes, removed duplicate code.
Diffstat (limited to 'ext/zip/php_zip.c')
-rw-r--r-- | ext/zip/php_zip.c | 53 |
1 files changed, 15 insertions, 38 deletions
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 632d0afe9a..d85c65f800 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -148,51 +148,28 @@ static int php_zip_realpath_r(char *path, int start, int len, int *ll, time_t *t } return j; } - - path[len] = 0; -#ifdef PHP_WIN32 - tmp = tsrm_do_alloca(len+1); - memcpy(tmp, path, len+1); -#elif defined(NETWARE) + path[len] = 0; tmp = tsrm_do_alloca(len+1); memcpy(tmp, path, len+1); -#else - tmp = tsrm_do_alloca(len+1); - memcpy(tmp, path, len+1); - - { -#endif - if (i - 1 <= start) { - j = start; - } else { - /* some leading directories may be unaccessable */ - j = php_zip_realpath_r(path, start, i-1, ll, t, use_realpath, 1, NULL TSRMLS_CC); - if (j > start) { - path[j++] = DEFAULT_SLASH; - } - } -#ifdef PHP_WIN32 - if (j < 0 || j + len - i >= MAXPATHLEN-1) { - tsrm_free_alloca(tmp); - return -1; - } - { - /* use the original file or directory name as it wasn't found */ - memcpy(path+j, tmp+i, len-i+1); - j += (len-i); - } -#else - if (j < 0 || j + len - i >= MAXPATHLEN-1) { - tsrm_free_alloca(tmp); - return -1; + if (i - 1 <= start) { + j = start; + } else { + /* some leading directories may be unaccessable */ + j = php_zip_realpath_r(path, start, i-1, ll, t, use_realpath, 1, NULL TSRMLS_CC); + if (j > start) { + path[j++] = DEFAULT_SLASH; } - memcpy(path+j, tmp+i, len-i+1); - j += (len-i); } -#endif + if (j < 0 || j + len - i >= MAXPATHLEN-1) { + tsrm_free_alloca(tmp); + return -1; + } + /* use the original file or directory name as it wasn't found */ + memcpy(path+j, tmp+i, len-i+1); + j += (len-i); tsrm_free_alloca(tmp); return j; |