summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--win32/codepage.c3
-rw-r--r--win32/glob.c4
-rw-r--r--win32/ioutil.c14
3 files changed, 8 insertions, 13 deletions
diff --git a/win32/codepage.c b/win32/codepage.c
index 74e3323097..16e480e5ff 100644
--- a/win32/codepage.c
+++ b/win32/codepage.c
@@ -407,11 +407,10 @@ PW32CP wchar_t *php_win32_cp_env_any_to_w(const char* env)
do {
wchar_t *tmp;
- size_t tmp_len;
tmp = php_win32_cp_any_to_w(cur);
if (tmp) {
- tmp_len = wcslen(tmp) + 1;
+ size_t tmp_len = wcslen(tmp) + 1;
memmove(ew + bin_len, tmp, tmp_len * sizeof(wchar_t));
free(tmp);
diff --git a/win32/glob.c b/win32/glob.c
index 8c74ae7c3c..21a7cc70ef 100644
--- a/win32/glob.c
+++ b/win32/glob.c
@@ -622,7 +622,6 @@ glob3(pathbuf, pathbuf_last, pathend, pathend_last, pattern, pattern_last,
register struct dirent *dp;
DIR *dirp;
int err;
- char buf[MAXPATHLEN];
/*
* The readdirfunc declaration can't be prototyped, because it is
@@ -640,6 +639,7 @@ glob3(pathbuf, pathbuf_last, pathend, pathend_last, pattern, pattern_last,
if ((dirp = g_opendir(pathbuf, pglob)) == NULL) {
/* TODO: don't call for ENOENT or ENOTDIR? */
if (pglob->gl_errfunc) {
+ char buf[MAXPATHLEN];
if (g_Ctoc(pathbuf, buf, sizeof(buf)))
return(GLOB_ABORTED);
if (pglob->gl_errfunc(buf, errno) ||
@@ -712,7 +712,6 @@ globextend(path, pglob, limitp)
size_t *limitp;
{
register char **pathv;
- register int i;
u_int newsize, len;
char *copy;
const Char *p;
@@ -729,6 +728,7 @@ globextend(path, pglob, limitp)
}
if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) {
+ register int i;
/* first time around -- clear initial gl_offs items */
pathv += pglob->gl_offs;
for (i = pglob->gl_offs; --i >= 0; )
diff --git a/win32/ioutil.c b/win32/ioutil.c
index d73afe7bbd..932b4a2fbc 100644
--- a/win32/ioutil.c
+++ b/win32/ioutil.c
@@ -340,7 +340,6 @@ PW32IO int php_win32_ioutil_mkdir_w(const wchar_t *path, mode_t mode)
PW32IO int php_win32_ioutil_unlink_w(const wchar_t *path)
{/*{{{*/
- int ret = 0;
DWORD err = 0;
HANDLE h;
BY_HANDLE_FILE_INFORMATION info;
@@ -413,12 +412,11 @@ PW32IO int php_win32_ioutil_unlink_w(const wchar_t *path)
PW32IO int php_win32_ioutil_rmdir_w(const wchar_t *path)
{/*{{{*/
int ret = 0;
- DWORD err = 0;
PHP_WIN32_IOUTIL_CHECK_PATH_W(path, -1, 0)
if (!RemoveDirectoryW(path)) {
- err = GetLastError();
+ DWORD err = GetLastError();
ret = -1;
SET_ERRNO_FROM_WIN32_CODE(err);
}
@@ -429,10 +427,9 @@ PW32IO int php_win32_ioutil_rmdir_w(const wchar_t *path)
PW32IO int php_win32_ioutil_chdir_w(const wchar_t *path)
{/*{{{*/
int ret = 0;
- DWORD err = 0;
if (!SetCurrentDirectoryW(path)) {
- err = GetLastError();
+ DWORD err = GetLastError();
ret = -1;
SET_ERRNO_FROM_WIN32_CODE(err);
}
@@ -443,14 +440,13 @@ PW32IO int php_win32_ioutil_chdir_w(const wchar_t *path)
PW32IO int php_win32_ioutil_rename_w(const wchar_t *oldname, const wchar_t *newname)
{/*{{{*/
int ret = 0;
- DWORD err = 0;
PHP_WIN32_IOUTIL_CHECK_PATH_W(oldname, -1, 0)
PHP_WIN32_IOUTIL_CHECK_PATH_W(newname, -1, 0)
if (!MoveFileExW(oldname, newname, MOVEFILE_REPLACE_EXISTING|MOVEFILE_COPY_ALLOWED)) {
- err = GetLastError();
+ DWORD err = GetLastError();
ret = -1;
SET_ERRNO_FROM_WIN32_CODE(err);
}
@@ -640,7 +636,7 @@ BOOL php_win32_ioutil_init(void)
PW32IO int php_win32_ioutil_access_w(const wchar_t *path, mode_t mode)
{/*{{{*/
- DWORD attr, err;
+ DWORD attr;
if ((mode & X_OK) == X_OK) {
DWORD type;
@@ -649,7 +645,7 @@ PW32IO int php_win32_ioutil_access_w(const wchar_t *path, mode_t mode)
attr = GetFileAttributesW(path);
if (attr == INVALID_FILE_ATTRIBUTES) {
- err = GetLastError();
+ DWORD err = GetLastError();
SET_ERRNO_FROM_WIN32_CODE(err);
return -1;
}