https://git.reactos.org/?p=reactos.git;a=commitdiff;h=47d7de4b7bc35ba745dc00...
commit 47d7de4b7bc35ba745dc007f6ba0bb442b52c788 Author: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org AuthorDate: Sat Jul 18 23:31:50 2020 +0200 Commit: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org CommitDate: Wed Aug 19 20:36:08 2020 +0200
[CMD] Simplify GetRootPath() and mark its InPath parameter pointer to const string. --- base/shell/cmd/cmd.h | 7 ++++++- base/shell/cmd/internal.c | 9 +++------ 2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/base/shell/cmd/cmd.h b/base/shell/cmd/cmd.h index f547389024e..d7bce5c139e 100644 --- a/base/shell/cmd/cmd.h +++ b/base/shell/cmd/cmd.h @@ -269,7 +269,12 @@ INT CommandMemory (LPTSTR); INT cmd_mklink(LPTSTR);
/* Prototypes for MISC.C */ -INT GetRootPath(TCHAR *InPath,TCHAR *OutPath,INT size); +INT +GetRootPath( + IN LPCTSTR InPath, + OUT LPTSTR OutPath, + IN INT size); + BOOL SetRootPath(TCHAR *oldpath,TCHAR *InPath); TCHAR cgetchar (VOID); BOOL CheckCtrlBreak (INT); diff --git a/base/shell/cmd/internal.c b/base/shell/cmd/internal.c index 0dc3eaba2bd..7e8a7367c02 100644 --- a/base/shell/cmd/internal.c +++ b/base/shell/cmd/internal.c @@ -150,7 +150,7 @@ */ INT GetRootPath( - IN LPTSTR InPath, + IN LPCTSTR InPath, OUT LPTSTR OutPath, IN INT size) { @@ -162,14 +162,11 @@ GetRootPath( { t = (InPath[0] - _T('0')) + 28; } - - if ((InPath[0] >= _T('a')) && (InPath[0] <= _T('z'))) + else if ((InPath[0] >= _T('a')) && (InPath[0] <= _T('z'))) { t = (InPath[0] - _T('a')) + 1; - InPath[0] = t + _T('A') - 1; } - - if ((InPath[0] >= _T('A')) && (InPath[0] <= _T('Z'))) + else if ((InPath[0] >= _T('A')) && (InPath[0] <= _T('Z'))) { t = (InPath[0] - _T('A')) + 1; }