From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3DC6D1A1F1F for ; Wed, 12 Oct 2016 05:21:41 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP; 12 Oct 2016 05:21:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,482,1473145200"; d="scan'208";a="1063788790" Received: from shwdeopenpsi014.ccr.corp.intel.com ([10.239.9.34]) by orsmga002.jf.intel.com with ESMTP; 12 Oct 2016 05:21:39 -0700 From: Hao Wu To: edk2-devel@lists.01.org Cc: Hao Wu , Liming Gao , Yonghong Zhu , Eric Dong , Dandan Bi Date: Wed, 12 Oct 2016 20:20:10 +0800 Message-Id: <1476274836-10544-27-git-send-email-hao.a.wu@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.0 In-Reply-To: <1476274836-10544-1-git-send-email-hao.a.wu@intel.com> References: <1476274836-10544-1-git-send-email-hao.a.wu@intel.com> Subject: [PATCH 26/52] BaseTools/VfrCompile: Add assignment operator definition for some classes X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2016 12:21:41 -0000 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 --- 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(+) diff --git a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h index 051df28..3c7964a 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 1afa5a2..3ca57ed 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 35d17a0..2e06e4f 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 *); }; -- 1.9.5.msysgit.0