]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
BaseTools: Clean up source files
[mirror_edk2.git] / BaseTools / Source / C / VfrCompile / VfrUtilityLib.cpp
index d795ef01bda11778bac7233e45dcde7683426e44..2ebaf58f17c59a66167a526157b6dde163774f75 100644 (file)
@@ -1,15 +1,15 @@
 /** @file\r
-  \r
+\r
   Vfr common library functions.\r
 \r
 Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials                          \r
-are licensed and made available under the terms and conditions of the BSD License         \r
-which accompanies this distribution.  The full text of the license may be found at        \r
-http://opensource.org/licenses/bsd-license.php                                            \r
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 **/\r
 \r
@@ -72,9 +72,9 @@ CVfrBinaryOutput::WriteEnd (
 }\r
 \r
 SConfigInfo::SConfigInfo (\r
-  IN UINT8              Type, \r
-  IN UINT16             Offset, \r
-  IN UINT32             Width, \r
+  IN UINT8              Type,\r
+  IN UINT16             Offset,\r
+  IN UINT32             Width,\r
   IN EFI_IFR_TYPE_VALUE Value\r
   )\r
 {\r
@@ -553,7 +553,7 @@ _STR2U32 (
     //\r
     // BUG: does not handle overflow here\r
     //\r
-       (IsHex == TRUE) ? (Value <<= 4) : (Value *= 10);\r
+  (IsHex == TRUE) ? (Value <<= 4) : (Value *= 10);\r
 \r
     if ((IsHex == TRUE) && (c >= 'a') && (c <= 'f')) {\r
       Value += (c - 'a' + 10);\r
@@ -764,7 +764,7 @@ CVfrVarDataTypeDB::GetFieldOffset (
   if (Field == NULL) {\r
     return VFR_RETURN_FATAL_ERROR;\r
   }\r
-  \r
+\r
   //\r
   // Framework Vfr file Array Index is from 1.\r
   // But Uefi Vfr file Array Index is from 0.\r
@@ -779,7 +779,7 @@ CVfrVarDataTypeDB::GetFieldOffset (
   if ((ArrayIdx != INVALID_ARRAY_INDEX) && ((Field->mArrayNum == 0) || (Field->mArrayNum <= ArrayIdx))) {\r
     return VFR_RETURN_ERROR_ARRARY_NUM;\r
   }\r
-  \r
+\r
   //\r
   // Be compatible with the current usage\r
   // If ArraryIdx is not specified, the first one is used.\r
@@ -983,7 +983,7 @@ CVfrVarDataTypeDB::~CVfrVarDataTypeDB (
       pType->mMembers = pType->mMembers->mNext;\r
       delete pField;\r
     }\r
-       delete pType;\r
+  delete pType;\r
   }\r
 \r
   while (mPackStack != NULL) {\r
@@ -1505,10 +1505,10 @@ CVfrVarDataTypeDB::Dump (
     fprintf (File, "\t\tstruct %s {\n", pTNode->mTypeName);\r
     for (pFNode = pTNode->mMembers; pFNode != NULL; pFNode = pFNode->mNext) {\r
       if (pFNode->mArrayNum > 0) {\r
-        fprintf (File, "\t\t\t+%08d[%08x] %s[%d] <%s>\n", pFNode->mOffset, pFNode->mOffset, \r
+        fprintf (File, "\t\t\t+%08d[%08x] %s[%d] <%s>\n", pFNode->mOffset, pFNode->mOffset,\r
                   pFNode->mFieldName, pFNode->mArrayNum, pFNode->mFieldType->mTypeName);\r
       } else {\r
-        fprintf (File, "\t\t\t+%08d[%08x] %s <%s>\n", pFNode->mOffset, pFNode->mOffset, \r
+        fprintf (File, "\t\t\t+%08d[%08x] %s <%s>\n", pFNode->mOffset, pFNode->mOffset,\r
                   pFNode->mFieldName, pFNode->mFieldType->mTypeName);\r
       }\r
     }\r
@@ -1536,7 +1536,7 @@ CVfrVarDataTypeDB::ParserDB (
       printf ("\t\t\t%s\t%s\n", pFNode->mFieldType->mTypeName, pFNode->mFieldName);\r
     }\r
     printf ("\t\t};\n");\r
-       printf ("---------------------------------------------------------------\n");\r
+  printf ("---------------------------------------------------------------\n");\r
   }\r
   printf ("***************************************************************\n");\r
 }\r
@@ -1688,7 +1688,7 @@ CVfrDataStorage::GetFreeVarStoreId (
   )\r
 {\r
   UINT32  Index, Mask, Offset;\r
-  \r
+\r
   //\r
   // Assign the different ID range for the different type VarStore to support Framework Vfr\r
   //\r
@@ -1770,7 +1770,7 @@ CVfrDataStorage::DeclareNameVarStoreBegin (
   if (GetVarStoreId (StoreName, &TmpVarStoreId) == VFR_RETURN_SUCCESS) {\r
     return VFR_RETURN_REDEFINED;\r
   }\r
-  \r
+\r
   if (VarStoreId == EFI_VARSTORE_ID_INVALID) {\r
     VarStoreId = GetFreeVarStoreId (EFI_VFR_VARSTORE_NAME);\r
   } else {\r
@@ -1828,10 +1828,10 @@ CVfrDataStorage::DeclareNameVarStoreEnd (
   return VFR_RETURN_SUCCESS;\r
 }\r
 \r
-EFI_VFR_RETURN_CODE \r
+EFI_VFR_RETURN_CODE\r
 CVfrDataStorage::DeclareEfiVarStore (\r
-  IN CHAR8          *StoreName, \r
-  IN EFI_GUID       *Guid, \r
+  IN CHAR8          *StoreName,\r
+  IN EFI_GUID       *Guid,\r
   IN EFI_STRING_ID  NameStrId,\r
   IN UINT32         VarSize,\r
   IN BOOLEAN        Flag\r
@@ -1863,10 +1863,10 @@ CVfrDataStorage::DeclareEfiVarStore (
   return VFR_RETURN_SUCCESS;\r
 }\r
 \r
-EFI_VFR_RETURN_CODE \r
+EFI_VFR_RETURN_CODE\r
 CVfrDataStorage::DeclareBufferVarStore (\r
-  IN CHAR8             *StoreName, \r
-  IN EFI_GUID          *Guid, \r
+  IN CHAR8             *StoreName,\r
+  IN EFI_GUID          *Guid,\r
   IN CVfrVarDataTypeDB *DataTypeDB,\r
   IN CHAR8             *TypeName,\r
   IN EFI_VARSTORE_ID   VarStoreId,\r
@@ -1911,7 +1911,7 @@ CVfrDataStorage::DeclareBufferVarStore (
   return VFR_RETURN_SUCCESS;\r
 }\r
 \r
-EFI_VFR_RETURN_CODE \r
+EFI_VFR_RETURN_CODE\r
 CVfrDataStorage::GetVarStoreByDataType (\r
   IN  CHAR8              *DataTypeName,\r
   OUT SVfrVarStorageNode **VarNode,\r
@@ -1920,7 +1920,7 @@ CVfrDataStorage::GetVarStoreByDataType (
 {\r
   SVfrVarStorageNode    *pNode;\r
   SVfrVarStorageNode    *MatchNode;\r
-  \r
+\r
   //\r
   // Framework VFR uses Data type name as varstore name, so don't need check again.\r
   //\r
@@ -1950,7 +1950,7 @@ CVfrDataStorage::GetVarStoreByDataType (
       }\r
     }\r
   }\r
-  \r
+\r
   if (MatchNode == NULL) {\r
     return VFR_RETURN_UNDEFINED;\r
   }\r
@@ -1959,7 +1959,7 @@ CVfrDataStorage::GetVarStoreByDataType (
   return VFR_RETURN_SUCCESS;\r
 }\r
 \r
-EFI_VARSTORE_ID \r
+EFI_VARSTORE_ID\r
 CVfrDataStorage::CheckGuidField (\r
   IN  SVfrVarStorageNode   *pNode,\r
   IN  EFI_GUID             *StoreGuid,\r
@@ -1999,7 +1999,7 @@ CVfrDataStorage::CheckGuidField (
 }\r
 \r
 /**\r
-  Base on the input store name and guid to find the varstore id. \r
+  Base on the input store name and guid to find the varstore id.\r
 \r
   If both name and guid are inputed, base on the name and guid to\r
   found the varstore. If only name inputed, base on the name to\r
@@ -2007,10 +2007,10 @@ CVfrDataStorage::CheckGuidField (
   has the same name. If only has found one varstore, return this\r
   varstore; if more than one varstore has same name, return varstore\r
   name redefined error. If no varstore found by varstore name, call\r
-  function GetVarStoreByDataType and use inputed varstore name as \r
+  function GetVarStoreByDataType and use inputed varstore name as\r
   data type name to search.\r
 **/\r
-EFI_VFR_RETURN_CODE \r
+EFI_VFR_RETURN_CODE\r
 CVfrDataStorage::GetVarStoreId (\r
   IN  CHAR8           *StoreName,\r
   OUT EFI_VARSTORE_ID *VarStoreId,\r
@@ -2058,14 +2058,14 @@ CVfrDataStorage::GetVarStoreId (
   *VarStoreId         = EFI_VARSTORE_ID_INVALID;\r
 \r
   //\r
-  // Assume that Data strucutre name is used as StoreName, and check again. \r
+  // Assume that Data strucutre name is used as StoreName, and check again.\r
   //\r
   ReturnCode = GetVarStoreByDataType (StoreName, &pNode, StoreGuid);\r
   if (pNode != NULL) {\r
     mCurrVarStorageNode = pNode;\r
     *VarStoreId = pNode->mVarStoreId;\r
   }\r
-  \r
+\r
   return ReturnCode;\r
 }\r
 \r
@@ -2169,7 +2169,7 @@ CVfrDataStorage::GetVarStoreGuid (
 \r
 EFI_VFR_RETURN_CODE\r
 CVfrDataStorage::GetVarStoreName (\r
-  IN  EFI_VARSTORE_ID VarStoreId, \r
+  IN  EFI_VARSTORE_ID VarStoreId,\r
   OUT CHAR8           **VarStoreName\r
   )\r
 {\r
@@ -2294,7 +2294,7 @@ CVfrDataStorage::GetNameVarStoreInfo (
   if (mCurrVarStorageNode == NULL) {\r
     return VFR_RETURN_GET_NVVARSTORE_ERROR;\r
   }\r
-  \r
+\r
   //\r
   // Framework Vfr file Index is from 1, but Uefi Vfr file Index is from 0.\r
   //\r
@@ -2312,8 +2312,8 @@ CVfrDataStorage::GetNameVarStoreInfo (
 \r
 SVfrDefaultStoreNode::SVfrDefaultStoreNode (\r
   IN EFI_IFR_DEFAULTSTORE *ObjBinAddr,\r
-  IN CHAR8                *RefName, \r
-  IN EFI_STRING_ID        DefaultStoreNameId, \r
+  IN CHAR8                *RefName,\r
+  IN EFI_STRING_ID        DefaultStoreNameId,\r
   IN UINT16               DefaultId\r
   )\r
 {\r
@@ -2391,7 +2391,7 @@ CVfrDefaultStore::RegisterDefaultStore (
 }\r
 \r
 /*\r
- * assign new reference name or new default store name id only if \r
+ * assign new reference name or new default store name id only if\r
  * the original is invalid\r
  */\r
 EFI_VFR_RETURN_CODE\r
@@ -2507,7 +2507,7 @@ CVfrDefaultStore::BufferVarStoreAltConfigAdd (
       goto WriteError;\r
     }\r
   }\r
-  \r
+\r
   gCVfrBufferConfig.Close ();\r
 \r
   return VFR_RETURN_SUCCESS;\r
@@ -2649,7 +2649,7 @@ EFI_VARSTORE_INFO::operator == (
   )\r
 {\r
   if ((mVarStoreId == Info->mVarStoreId) &&\r
-         (mInfo.mVarName == Info->mInfo.mVarName) &&\r
+      (mInfo.mVarName == Info->mInfo.mVarName) &&\r
       (mInfo.mVarOffset == Info->mInfo.mVarOffset) &&\r
       (mVarType == Info->mVarType) &&\r
       (mVarTotalSize == Info->mVarTotalSize) &&\r
@@ -2832,7 +2832,7 @@ CVfrQuestionDB::ResetInit(
 \r
   // Question ID 0 is reserved.\r
   mFreeQIdBitMap[0] = 0x80000000;\r
-  mQuestionList     = NULL;   \r
+  mQuestionList     = NULL;\r
 }\r
 \r
 VOID\r
@@ -3242,7 +3242,7 @@ Err:
   }\r
 }\r
 \r
-VOID \r
+VOID\r
 CVfrQuestionDB::RegisterRefQuestion (\r
   IN     CHAR8           *Name,\r
   IN     CHAR8           *BaseVarId,\r
@@ -3331,15 +3331,15 @@ CVfrQuestionDB::RegisterRefQuestion (
   pNode[0]->mQuestionId = QuestionId;\r
   pNode[1]->mQuestionId = QuestionId;\r
   pNode[2]->mQuestionId = QuestionId;\r
-  pNode[3]->mQuestionId = QuestionId;  \r
+  pNode[3]->mQuestionId = QuestionId;\r
   pNode[0]->mQtype      = QUESTION_REF;\r
   pNode[1]->mQtype      = QUESTION_REF;\r
   pNode[2]->mQtype      = QUESTION_REF;\r
-  pNode[3]->mQtype      = QUESTION_REF;  \r
+  pNode[3]->mQtype      = QUESTION_REF;\r
   pNode[0]->mNext       = pNode[1];\r
   pNode[1]->mNext       = pNode[2];\r
   pNode[2]->mNext       = pNode[3];\r
-  pNode[3]->mNext       = mQuestionList;  \r
+  pNode[3]->mNext       = mQuestionList;\r
   mQuestionList         = pNode[0];\r
 \r
   gCFormPkg.DoPendingAssign (VarIdStr[0], (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));\r
@@ -3368,15 +3368,15 @@ CVfrQuestionDB::UpdateQuestionId (
   )\r
 {\r
   SVfrQuestionNode *pNode = NULL;\r
-  \r
+\r
   if (QId == NewQId) {\r
     // don't update\r
     return VFR_RETURN_SUCCESS;\r
   }\r
-  \r
+\r
   //\r
   // For Framework Vfr, don't check question ID conflict.\r
-  //  \r
+  //\r
   if (!VfrCompatibleMode && ChekQuestionIdFree (NewQId) == FALSE) {\r
     return VFR_RETURN_REDEFINED;\r
   }\r
@@ -3432,7 +3432,7 @@ CVfrQuestionDB::GetQuestionId (
       if (strcmp (pNode->mVarIdStr, VarIdStr) != 0) {\r
         continue;\r
       }\r
-       }\r
+    }\r
 \r
     QuestionId = pNode->mQuestionId;\r
     BitMask    = pNode->mBitMask;\r
@@ -3499,7 +3499,7 @@ CVfrStringDB::~CVfrStringDB ()
 }\r
 \r
 \r
-VOID \r
+VOID\r
 CVfrStringDB::SetStringFileName(IN CHAR8 *StringFileName)\r
 {\r
   UINT32 FileLen = 0;\r
@@ -3524,7 +3524,7 @@ CVfrStringDB::SetStringFileName(IN CHAR8 *StringFileName)
 \r
 \r
 /**\r
-  Returns TRUE or FALSE whether SupportedLanguages contains the best matching language \r
+  Returns TRUE or FALSE whether SupportedLanguages contains the best matching language\r
   from a set of supported languages.\r
 \r
   @param[in]  SupportedLanguages  A pointer to a Null-terminated ASCII string that\r
@@ -3587,13 +3587,13 @@ CVfrStringDB::GetBestLanguage (
     }\r
 \r
     //\r
-    // Trim Language from the right to the next '-' character \r
+    // Trim Language from the right to the next '-' character\r
     //\r
     for (LanguageLength--; LanguageLength > 0 && Language[LanguageLength] != '-'; LanguageLength--);\r
   }\r
 \r
   //\r
-  // No matches were found \r
+  // No matches were found\r
   //\r
   return FALSE;\r
 }\r
@@ -3617,7 +3617,7 @@ CVfrStringDB::GetVarStoreNameFormStringId (
   CHAR8       LineBuf[EFI_IFR_MAX_LENGTH];\r
   UINT8       BlockType;\r
   EFI_HII_STRING_PACKAGE_HDR *PkgHeader;\r
-  \r
+\r
   if (mStringFileName == NULL) {\r
     return NULL;\r
   }\r