]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Application/Shell/ShellParametersProtocol.c
add comments to function declarations and definitions and updated to match coding...
[mirror_edk2.git] / ShellPkg / Application / Shell / ShellParametersProtocol.c
index de2d4d1220daf47d9404e11ac36a30a5df07bf6f..b90a2c32bbce2d076b713e0375a5db2f35b3a1f6 100644 (file)
@@ -415,6 +415,14 @@ CleanUpShellParametersProtocol (
   return (Status);\r
 }\r
 \r
+/**\r
+  Determin if a file name represents a unicode file.\r
+\r
+  @param[in] FileName     Pointer to the filename to open.\r
+\r
+  @retval EFI_SUCCESS     The file is a unicode file.\r
+  @return An error upon failure.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IsUnicodeFile(\r
@@ -447,6 +455,8 @@ IsUnicodeFile(
   Strips out quotes sections of a string.\r
 \r
   All of the characters between quotes is replaced with spaces.\r
+\r
+  @param[in,out] TheString  A pointer to the string to update.\r
 **/\r
 VOID\r
 EFIAPI\r
@@ -528,7 +538,7 @@ UpdateStdInStdOutStdErr(
   ErrAppend       = FALSE;\r
   OutAppend       = FALSE;\r
   CommandLineCopy = NULL;\r
-  FirstLocation   = (CHAR16*)(-1);\r
+  FirstLocation   = NULL;\r
 \r
   if (ShellParameters == NULL || SystemTableInfo == NULL || OldStdIn == NULL || OldStdOut == NULL || OldStdErr == NULL) {\r
     return (EFI_INVALID_PARAMETER);\r
@@ -551,6 +561,7 @@ UpdateStdInStdOutStdErr(
   CommandLineCopy = StrnCatGrow(&CommandLineCopy, NULL, NewCommandLine, 0);\r
   Status          = EFI_SUCCESS;\r
   Split           = NULL;\r
+  FirstLocation   = CommandLineCopy + StrLen(CommandLineCopy);\r
 \r
   StripQuotes(CommandLineCopy);\r
 \r
@@ -810,7 +821,7 @@ UpdateStdInStdOutStdErr(
     }\r
   }\r
 \r
-  if (FirstLocation != (CHAR16*)(-1) \r
+  if (FirstLocation != CommandLineCopy + StrLen(CommandLineCopy)\r
     && ((UINTN)(FirstLocation - CommandLineCopy) < StrLen(NewCommandLine))\r
     ){\r
     *(NewCommandLine + (UINTN)(FirstLocation - CommandLineCopy)) = CHAR_NULL;\r
@@ -836,6 +847,9 @@ UpdateStdInStdOutStdErr(
       CommandLineWalker[0] = CHAR_NULL;\r
     }\r
 \r
+    //\r
+    // Verify not the same and not duplicating something from a split\r
+    //\r
     if (\r
       //\r
       // Check that no 2 filenames are the same\r