summaryrefslogtreecommitdiff
path: root/MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2008-09-03 07:54:27 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2008-09-03 07:54:27 +0000
commitafa223265a8c8c8e7e57654b22927778d1fb599a (patch)
tree31ac16ecaddd11b09f9c0bc8f7c75067ad8876ac /MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c
parentbb347ec2750f416da929f9995b1eb6b3fbe77cf7 (diff)
downloadedk2-platforms-afa223265a8c8c8e7e57654b22927778d1fb599a.tar.xz
clean the codes according to review comments.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5789 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c')
-rw-r--r--MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c b/MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c
index 36370ba4f7..82d67e057a 100644
--- a/MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c
+++ b/MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c
@@ -1,7 +1,7 @@
/** @file
- Tiano PE/COFF loader.
-
- Copyright (c) 2006 - 2007, Intel Corporation<BR>
+ Provides the services to get the entry point to a PE/COFF image that has either been
+ loaded into memory or is executing at it¡¯s linked address
+ Copyright (c) 2006 - 2008, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -15,7 +15,6 @@
#include <Base.h>
-
#include <Library/PeCoffGetEntryPointLib.h>
#include <Library/DebugLib.h>
@@ -52,7 +51,7 @@ PeCoffLoaderGetEntryPoint (
ASSERT (EntryPoint != NULL);
DosHdr = (EFI_IMAGE_DOS_HEADER *)Pe32Data;
- if (EFI_IMAGE_DOS_SIGNATURE == DosHdr->e_magic) {
+ if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
//
// DOS image header is present, so read the PE header after the DOS image header.
//
@@ -104,7 +103,7 @@ PeCoffLoaderGetMachineType (
ASSERT (Pe32Data != NULL);
DosHdr = (EFI_IMAGE_DOS_HEADER *)Pe32Data;
- if (EFI_IMAGE_DOS_SIGNATURE == DosHdr->e_magic) {
+ if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
//
// DOS image header is present, so read the PE header after the DOS image header.
//
@@ -116,9 +115,9 @@ PeCoffLoaderGetMachineType (
Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)Pe32Data;
}
- if (EFI_TE_IMAGE_HEADER_SIGNATURE == Hdr.Te->Signature) {
+ if (Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) {
return Hdr.Te->Machine;
- } else if (EFI_IMAGE_NT_SIGNATURE == Hdr.Pe32->Signature) {
+ } else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) {
return Hdr.Pe32->FileHeader.Machine;
}
@@ -168,7 +167,7 @@ PeCoffLoaderGetPdbPointer (
NumberOfRvaAndSizes = 0;
DosHdr = (EFI_IMAGE_DOS_HEADER *)Pe32Data;
- if (EFI_IMAGE_DOS_SIGNATURE == DosHdr->e_magic) {
+ if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
//
// DOS image header is present, so read the PE header after the DOS image header.
//
@@ -180,7 +179,7 @@ PeCoffLoaderGetPdbPointer (
Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)Pe32Data;
}
- if (EFI_TE_IMAGE_HEADER_SIGNATURE == Hdr.Te->Signature) {
+ if (Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) {
if (Hdr.Te->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress != 0) {
DirectoryEntry = &Hdr.Te->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG];
TEImageAdjust = sizeof (EFI_TE_IMAGE_HEADER) - Hdr.Te->StrippedSize;
@@ -188,7 +187,7 @@ PeCoffLoaderGetPdbPointer (
Hdr.Te->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress +
TEImageAdjust);
}
- } else if (EFI_IMAGE_NT_SIGNATURE == Hdr.Pe32->Signature) {
+ } else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) {
//
// NOTE: We use Machine field to identify PE32/PE32+, instead of Magic.
// It is due to backward-compatibility, for some system might
@@ -215,7 +214,7 @@ PeCoffLoaderGetPdbPointer (
Magic = Hdr.Pe32->OptionalHeader.Magic;
}
- if (EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC == Magic) {
+ if (Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
//
// Use PE32 offset get Debug Directory Entry
//
@@ -239,7 +238,7 @@ PeCoffLoaderGetPdbPointer (
return NULL;
}
- if (NULL == DebugEntry || NULL == DirectoryEntry) {
+ if (DebugEntry == NULL || DirectoryEntry == NULL) {
return NULL;
}