Author: pschweitzer Date: Tue Aug 25 20:39:53 2015 New Revision: 68824 URL: http://svn.reactos.org/svn/reactos?rev=68824&view=rev Log: [CMD] Remove an useless if
Modified: trunk/reactos/base/shell/cmd/dir.c Modified: trunk/reactos/base/shell/cmd/dir.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/dir.c?rev=68824&r1=68823&r2=68824&view=diff ============================================================================== --- trunk/reactos/base/shell/cmd/dir.c [iso-8859-1] (original) +++ trunk/reactos/base/shell/cmd/dir.c [iso-8859-1] Tue Aug 25 20:39:53 2015 @@ -1418,93 +1418,88 @@ return 1; } - /* If cmd_alloc fails we go to next file in hope it works, - without braking the linked list! */ - if (ptrNextNode->ptrNext) - { - /* Copy the info of search at linked list */ - memcpy(&ptrNextNode->ptrNext->stInfo.stFindInfo, - &wfdFileInfo, - sizeof(WIN32_FIND_DATA)); - - /* If lower case is selected do it here */ - if (lpFlags->bLowerCase) + /* Copy the info of search at linked list */ + memcpy(&ptrNextNode->ptrNext->stInfo.stFindInfo, + &wfdFileInfo, + sizeof(WIN32_FIND_DATA)); + + /* If lower case is selected do it here */ + if (lpFlags->bLowerCase) + { + _tcslwr(ptrNextNode->ptrNext->stInfo.stFindInfo.cAlternateFileName); + _tcslwr(ptrNextNode->ptrNext->stInfo.stFindInfo.cFileName); + } + + /* No streams (yet?) */ + ptrNextNode->ptrNext->stInfo.ptrHead = NULL; + + /* Alternate streams are only displayed with new long list */ + if (lpFlags->bNewLongList && lpFlags->bDataStreams) + { + /* Try to get stream information */ + hStreams = FindFirstStreamW(wfdFileInfo.cFileName, FindStreamInfoStandard, &wfsdStreamInfo, 0); + if (hStreams != INVALID_HANDLE_VALUE) { - _tcslwr(ptrNextNode->ptrNext->stInfo.stFindInfo.cAlternateFileName); - _tcslwr(ptrNextNode->ptrNext->stInfo.stFindInfo.cFileName); + /* We totally ignore first stream. It contains data about ::$DATA */ + ptrCurNode = &ptrNextNode->ptrNext->stInfo.ptrHead; + while (FindNextStreamW(hStreams, &wfsdStreamInfo)) + { + *ptrCurNode = cmd_alloc(sizeof(DIRFINDSTREAMNODE)); + if (*ptrCurNode == NULL) + { + WARN("DEBUG: Cannot allocate memory for *ptrCurNode!\n"); + while (ptrStartNode) + { + ptrNextNode = ptrStartNode->ptrNext; + while (ptrStartNode->stInfo.ptrHead) + { + ptrFreeNode = ptrStartNode->stInfo.ptrHead; + ptrStartNode->stInfo.ptrHead = ptrFreeNode->ptrNext; + cmd_free(ptrFreeNode); + } + cmd_free(ptrStartNode); + ptrStartNode = ptrNextNode; + dwCount--; + } + FindClose(hStreams); + FindClose(hSearch); + return 1; + } + + memcpy(&(*ptrCurNode)->stStreamInfo, &wfsdStreamInfo, + sizeof(WIN32_FIND_STREAM_DATA)); + + /* If lower case is selected do it here */ + if (lpFlags->bLowerCase) + { + _tcslwr((*ptrCurNode)->stStreamInfo.cStreamName); + } + + ptrCurNode = &(*ptrCurNode)->ptrNext; + } + + FindClose(hStreams); + *ptrCurNode = NULL; } - - /* No streams (yet?) */ - ptrNextNode->ptrNext->stInfo.ptrHead = NULL; - - /* Alternate streams are only displayed with new long list */ - if (lpFlags->bNewLongList && lpFlags->bDataStreams) - { - /* Try to get stream information */ - hStreams = FindFirstStreamW(wfdFileInfo.cFileName, FindStreamInfoStandard, &wfsdStreamInfo, 0); - if (hStreams != INVALID_HANDLE_VALUE) - { - /* We totally ignore first stream. It contains data about ::$DATA */ - ptrCurNode = &ptrNextNode->ptrNext->stInfo.ptrHead; - while (FindNextStreamW(hStreams, &wfsdStreamInfo)) - { - *ptrCurNode = cmd_alloc(sizeof(DIRFINDSTREAMNODE)); - if (*ptrCurNode == NULL) - { - WARN("DEBUG: Cannot allocate memory for *ptrCurNode!\n"); - while (ptrStartNode) - { - ptrNextNode = ptrStartNode->ptrNext; - while (ptrStartNode->stInfo.ptrHead) - { - ptrFreeNode = ptrStartNode->stInfo.ptrHead; - ptrStartNode->stInfo.ptrHead = ptrFreeNode->ptrNext; - cmd_free(ptrFreeNode); - } - cmd_free(ptrStartNode); - ptrStartNode = ptrNextNode; - dwCount--; - } - FindClose(hStreams); - FindClose(hSearch); - return 1; - } - - memcpy(&(*ptrCurNode)->stStreamInfo, &wfsdStreamInfo, - sizeof(WIN32_FIND_STREAM_DATA)); - - /* If lower case is selected do it here */ - if (lpFlags->bLowerCase) - { - _tcslwr((*ptrCurNode)->stStreamInfo.cStreamName); - } - - ptrCurNode = &(*ptrCurNode)->ptrNext; - } - - FindClose(hStreams); - *ptrCurNode = NULL; - } - } - - /* Continue at next node at linked list */ - ptrNextNode = ptrNextNode->ptrNext; - dwCount ++; - - /* Grab statistics */ - if (wfdFileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - { - /* Directory */ - dwCountDirs++; - } - else - { - /* File */ - dwCountFiles++; - u64Temp.HighPart = wfdFileInfo.nFileSizeHigh; - u64Temp.LowPart = wfdFileInfo.nFileSizeLow; - u64CountBytes += u64Temp.QuadPart; - } + } + + /* Continue at next node at linked list */ + ptrNextNode = ptrNextNode->ptrNext; + dwCount ++; + + /* Grab statistics */ + if (wfdFileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + /* Directory */ + dwCountDirs++; + } + else + { + /* File */ + dwCountFiles++; + u64Temp.HighPart = wfdFileInfo.nFileSizeHigh; + u64Temp.LowPart = wfdFileInfo.nFileSizeLow; + u64CountBytes += u64Temp.QuadPart; } } } while (FindNextFile(hSearch, &wfdFileInfo));