]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Update ParseInf to resolve different line separator between WINDOWS and LINUX (\r...
authorwuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 7 Nov 2006 03:03:06 +0000 (03:03 +0000)
committerwuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 7 Nov 2006 03:03:06 +0000 (03:03 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1908 6f19259b-4bc3-4df7-8a09-765794883524

Tools/CCode/Source/Common/ParseInf.c
Tools/CCode/Source/GenFvImage/GenFvImageExe.c
Tools/CCode/Source/GenFvImage/GenFvImageLib.c

index de0ffd85c7c7a10fc480bb5bd4e103808a702393..6f5900e897daff36b449a2dda09271f7d2611c3a 100644 (file)
@@ -116,7 +116,15 @@ Returns:
   //\r
   // Add the null termination over the 0x0D\r
   //\r
   //\r
   // Add the null termination over the 0x0D\r
   //\r
-  InputBuffer[CharsToCopy - 1] = '\0';\r
+  if (InputBuffer[CharsToCopy - 1] == '\r') {\r
+\r
+    InputBuffer[CharsToCopy - 1] = '\0';\r
+\r
+  } else {\r
+\r
+    InputBuffer[CharsToCopy] = '\0';\r
+\r
+  }\r
 \r
   //\r
   // Increment the current file pointer (include the 0x0A)\r
 \r
   //\r
   // Increment the current file pointer (include the 0x0A)\r
index d0117b8ae939c117cf3ab5a156bff8f01c7cf200..ce56299f1f5a1ddea9499d3a698a769537529780 100644 (file)
@@ -126,7 +126,7 @@ Returns:
   CHAR8       SymFileNameBuffer[_MAX_PATH];\r
   CHAR8       *SymFileName;\r
   UINT8       *SymImage;\r
   CHAR8       SymFileNameBuffer[_MAX_PATH];\r
   CHAR8       *SymFileName;\r
   UINT8       *SymImage;\r
-  UINTN       SymImageSize;\r
+  UINTN       SymImageSize = 0;\r
   CHAR8       *CurrentSymString;\r
 \r
   FvFileName  = FvFileNameBuffer;\r
   CHAR8       *CurrentSymString;\r
 \r
   FvFileName  = FvFileNameBuffer;\r
index 45d4c8e848bf7897829e4e431c8feb1ba2c60b3a..06500ef3736d87160df4b1de8e9bac8da6f71e2f 100644 (file)
@@ -48,6 +48,17 @@ Abstract:
 #include "EfiCompress.h"\r
 #include "WinNtInclude.h"\r
 \r
 #include "EfiCompress.h"\r
 #include "WinNtInclude.h"\r
 \r
+//\r
+// Different file separater for Linux and Windows\r
+//\r
+#ifdef __GNUC__\r
+#define FILE_SEP_CHAR '/'\r
+#define FILE_SEP_STRING "/"\r
+#else\r
+#define FILE_SEP_CHAR '\\'\r
+#define FILE_SEP_STRING "\\"\r
+#endif\r
+\r
 static UINT32 MaxFfsAlignment = 0;\r
 //\r
 // Local function prototypes\r
 static UINT32 MaxFfsAlignment = 0;\r
 //\r
 // Local function prototypes\r
@@ -1374,7 +1385,7 @@ Returns:
   // Copy the file name for the path of the sym file and truncate the name portion.\r
   //\r
   strcpy (SymFileName, Buffer);\r
   // Copy the file name for the path of the sym file and truncate the name portion.\r
   //\r
   strcpy (SymFileName, Buffer);\r
-  Ptr = strrchr (SymFileName, '\\');\r
+  Ptr = strrchr (SymFileName, FILE_SEP_CHAR);\r
   assert (Ptr);\r
   Ptr[0] = 0;\r
 \r
   assert (Ptr);\r
   Ptr[0] = 0;\r
 \r
@@ -1411,7 +1422,7 @@ Returns:
     // Add the symbol file name and extension to the file path.\r
     //\r
     strcat (Buffer, ".sym");\r
     // Add the symbol file name and extension to the file path.\r
     //\r
     strcat (Buffer, ".sym");\r
-    strcat (SymFileName, "\\");\r
+    strcat (SymFileName, FILE_SEP_CHAR);\r
     strcat (SymFileName, Buffer);\r
   } else {\r
     //\r
     strcat (SymFileName, Buffer);\r
   } else {\r
     //\r