From 7a4e20ca25e014777744ecd419baa1bea7e017e1 Mon Sep 17 00:00:00 2001 From: Guenter Knauf Date: Wed, 26 Aug 2009 02:16:41 +0000 Subject: fix bug #48640: cleaned up ifdef whoes, removed duplicate code. --- ext/zip/php_zip.c | 53 +++++++++++++++-------------------------------------- 1 file changed, 15 insertions(+), 38 deletions(-) (limited to 'ext/zip/php_zip.c') 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; -- cgit v1.2.1