]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/VfrCompile/VfrError.cpp
BaseTools: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / BaseTools / Source / C / VfrCompile / VfrError.cpp
index 71305364f69ad2d2e4e7c185bcb8ed930b098ff9..65bb8e34fde963706a5e8df8a2132abe39e542ad 100644 (file)
@@ -1,15 +1,9 @@
 /** @file\r
-  \r
+\r
   VfrCompiler error handler.\r
 \r
-Copyright (c) 2004 - 2013, 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
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -45,12 +39,16 @@ static SVFR_ERROR_HANDLE VFR_ERROR_HANDLE_TABLE [] = {
   { VFR_RETURN_DATA_STRING_ERROR, ": data field string error or not support"},\r
   { VFR_RETURN_DEFAULT_VALUE_REDEFINED, ": default value re-defined with different value"},\r
   { VFR_RETURN_CONSTANT_ONLY, ": only constant is allowed in the expression"},\r
-  { VFR_RETURN_VARSTORE_NAME_REDEFINED_ERROR, ": Varstore name is defined by more than one varstores, it can't be referred as varstore, only varstore strucure name could be used."},\r
+  { VFR_RETURN_VARSTORE_NAME_REDEFINED_ERROR, ": Varstore name is defined by more than one varstores, it can't be referred as varstore, only varstore structure name could be used."},\r
+  { VFR_RETURN_BIT_WIDTH_ERROR, ": bit width must be <= sizeof (type) * 8 and the max width can not > 32" },\r
+  { VFR_RETURN_STRING_TO_UINT_OVERFLOW, ": String to UINT* Overflow"},\r
   { VFR_RETURN_CODEUNDEFINED, ": undefined Error Code" }\r
 };\r
 \r
 static SVFR_WARNING_HANDLE VFR_WARNING_HANDLE_TABLE [] = {\r
   { VFR_WARNING_DEFAULT_VALUE_REDEFINED, ": default value re-defined with different value"},\r
+  { VFR_WARNING_ACTION_WITH_TEXT_TWO, ": Action opcode should not have TextTwo part"},\r
+  { VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE, ": Not recommend to use obsoleted framework opcode"},\r
   { VFR_WARNING_CODEUNDEFINED, ": undefined Warning Code" }\r
 };\r
 \r
@@ -63,6 +61,7 @@ CVfrErrorHandle::CVfrErrorHandle (
   mScopeRecordListTail   = NULL;\r
   mVfrErrorHandleTable   = VFR_ERROR_HANDLE_TABLE;\r
   mVfrWarningHandleTable = VFR_WARNING_HANDLE_TABLE;\r
+  mWarningAsError        = FALSE;\r
 }\r
 \r
 CVfrErrorHandle::~CVfrErrorHandle (\r
@@ -72,7 +71,7 @@ CVfrErrorHandle::~CVfrErrorHandle (
   SVfrFileScopeRecord *pNode = NULL;\r
 \r
   if (mInputFileName != NULL) {\r
-    delete mInputFileName;\r
+    delete[] mInputFileName;\r
   }\r
 \r
   while (mScopeRecordListHead != NULL) {\r
@@ -107,7 +106,7 @@ CVfrErrorHandle::SetInputFile (
 }\r
 \r
 SVfrFileScopeRecord::SVfrFileScopeRecord (\r
-  IN CHAR8    *Record, \r
+  IN CHAR8    *Record,\r
   IN UINT32   LineNum\r
   )\r
 {\r
@@ -142,13 +141,13 @@ SVfrFileScopeRecord::~SVfrFileScopeRecord (
   )\r
 {\r
   if (mFileName != NULL) {\r
-    delete mFileName;\r
+    delete[] mFileName;\r
   }\r
 }\r
 \r
 VOID\r
 CVfrErrorHandle::ParseFileScopeRecord (\r
-  IN CHAR8     *Record, \r
+  IN CHAR8     *Record,\r
   IN UINT32    WholeScopeLine\r
   )\r
 {\r
@@ -217,7 +216,7 @@ CVfrErrorHandle::PrintMsg (
 {\r
   CHAR8                  *FileName = NULL;\r
   UINT32                 FileLine;\r
-  \r
+\r
   if (strncmp ("Warning", MsgType, strlen ("Warning")) == 0) {\r
     VerboseMsg ((CHAR8 *) ErrorMsg);\r
     return;\r
@@ -277,7 +276,7 @@ CVfrErrorHandle::HandleWarning (
   GetFileNameLineNum (LineNum, &FileName, &FileLine);\r
 \r
   if (mWarningAsError) {\r
-    Error (FileName, FileLine, 0x2220, "warning treated as error", NULL);\r
+    Error (FileName, FileLine, 0x2220, (CHAR8 *) "warning treated as error", NULL);\r
   }\r
 \r
   for (Index = 0; mVfrWarningHandleTable[Index].mWarningCode != VFR_WARNING_CODEUNDEFINED; Index++) {\r