Code Scrub for DxeCrc32GuidedSectionExtractLib library instance.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5455 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4 2008-07-11 08:18:17 +00:00
parent 4e5d040ff8
commit 2a86ff1cb0
6 changed files with 11 additions and 9 deletions

View File

@ -215,7 +215,7 @@ Ip4IsUnicast (
IN IP4_ADDR NetMask IN IP4_ADDR NetMask
); );
extern IP4_ADDR mIp4AllMasks [IP4_MASK_NUM]; extern IP4_ADDR gIp4AllMasks [IP4_MASK_NUM];
extern EFI_IPv4_ADDRESS mZeroIp4Addr; extern EFI_IPv4_ADDRESS mZeroIp4Addr;

View File

@ -22,6 +22,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/BaseMemoryLib.h> #include <Library/BaseMemoryLib.h>
#include <Library/UefiBootServicesTableLib.h> #include <Library/UefiBootServicesTableLib.h>
#define EFI_SECITON_SIZE_MASK 0x00ffffff
typedef struct { typedef struct {
EFI_GUID_DEFINED_SECTION GuidedSectionHeader; EFI_GUID_DEFINED_SECTION GuidedSectionHeader;
UINT32 CRC32Checksum; UINT32 CRC32Checksum;
@ -64,7 +66,7 @@ Crc32GuidedSectionGetInfo (
// //
*SectionAttribute = ((EFI_GUID_DEFINED_SECTION *) InputSection)->Attributes; *SectionAttribute = ((EFI_GUID_DEFINED_SECTION *) InputSection)->Attributes;
*ScratchBufferSize = 0; *ScratchBufferSize = 0;
*OutputBufferSize = *(UINT32 *) (((EFI_COMMON_SECTION_HEADER *) InputSection)->Size) & 0x00ffffff; *OutputBufferSize = *(UINT32 *) (((EFI_COMMON_SECTION_HEADER *) InputSection)->Size) & EFI_SECITON_SIZE_MASK;
*OutputBufferSize -= ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset; *OutputBufferSize -= ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset;
return EFI_SUCCESS; return EFI_SUCCESS;
@ -117,7 +119,7 @@ Crc32GuidedSectionHandler (
// //
Crc32SectionHeader = (CRC32_SECTION_HEADER *) InputSection; Crc32SectionHeader = (CRC32_SECTION_HEADER *) InputSection;
*OutputBuffer = (UINT8 *) InputSection + Crc32SectionHeader->GuidedSectionHeader.DataOffset; *OutputBuffer = (UINT8 *) InputSection + Crc32SectionHeader->GuidedSectionHeader.DataOffset;
OutputBufferSize = *(UINT32 *) (((EFI_COMMON_SECTION_HEADER *) InputSection)->Size) & 0x00ffffff; OutputBufferSize = *(UINT32 *) (((EFI_COMMON_SECTION_HEADER *) InputSection)->Size) & EFI_SECITON_SIZE_MASK;
OutputBufferSize -= Crc32SectionHeader->GuidedSectionHeader.DataOffset; OutputBufferSize -= Crc32SectionHeader->GuidedSectionHeader.DataOffset;
// //

View File

@ -43,7 +43,7 @@ EFI_DPC_PROTOCOL *mDpc = NULL;
// //
// All the supported IP4 maskes in host byte order. // All the supported IP4 maskes in host byte order.
// //
IP4_ADDR mIp4AllMasks[IP4_MASK_NUM] = { IP4_ADDR gIp4AllMasks[IP4_MASK_NUM] = {
0x00000000, 0x00000000,
0x80000000, 0x80000000,
0xC0000000, 0xC0000000,
@ -104,7 +104,7 @@ NetGetMaskLength (
INTN Index; INTN Index;
for (Index = 0; Index < IP4_MASK_NUM; Index++) { for (Index = 0; Index < IP4_MASK_NUM; Index++) {
if (NetMask == mIp4AllMasks[Index]) { if (NetMask == gIp4AllMasks[Index]) {
break; break;
} }
} }
@ -179,7 +179,7 @@ Ip4IsUnicast (
} }
if (NetMask == 0) { if (NetMask == 0) {
NetMask = mIp4AllMasks[Class << 3]; NetMask = gIp4AllMasks[Class << 3];
} }
if (((Ip &~NetMask) == ~NetMask) || ((Ip &~NetMask) == 0)) { if (((Ip &~NetMask) == ~NetMask) || ((Ip &~NetMask) == 0)) {

View File

@ -409,7 +409,7 @@ DhcpLeaseAcquired (
if (DhcpSb->Netmask == 0) { if (DhcpSb->Netmask == 0) {
Class = NetGetIpClass (DhcpSb->ClientAddr); Class = NetGetIpClass (DhcpSb->ClientAddr);
DhcpSb->Netmask = mIp4AllMasks[Class << 3]; DhcpSb->Netmask = gIp4AllMasks[Class << 3];
} }
if (DhcpSb->LeaseIoPort != NULL) { if (DhcpSb->LeaseIoPort != NULL) {

View File

@ -554,7 +554,7 @@ Ip4SetAddress (
Type = NetGetIpClass (IpAddr); Type = NetGetIpClass (IpAddr);
Len = NetGetMaskLength (SubnetMask); Len = NetGetMaskLength (SubnetMask);
Netmask = mIp4AllMasks[MIN (Len, Type << 3)]; Netmask = gIp4AllMasks[MIN (Len, Type << 3)];
Interface->NetBrdcast = (IpAddr | ~Netmask); Interface->NetBrdcast = (IpAddr | ~Netmask);
// //

View File

@ -796,7 +796,7 @@ Ip4StationAddressValid (
return FALSE; return FALSE;
} }
NetBrdcastMask = mIp4AllMasks[MIN (Len, Type << 3)]; NetBrdcastMask = gIp4AllMasks[MIN (Len, Type << 3)];
if (Ip == (Ip | ~NetBrdcastMask)) { if (Ip == (Ip | ~NetBrdcastMask)) {
return FALSE; return FALSE;