MdeModulePkg/ResetUtilityLib: Add pack(1) for reset data structure
RESET_UTILITY_GUID_SPECIFIC_RESET_DATA structure should be declared as pack(1). The patch adds the missing pack(1) pragma. (GUID *)((UINT8 *)&ResetData + OFFSET_OF (RESET_UTILITY_GUID_SPECIFIC_RESET_DATA, ResetSubtype)) is used to replace &ResetData.ResetSubType to resolve C4366 VS compiler warning. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
This commit is contained in:
parent
51fe5b5140
commit
93f5a54ff3
@ -19,10 +19,14 @@
|
|||||||
#include <Library/BaseMemoryLib.h>
|
#include <Library/BaseMemoryLib.h>
|
||||||
#include <Library/ResetSystemLib.h>
|
#include <Library/ResetSystemLib.h>
|
||||||
|
|
||||||
|
#pragma pack(1)
|
||||||
typedef struct {
|
typedef struct {
|
||||||
CHAR16 NullTerminator;
|
CHAR16 NullTerminator;
|
||||||
GUID ResetSubtype;
|
GUID ResetSubtype;
|
||||||
} RESET_UTILITY_GUID_SPECIFIC_RESET_DATA;
|
} RESET_UTILITY_GUID_SPECIFIC_RESET_DATA;
|
||||||
|
#pragma pack()
|
||||||
|
|
||||||
|
VERIFY_SIZE_OF (RESET_UTILITY_GUID_SPECIFIC_RESET_DATA, 18);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This is a shorthand helper function to reset with a subtype so that
|
This is a shorthand helper function to reset with a subtype so that
|
||||||
@ -49,7 +53,10 @@ ResetPlatformSpecificGuid (
|
|||||||
RESET_UTILITY_GUID_SPECIFIC_RESET_DATA ResetData;
|
RESET_UTILITY_GUID_SPECIFIC_RESET_DATA ResetData;
|
||||||
|
|
||||||
ResetData.NullTerminator = CHAR_NULL;
|
ResetData.NullTerminator = CHAR_NULL;
|
||||||
CopyGuid (&ResetData.ResetSubtype, ResetSubtype);
|
CopyGuid (
|
||||||
|
(GUID *)((UINT8 *)&ResetData + OFFSET_OF (RESET_UTILITY_GUID_SPECIFIC_RESET_DATA, ResetSubtype)),
|
||||||
|
ResetSubtype
|
||||||
|
);
|
||||||
ResetPlatformSpecific (sizeof (ResetData), &ResetData);
|
ResetPlatformSpecific (sizeof (ResetData), &ResetData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user