]> git.proxmox.com Git - mirror_edk2.git/blobdiff - FatPkg/EnhancedFatDxe/FileName.c
FatPkg/EnhancedFatDxe: Make function prototype align with definition
[mirror_edk2.git] / FatPkg / EnhancedFatDxe / FileName.c
index 09690fb07649e606db329badaf0066dadbcbe11f..f393aa6357b396c59c1889fccb4de7c9f1607049 100644 (file)
@@ -1,6 +1,6 @@
 /*++\r
 \r
-Copyright (c) 2005 - 2007, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials are licensed and made available\r
 under the terms and conditions of the BSD License which accompanies this\r
 distribution. The full text of the license may be found at\r
@@ -59,7 +59,7 @@ Returns:
   PossibleShortName = TRUE;\r
   SeparateDot       = NULL;\r
   SetMem (File8Dot3Name, FAT_NAME_LEN, ' ');\r
-  for (TempName = FileName; *TempName; TempName++) {\r
+  for (TempName = FileName; *TempName != '\0'; TempName++) {\r
     if (*TempName == L'.') {\r
       SeparateDot = TempName;\r
     }\r
@@ -302,7 +302,6 @@ Returns:
   CHAR16  Buffer[FAT_MAIN_NAME_LEN + 1 + FAT_EXTEND_NAME_LEN + 1];\r
   UINT8   OutCaseFlag;\r
 \r
-  ASSERT (StrSize (Str) <= sizeof (Buffer));\r
   //\r
   // Assume the case of input string is mixed\r
   //\r
@@ -311,7 +310,7 @@ Returns:
   // Lower case a copy of the string, if it matches the\r
   // original then the string is lower case\r
   //\r
-  StrCpy (Buffer, Str);\r
+  StrCpyS (Buffer, ARRAY_SIZE (Buffer), Str);\r
   FatStrLwr (Buffer);\r
   if (StrCmp (Str, Buffer) == 0) {\r
     OutCaseFlag = InCaseFlag;\r
@@ -320,7 +319,7 @@ Returns:
   // Upper case a copy of the string, if it matches the\r
   // original then the string is upper case\r
   //\r
-  StrCpy (Buffer, Str);\r
+  StrCpyS (Buffer, ARRAY_SIZE (Buffer), Str);\r
   FatStrUpr (Buffer);\r
   if (StrCmp (Str, Buffer) == 0) {\r
     OutCaseFlag = 0;\r
@@ -392,8 +391,9 @@ Returns:
 \r
 VOID\r
 FatGetFileNameViaCaseFlag (\r
-  IN  FAT_DIRENT    *DirEnt,\r
-  OUT CHAR16        *FileString\r
+  IN     FAT_DIRENT   *DirEnt,\r
+  IN OUT CHAR16       *FileString,\r
+  IN     UINTN        FileStringMax\r
   )\r
 /*++\r
 \r
@@ -425,7 +425,7 @@ Returns:
   FatNameToStr (File8Dot3Name + FAT_MAIN_NAME_LEN, FAT_EXTEND_NAME_LEN, CaseFlag & FAT_CASE_EXT_LOWER, &TempExt[1]);\r
   if (TempExt[1] != 0) {\r
     TempExt[0] = L'.';\r
-    StrCat (FileString, TempExt);\r
+    StrCatS (FileString, FileStringMax, TempExt);\r
   }\r
 }\r
 \r
@@ -453,7 +453,7 @@ Returns:
   UINT8 Sum;\r
   Sum = 0;\r
   for (ShortNameLen = FAT_NAME_LEN; ShortNameLen != 0; ShortNameLen--) {\r
-    Sum = (UINT8)(((Sum & 1) ? 0x80 : 0) + (Sum >> 1) + *ShortNameString++);\r
+    Sum = (UINT8)((((Sum & 1) != 0) ? 0x80 : 0) + (Sum >> 1) + *ShortNameString++);\r
   }\r
 \r
   return Sum;\r