Fix review nits from bug 463417 which I forgot to address earlier.

This commit is contained in:
Benjamin Smedberg 2009-07-20 11:48:45 -04:00
Родитель 6c940bad06
Коммит 00ddb60693
2 изменённых файлов: 26 добавлений и 28 удалений

Просмотреть файл

@ -41,8 +41,8 @@ static BOOL sh_DoCopy(wchar_t *srcFileName, DWORD srcFileAttributes,
#define ARRAY_LEN(a) (sizeof(a) / sizeof(a[0]))
#define STR_LEN(a) (ARRAY_LEN(a) - 1)
/* changes all forward slashes in token to back slashes */
void changeForwardSlashesTpBackSlashes ( wchar_t *arg )
/* changes all forward slashes in token to backslashes */
void changeForwardSlashesToBackSlashes ( wchar_t *arg )
{
if ( arg == NULL )
return;
@ -136,7 +136,7 @@ shellMkdir (wchar_t **pArgv)
while ( *pArgv ) {
arg = *pArgv;
changeForwardSlashesTpBackSlashes ( arg );
changeForwardSlashesToBackSlashes ( arg );
pArg = arg;
pTmpPath = tmpPath;
while ( 1 ) {
@ -148,13 +148,12 @@ shellMkdir (wchar_t **pArgv)
}
*pTmpPath = '\0';
/* check if directory alreay exists */
/* check if directory already exists */
_wgetcwd ( path, _MAX_PATH );
if ( _wchdir ( tmpPath ) != -1 ) {
_wchdir ( path );
} else {
if ( _wmkdir ( tmpPath ) == -1 ) {
// while ( waitForDebug );
printf ( "%ls: ", tmpPath );
perror ( "Could not create the directory" );
retVal = 3;
@ -365,7 +364,7 @@ shellCp (wchar_t **pArgv)
* one file or directory.
*/
changeForwardSlashesTpBackSlashes(*pDst);
changeForwardSlashesToBackSlashes(*pDst);
sh_EnumerateFiles(*pDst, *pDst, sh_RecordFileData, &dstData, &n);
assert(n >= 0);
if (n == 1) {
@ -439,7 +438,7 @@ shellCp (wchar_t **pArgv)
struct sh_FileData srcData;
assert(pDst - pSrc == 1);
changeForwardSlashesTpBackSlashes(*pSrc);
changeForwardSlashesToBackSlashes(*pSrc);
sh_EnumerateFiles(*pSrc, *pSrc, sh_RecordFileData, &srcData, &n);
if (n == 0) {
fprintf(stderr, "nsinstall: %ls: No such file or directory\n",
@ -463,7 +462,7 @@ shellCp (wchar_t **pArgv)
for ( ; *pSrc != *pDst; pSrc++) {
BOOL rv;
changeForwardSlashesTpBackSlashes(*pSrc);
changeForwardSlashesToBackSlashes(*pSrc);
rv = sh_EnumerateFiles(*pSrc, *pSrc, sh_CpFileCmd, &arg, &n);
if (rv == FALSE) {
retVal = 3;

Просмотреть файл

@ -41,8 +41,8 @@ static BOOL sh_DoCopy(wchar_t *srcFileName, DWORD srcFileAttributes,
#define ARRAY_LEN(a) (sizeof(a) / sizeof(a[0]))
#define STR_LEN(a) (ARRAY_LEN(a) - 1)
/* changes all forward slashes in token to back slashes */
void changeForwardSlashesTpBackSlashes ( wchar_t *arg )
/* changes all forward slashes in token to backslashes */
void changeForwardSlashesToBackSlashes ( wchar_t *arg )
{
if ( arg == NULL )
return;
@ -136,7 +136,7 @@ shellMkdir (wchar_t **pArgv)
while ( *pArgv ) {
arg = *pArgv;
changeForwardSlashesTpBackSlashes ( arg );
changeForwardSlashesToBackSlashes ( arg );
pArg = arg;
pTmpPath = tmpPath;
while ( 1 ) {
@ -148,13 +148,12 @@ shellMkdir (wchar_t **pArgv)
}
*pTmpPath = '\0';
/* check if directory alreay exists */
/* check if directory already exists */
_wgetcwd ( path, _MAX_PATH );
if ( _wchdir ( tmpPath ) != -1 ) {
_wchdir ( path );
} else {
if ( _wmkdir ( tmpPath ) == -1 ) {
// while ( waitForDebug );
printf ( "%ls: ", tmpPath );
perror ( "Could not create the directory" );
retVal = 3;
@ -365,7 +364,7 @@ shellCp (wchar_t **pArgv)
* one file or directory.
*/
changeForwardSlashesTpBackSlashes(*pDst);
changeForwardSlashesToBackSlashes(*pDst);
sh_EnumerateFiles(*pDst, *pDst, sh_RecordFileData, &dstData, &n);
assert(n >= 0);
if (n == 1) {
@ -439,7 +438,7 @@ shellCp (wchar_t **pArgv)
struct sh_FileData srcData;
assert(pDst - pSrc == 1);
changeForwardSlashesTpBackSlashes(*pSrc);
changeForwardSlashesToBackSlashes(*pSrc);
sh_EnumerateFiles(*pSrc, *pSrc, sh_RecordFileData, &srcData, &n);
if (n == 0) {
fprintf(stderr, "nsinstall: %ls: No such file or directory\n",
@ -463,7 +462,7 @@ shellCp (wchar_t **pArgv)
for ( ; *pSrc != *pDst; pSrc++) {
BOOL rv;
changeForwardSlashesTpBackSlashes(*pSrc);
changeForwardSlashesToBackSlashes(*pSrc);
rv = sh_EnumerateFiles(*pSrc, *pSrc, sh_CpFileCmd, &arg, &n);
if (rv == FALSE) {
retVal = 3;