]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/Common/FvLib.c
BaseTools: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / BaseTools / Source / C / Common / FvLib.c
index 1b3c08bf161766dd106d27a9a2155acc72f8bb11..82dc557bb7db04eb8139814295cc8a9504235481 100644 (file)
@@ -1,14 +1,8 @@
 /** @file\r
 These functions assist in parsing and manipulating a Firmware Volume.\r
 \r
-Copyright (c) 2004 - 2014, 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
@@ -44,9 +38,9 @@ Arguments:
 \r
   Fv            Buffer containing the FV.\r
   FvLength      Length of the FV\r
-    \r
+\r
 Returns:\r
\r
+\r
   EFI_SUCCESS             Function Completed successfully.\r
   EFI_INVALID_PARAMETER   A required parameter was NULL.\r
 \r
@@ -80,9 +74,9 @@ Arguments:
 \r
   FvHeader      Pointer to the FV buffer.\r
   FvLength      Length of the FV\r
-    \r
+\r
 Returns:\r
\r
+\r
   EFI_SUCCESS             Function Completed successfully.\r
   EFI_INVALID_PARAMETER   A required parameter was NULL.\r
   EFI_ABORTED             The library needs to be initialized.\r
@@ -117,16 +111,16 @@ GetNextFile (
 Routine Description:\r
 \r
   This function returns the next file.  If the current file is NULL, it returns\r
-  the first file in the FV.  If the function returns EFI_SUCCESS and the file \r
+  the first file in the FV.  If the function returns EFI_SUCCESS and the file\r
   pointer is NULL, then there are no more files in the FV.\r
 \r
 Arguments:\r
 \r
   CurrentFile   Pointer to the current file, must be within the current FV.\r
   NextFile      Pointer to the next file in the FV.\r
-    \r
+\r
 Returns:\r
\r
+\r
   EFI_SUCCESS             Function completed successfully.\r
   EFI_INVALID_PARAMETER   A required parameter was NULL or is out of range.\r
   EFI_ABORTED             The library needs to be initialized.\r
@@ -194,7 +188,7 @@ Returns:
   //\r
   // Get next file, compensate for 8 byte alignment if necessary.\r
   //\r
-  *NextFile = (EFI_FFS_FILE_HEADER *) ((((UINTN) CurrentFile - (UINTN) mFvHeader + GetFfsFileLength(CurrentFile) + 0x07) & (-1 << 3)) + (UINT8 *) mFvHeader);\r
+  *NextFile = (EFI_FFS_FILE_HEADER *) ((((UINTN) CurrentFile - (UINTN) mFvHeader + GetFfsFileLength(CurrentFile) + 0x07) & (~(UINTN) 7)) + (UINT8 *) mFvHeader);\r
 \r
   //\r
   // Verify file is in this FV.\r
@@ -318,7 +312,7 @@ Routine Description:
 Arguments:\r
 \r
   FileType    Type of file to search for.\r
-  Instance    Instace of the file type to return.\r
+  Instance    Instance of the file type to return.\r
   File        Return pointer.  In the case of an error, contents are undefined.\r
 \r
 Returns:\r
@@ -479,7 +473,7 @@ Returns:
     //\r
     // Find next section (including compensating for alignment issues.\r
     //\r
-    CurrentSection.CommonHeader = (EFI_COMMON_SECTION_HEADER *) ((((UINTN) CurrentSection.CommonHeader) + GetSectionFileLength(CurrentSection.CommonHeader) + 0x03) & (-1 << 2));\r
+    CurrentSection.CommonHeader = (EFI_COMMON_SECTION_HEADER *) ((((UINTN) CurrentSection.CommonHeader) + GetSectionFileLength(CurrentSection.CommonHeader) + 0x03) & (~(UINTN) 3));\r
   }\r
 \r
   return EFI_NOT_FOUND;\r
@@ -496,7 +490,7 @@ GetSectionByType (
 \r
 Routine Description:\r
 \r
-  Find a section in a file by type and instance.  An instance of 1 is the first \r
+  Find a section in a file by type and instance.  An instance of 1 is the first\r
   instance.  The function will return NULL if a matching section cannot be found.\r
   GUID-defined sections, if special processing is not needed, are handled in a\r
   depth-first manner.\r
@@ -505,7 +499,7 @@ Arguments:
 \r
   File        The file to search.\r
   SectionType Type of file to search for.\r
-  Instance    Instace of the section to return.\r
+  Instance    Instance of the section to return.\r
   Section     Return pointer.  In the case of an error, contents are undefined.\r
 \r
 Returns:\r
@@ -543,7 +537,7 @@ Returns:
   // Get the first section\r
   //\r
   CurrentSection.CommonHeader = (EFI_COMMON_SECTION_HEADER *) ((UINTN) File + GetFfsHeaderLength(File));\r
-  \r
+\r
   //\r
   // Depth-first manner to find section file.\r
   //\r
@@ -784,7 +778,7 @@ Returns:
     return 0;\r
   }\r
   if (FfsHeader->Attributes & FFS_ATTRIB_LARGE_FILE) {\r
-    return ((EFI_FFS_FILE_HEADER2 *)FfsHeader)->ExtendedSize;\r
+    return (UINT32) ((EFI_FFS_FILE_HEADER2 *)FfsHeader)->ExtendedSize;\r
   } else {\r
     return GetLength(FfsHeader->Size);\r
   }\r
@@ -858,7 +852,7 @@ Returns:
   EFI_SUCCESS              The function completed successfully.\r
   EFI_INVALID_PARAMETER    One of the input parameters was invalid.\r
   EFI_ABORTED              Operation aborted.\r
-  \r
+\r
 --*/\r
 {\r
   EFI_STATUS  Status;\r
@@ -905,7 +899,7 @@ Routine Description:
   It in no way validate the FFS file.\r
 \r
 Arguments:\r
-  \r
+\r
   ErasePolarity The erase polarity for the file state bits.\r
   FfsHeader     Pointer to a FFS file.\r
 \r