From 0d46defefa871d0b9583dfc4cb1985a5b0835ada Mon Sep 17 00:00:00 2001 From: Hao Wu Date: Tue, 27 Sep 2016 13:41:50 +0800 Subject: BaseTools/VfrCompile: Add assignment operator definition for some classes For class that defines the copy constructor, it is better to add the assignment operator definition as well. This commit adds the definition for assignment operator for the classes with the copy constructor defined. Cc: Liming Gao Cc: Yonghong Zhu Cc: Eric Dong Cc: Dandan Bi Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu Reviewed-by: Liming Gao --- BaseTools/Source/C/VfrCompile/VfrFormPkg.h | 1 + BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp | 16 ++++++++++++++++ BaseTools/Source/C/VfrCompile/VfrUtilityLib.h | 1 + 3 files changed, 18 insertions(+) (limited to 'BaseTools/Source/C/VfrCompile') diff --git a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h index 051df28768..3c7964ac42 100644 --- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h +++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h @@ -307,6 +307,7 @@ private: public: CIfrOpHeader (IN UINT8 OpCode, IN VOID *StartAddr, IN UINT8 Length = 0); CIfrOpHeader (IN CIfrOpHeader &); + CIfrOpHeader& operator=(IN CONST CIfrOpHeader &); VOID IncLength (UINT8 Size) { if ((mHeader->Length + Size) > mHeader->Length) { diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp index 1afa5a2590..3ca57ed741 100644 --- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp +++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp @@ -2390,6 +2390,22 @@ EFI_VARSTORE_INFO::EFI_VARSTORE_INFO ( mVarTotalSize = Info.mVarTotalSize; } +EFI_VARSTORE_INFO& +EFI_VARSTORE_INFO::operator= ( + IN CONST EFI_VARSTORE_INFO &Info + ) +{ + if (this != &Info) { + mVarStoreId = Info.mVarStoreId; + mInfo.mVarName = Info.mInfo.mVarName; + mInfo.mVarOffset = Info.mInfo.mVarOffset; + mVarType = Info.mVarType; + mVarTotalSize = Info.mVarTotalSize; + } + + return *this; +} + BOOLEAN EFI_VARSTORE_INFO::operator == ( IN EFI_VARSTORE_INFO *Info diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h index 35d17a031b..2e06e4f167 100644 --- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h +++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h @@ -264,6 +264,7 @@ struct EFI_VARSTORE_INFO { EFI_VARSTORE_INFO (VOID); EFI_VARSTORE_INFO (IN EFI_VARSTORE_INFO &); + EFI_VARSTORE_INFO& operator=(IN CONST EFI_VARSTORE_INFO &); BOOLEAN operator == (IN EFI_VARSTORE_INFO *); }; -- cgit v1.2.3