cmd: Avoid dead assignments (Clang).

This commit is contained in:
Frédéric Delanoy 2011-10-05 10:16:30 +02:00 committed by Alexandre Julliard
parent 58f2a3cf3e
commit e2fd09c2e7
1 changed files with 30 additions and 41 deletions

View File

@ -1587,7 +1587,10 @@ void WCMD_move (void) {
WCMD_splitpath(input, drive, dir, fname, ext); WCMD_splitpath(input, drive, dir, fname, ext);
hff = FindFirstFileW(input, &fd); hff = FindFirstFileW(input, &fd);
while (hff != INVALID_HANDLE_VALUE) { if (hff == INVALID_HANDLE_VALUE)
return;
do {
WCHAR dest[MAX_PATH]; WCHAR dest[MAX_PATH];
WCHAR src[MAX_PATH]; WCHAR src[MAX_PATH];
DWORD attribs; DWORD attribs;
@ -1674,14 +1677,9 @@ void WCMD_move (void) {
WCMD_print_error (); WCMD_print_error ();
errorlevel = 1; errorlevel = 1;
} }
} while (FindNextFileW(hff, &fd) != 0);
/* Step on to next match */
if (FindNextFileW(hff, &fd) == 0) {
FindClose(hff); FindClose(hff);
hff = INVALID_HANDLE_VALUE;
break;
}
}
} }
/**************************************************************************** /****************************************************************************
@ -1810,7 +1808,10 @@ void WCMD_rename (void) {
WCMD_splitpath(input, drive, dir, fname, ext); WCMD_splitpath(input, drive, dir, fname, ext);
hff = FindFirstFileW(input, &fd); hff = FindFirstFileW(input, &fd);
while (hff != INVALID_HANDLE_VALUE) { if (hff == INVALID_HANDLE_VALUE)
return;
do {
WCHAR dest[MAX_PATH]; WCHAR dest[MAX_PATH];
WCHAR src[MAX_PATH]; WCHAR src[MAX_PATH];
WCHAR *dotSrc = NULL; WCHAR *dotSrc = NULL;
@ -1866,14 +1867,9 @@ void WCMD_rename (void) {
WCMD_print_error (); WCMD_print_error ();
errorlevel = 1; errorlevel = 1;
} }
} while (FindNextFileW(hff, &fd) != 0);
/* Step on to next match */
if (FindNextFileW(hff, &fd) == 0) {
FindClose(hff); FindClose(hff);
hff = INVALID_HANDLE_VALUE;
break;
}
}
} }
/***************************************************************************** /*****************************************************************************
@ -2058,7 +2054,8 @@ void WCMD_setshow_default (const WCHAR *command) {
/* Search for appropriate directory */ /* Search for appropriate directory */
WINE_TRACE("Looking for directory '%s'\n", wine_dbgstr_w(string)); WINE_TRACE("Looking for directory '%s'\n", wine_dbgstr_w(string));
hff = FindFirstFileW(string, &fd); hff = FindFirstFileW(string, &fd);
while (hff != INVALID_HANDLE_VALUE) { if (hff != INVALID_HANDLE_VALUE) {
do {
if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
WCHAR fpath[MAX_PATH]; WCHAR fpath[MAX_PATH];
WCHAR drive[10]; WCHAR drive[10];
@ -2073,18 +2070,10 @@ void WCMD_setshow_default (const WCHAR *command) {
/* Rebuild path */ /* Rebuild path */
wsprintfW(string, fmt, drive, dir, fd.cFileName); wsprintfW(string, fmt, drive, dir, fd.cFileName);
FindClose(hff);
hff = INVALID_HANDLE_VALUE;
break; break;
} }
} while (FindNextFileW(hff, &fd) != 0);
/* Step on to next match */
if (FindNextFileW(hff, &fd) == 0) {
FindClose(hff); FindClose(hff);
hff = INVALID_HANDLE_VALUE;
break;
}
} }
/* Change to that directory */ /* Change to that directory */