summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c
diff options
context:
space:
mode:
Diffstat (limited to 'ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c')
-rw-r--r--ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c
index 8faa54beee..deff42e049 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c
@@ -2,7 +2,7 @@
Main file for cp shell level 2 function.
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
- Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -427,20 +427,20 @@ ValidateAndCopyFiles(
// simple copy of a single file
//
if (Cwd != NULL) {
- StrnCpy(DestPath, Cwd, PathSize/sizeof(CHAR16)-1);
+ StrCpyS(DestPath, PathSize / sizeof(CHAR16), Cwd);
} else {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_DIR_NF), gShellLevel2HiiHandle, L"cp", CleanFilePathStr);
FreePool (CleanFilePathStr);
return (SHELL_INVALID_PARAMETER);
}
if (DestPath[StrLen(DestPath)-1] != L'\\' && CleanFilePathStr[0] != L'\\') {
- StrnCat(DestPath, L"\\", PathSize/sizeof(CHAR16) - StrLen(DestPath) -1);
+ StrCatS(DestPath, PathSize / sizeof(CHAR16), L"\\");
} else if (DestPath[StrLen(DestPath)-1] == L'\\' && CleanFilePathStr[0] == L'\\') {
((CHAR16*)DestPath)[StrLen(DestPath)-1] = CHAR_NULL;
}
- StrnCat(DestPath, CleanFilePathStr, PathSize/sizeof(CHAR16) - StrLen(DestPath) -1);
+ StrCatS(DestPath, PathSize/sizeof(CHAR16), CleanFilePathStr);
} else {
- StrnCpy(DestPath, CleanFilePathStr, PathSize/sizeof(CHAR16) -1);
+ StrCpyS(DestPath, PathSize/sizeof(CHAR16), CleanFilePathStr);
}
} else {
//
@@ -455,44 +455,44 @@ ValidateAndCopyFiles(
// Copy to the root of CWD
//
if (Cwd != NULL) {
- StrnCpy(DestPath, Cwd, PathSize/sizeof(CHAR16) -1);
+ StrCpyS(DestPath, PathSize/sizeof(CHAR16), Cwd);
} else {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_DIR_NF), gShellLevel2HiiHandle, L"cp", CleanFilePathStr);
FreePool(CleanFilePathStr);
return (SHELL_INVALID_PARAMETER);
}
while (PathRemoveLastItem(DestPath));
- StrnCat(DestPath, CleanFilePathStr+1, PathSize/sizeof(CHAR16) - StrLen(DestPath) -1);
- StrnCat(DestPath, Node->FileName, PathSize/sizeof(CHAR16) - StrLen(DestPath) -1);
+ StrCatS(DestPath, PathSize/sizeof(CHAR16), CleanFilePathStr+1);
+ StrCatS(DestPath, PathSize/sizeof(CHAR16), Node->FileName);
} else if (StrStr(CleanFilePathStr, L":") == NULL) {
if (Cwd != NULL) {
- StrnCpy(DestPath, Cwd, PathSize/sizeof(CHAR16) -1);
+ StrCpyS(DestPath, PathSize/sizeof(CHAR16), Cwd);
} else {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_DIR_NF), gShellLevel2HiiHandle, L"cp", CleanFilePathStr);
FreePool(CleanFilePathStr);
return (SHELL_INVALID_PARAMETER);
}
if (DestPath[StrLen(DestPath)-1] != L'\\' && CleanFilePathStr[0] != L'\\') {
- StrnCat(DestPath, L"\\", PathSize/sizeof(CHAR16) - StrLen(DestPath) -1);
+ StrCatS(DestPath, PathSize/sizeof(CHAR16), L"\\");
} else if (DestPath[StrLen(DestPath)-1] == L'\\' && CleanFilePathStr[0] == L'\\') {
((CHAR16*)DestPath)[StrLen(DestPath)-1] = CHAR_NULL;
}
- StrnCat(DestPath, CleanFilePathStr, PathSize/sizeof(CHAR16) - StrLen(DestPath) -1);
+ StrCatS(DestPath, PathSize/sizeof(CHAR16), CleanFilePathStr);
if (CleanFilePathStr[StrLen(CleanFilePathStr)-1] != L'\\' && Node->FileName[0] != L'\\') {
- StrnCat(DestPath, L"\\", PathSize/sizeof(CHAR16) - StrLen(DestPath) -1);
+ StrCatS(DestPath, PathSize/sizeof(CHAR16), L"\\");
} else if (CleanFilePathStr[StrLen(CleanFilePathStr)-1] == L'\\' && Node->FileName[0] == L'\\') {
((CHAR16*)DestPath)[StrLen(DestPath)-1] = CHAR_NULL;
}
- StrnCat(DestPath, Node->FileName, PathSize/sizeof(CHAR16) - StrLen(DestPath) -1);
+ StrCatS(DestPath, PathSize/sizeof(CHAR16), Node->FileName);
} else {
- StrnCpy(DestPath, CleanFilePathStr, PathSize/sizeof(CHAR16) -1);
+ StrCpyS(DestPath, PathSize/sizeof(CHAR16), CleanFilePathStr);
if (CleanFilePathStr[StrLen(CleanFilePathStr)-1] != L'\\' && Node->FileName[0] != L'\\') {
- StrnCat(DestPath, L"\\", PathSize/sizeof(CHAR16) - StrLen(DestPath) -1);
+ StrCatS(DestPath, PathSize/sizeof(CHAR16), L"\\");
} else if (CleanFilePathStr[StrLen(CleanFilePathStr)-1] == L'\\' && Node->FileName[0] == L'\\') {
((CHAR16*)CleanFilePathStr)[StrLen(CleanFilePathStr)-1] = CHAR_NULL;
}
- StrnCat(DestPath, Node->FileName, PathSize/sizeof(CHAR16) - StrLen(DestPath) -1);
+ StrCatS(DestPath, PathSize/sizeof(CHAR16), Node->FileName);
}
}