From 00ddb60693bde186d704842c2cd23b772298b875 Mon Sep 17 00:00:00 2001 From: Benjamin Smedberg Date: Mon, 20 Jul 2009 11:48:45 -0400 Subject: [PATCH] Fix review nits from bug 463417 which I forgot to address earlier. --- config/nsinstall_win.c | 27 +++++++++++++-------------- js/src/config/nsinstall_win.c | 27 +++++++++++++-------------- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/config/nsinstall_win.c b/config/nsinstall_win.c index e2958fbcae0..4a0656364d3 100644 --- a/config/nsinstall_win.c +++ b/config/nsinstall_win.c @@ -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; @@ -50,20 +50,20 @@ void changeForwardSlashesTpBackSlashes ( wchar_t *arg ) while ( *arg ) { if ( *arg == '/' ) *arg = '\\'; - arg++; + arg++; } } int wmain(int argc, wchar_t *argv[ ]) { - return shellNsinstall ( argv + 1 ); + return shellNsinstall ( argv + 1 ); } static int shellNsinstall (wchar_t **pArgv) { - int retVal = 0; /* exit status */ - int dirOnly = 0; /* 1 if and only if -D is specified */ + int retVal = 0; /* exit status */ + int dirOnly = 0; /* 1 if and only if -D is specified */ wchar_t **pSrc; wchar_t **pDst; @@ -119,7 +119,7 @@ shellNsinstall (wchar_t **pArgv) static int shellMkdir (wchar_t **pArgv) { - int retVal = 0; /* assume valid return */ + int retVal = 0; /* assume valid return */ wchar_t *arg; wchar_t *pArg; wchar_t path[_MAX_PATH]; @@ -136,7 +136,7 @@ shellMkdir (wchar_t **pArgv) while ( *pArgv ) { arg = *pArgv; - changeForwardSlashesTpBackSlashes ( arg ); + changeForwardSlashesToBackSlashes ( arg ); pArg = arg; pTmpPath = tmpPath; while ( 1 ) { @@ -148,20 +148,19 @@ 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; break; } } - if ( *pArg == '\0' ) /* complete path? */ + if ( *pArg == '\0' ) /* complete path? */ break; /* loop for next directory */ } @@ -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; diff --git a/js/src/config/nsinstall_win.c b/js/src/config/nsinstall_win.c index e2958fbcae0..4a0656364d3 100644 --- a/js/src/config/nsinstall_win.c +++ b/js/src/config/nsinstall_win.c @@ -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; @@ -50,20 +50,20 @@ void changeForwardSlashesTpBackSlashes ( wchar_t *arg ) while ( *arg ) { if ( *arg == '/' ) *arg = '\\'; - arg++; + arg++; } } int wmain(int argc, wchar_t *argv[ ]) { - return shellNsinstall ( argv + 1 ); + return shellNsinstall ( argv + 1 ); } static int shellNsinstall (wchar_t **pArgv) { - int retVal = 0; /* exit status */ - int dirOnly = 0; /* 1 if and only if -D is specified */ + int retVal = 0; /* exit status */ + int dirOnly = 0; /* 1 if and only if -D is specified */ wchar_t **pSrc; wchar_t **pDst; @@ -119,7 +119,7 @@ shellNsinstall (wchar_t **pArgv) static int shellMkdir (wchar_t **pArgv) { - int retVal = 0; /* assume valid return */ + int retVal = 0; /* assume valid return */ wchar_t *arg; wchar_t *pArg; wchar_t path[_MAX_PATH]; @@ -136,7 +136,7 @@ shellMkdir (wchar_t **pArgv) while ( *pArgv ) { arg = *pArgv; - changeForwardSlashesTpBackSlashes ( arg ); + changeForwardSlashesToBackSlashes ( arg ); pArg = arg; pTmpPath = tmpPath; while ( 1 ) { @@ -148,20 +148,19 @@ 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; break; } } - if ( *pArg == '\0' ) /* complete path? */ + if ( *pArg == '\0' ) /* complete path? */ break; /* loop for next directory */ } @@ -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;