]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Update GenFv tool to handle the file path with space.
authorGao, Liming liming.gao <Gao, Liming liming.gao@intel.com>
Fri, 25 Jul 2014 21:10:20 +0000 (21:10 +0000)
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 25 Jul 2014 21:10:20 +0000 (21:10 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gao, Liming liming.gao@intel.com
Review-by: Kinney, Michael D michael.d.kinney@intel.com
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15685 6f19259b-4bc3-4df7-8a09-765794883524

BaseTools/Source/C/Common/ParseInf.c

index bbccb617322f57826fd77e17a9d7f95e8d3e2c42..385758f8366f5412b8f9a93510e84a9e13f49dde 100644 (file)
@@ -236,6 +236,7 @@ Returns:
 {\r
   CHAR8   InputBuffer[_MAX_PATH];\r
   CHAR8   *CurrentToken;\r
+  CHAR8   *Delimiter;\r
   BOOLEAN ParseError;\r
   BOOLEAN ReadError;\r
   UINTN   Occurrance;\r
@@ -283,8 +284,13 @@ Returns:
       //\r
       // Get the first non-whitespace string\r
       //\r
+      Delimiter = strchr (InputBuffer, '=');\r
+      if (Delimiter != NULL) {\r
+        *Delimiter = 0;\r
+      }\r
+\r
       CurrentToken = strtok (InputBuffer, " \t\n");\r
-      if (CurrentToken == NULL) {\r
+      if (CurrentToken == NULL || Delimiter == NULL) {\r
         //\r
         // Whitespace line found (or comment) so continue\r
         //\r
@@ -311,17 +317,29 @@ Returns:
           //\r
           // Copy the contents following the =\r
           //\r
-          CurrentToken = strtok (NULL, "= \t\n");\r
-          if (CurrentToken == NULL) {\r
+          CurrentToken = Delimiter + 1;\r
+          if (*CurrentToken == 0) {\r
             //\r
             // Nothing found, parsing error\r
             //\r
             ParseError = TRUE;\r
           } else {\r
+            //\r
+            // Strip leading white space\r
+            //\r
+            while (*CurrentToken == ' ' || *CurrentToken == '\t') {\r
+              CurrentToken++;\r
+            }\r
             //\r
             // Copy the current token to the output value\r
             //\r
             strcpy (Value, CurrentToken);\r
+            //\r
+            // Strip trailing white space\r
+            //\r
+            while (strlen(Value) > 0 && (*(Value + strlen(Value) - 1) == ' ' || *(Value + strlen(Value) - 1) == '\t')) {\r
+              *(Value + strlen(Value) - 1) = 0;\r
+            }\r
             return EFI_SUCCESS;\r
           }\r
         } else {\r