From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 337771A1DF7 for ; Mon, 17 Oct 2016 18:12:49 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP; 17 Oct 2016 18:12:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,359,1473145200"; d="scan'208";a="20586010" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga006.fm.intel.com with ESMTP; 17 Oct 2016 18:12:48 -0700 Received: from fmsmsx126.amr.corp.intel.com (10.18.125.43) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 17 Oct 2016 18:12:48 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX126.amr.corp.intel.com (10.18.125.43) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 17 Oct 2016 18:12:48 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.206]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.96]) with mapi id 14.03.0248.002; Tue, 18 Oct 2016 09:12:17 +0800 From: "Dong, Eric" To: "Wu, Hao A" , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Zhu, Yonghong" , "Bi, Dandan" Thread-Topic: [PATCH 52/52] BaseTools/VfrCompile/Pccts: Make assignment operator not returning void Thread-Index: AQHSJINRIIUtkk6dN0a71i7uG5vxQqCslcEA Date: Tue, 18 Oct 2016 01:12:16 +0000 Message-ID: References: <1476274836-10544-1-git-send-email-hao.a.wu@intel.com> <1476274836-10544-53-git-send-email-hao.a.wu@intel.com> In-Reply-To: <1476274836-10544-53-git-send-email-hao.a.wu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 52/52] BaseTools/VfrCompile/Pccts: Make assignment operator not returning void 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: Tue, 18 Oct 2016 01:12:49 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Hao, I have below comments: Case 1: In order to keep consistence, can you also change other cases which= still initialized with '\0' mOptions.VfrFileName[0] =3D '\0'; mOptions.RecordListFile =3D NULL; mOptions.CreateRecordListFile =3D FALSE; mOptions.CreateIfrPkgFile =3D FALSE; mOptions.PkgOutputFileName =3D NULL; mOptions.COutputFileName =3D NULL; mOptions.OutputDirectory[0] =3D '\0'; mOptions.PreprocessorOutputFileName =3D NULL; mOptions.VfrBaseFileName[0] =3D '\0'; Case 2: for below case, you can use the actual size for the strncpy instead= of MAX_PATH - 1. Also the last line code is not needed. if (strlen (Argv[Index]) > MAX_PATH - 1) { DebugError (NULL, 0, 1003, "Invalid option value", "Output director= y name %s is too long", Argv[Index]); goto Fail; } strncpy (mOptions.OutputDirectory, Argv[Index], MAX_PATH - 1); mOptions.OutputDirectory[MAX_PATH - 1] =3D 0; Thanks, Eric > -----Original Message----- > From: Wu, Hao A > Sent: Wednesday, October 12, 2016 8:21 PM > To: edk2-devel@lists.01.org > Cc: Wu, Hao A; Gao, Liming; Zhu, Yonghong; Dong, Eric; Bi, Dandan > Subject: [PATCH 52/52] BaseTools/VfrCompile/Pccts: Make assignment operat= or not returning void >=20 > The assignment operators for class ANTLRTokenPtr return void in current > code. >=20 > This commit makes them return the reference to the object just like > primitive types do. >=20 > 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/Pccts/h/ATokPtr.h | 4 ++-- > BaseTools/Source/C/VfrCompile/Pccts/h/ATokPtrImpl.h | 6 ++++-- > 2 files changed, 6 insertions(+), 4 deletions(-) >=20 > diff --git a/BaseTools/Source/C/VfrCompile/Pccts/h/ATokPtr.h b/BaseTools/= Source/C/VfrCompile/Pccts/h/ATokPtr.h > index 75b4c86..df89d8f 100644 > --- a/BaseTools/Source/C/VfrCompile/Pccts/h/ATokPtr.h > +++ b/BaseTools/Source/C/VfrCompile/Pccts/h/ATokPtr.h > @@ -58,8 +58,8 @@ public: > // 7-Apr-97 133MR1 > // Fix suggested by Andreas Magnusson > // (Andreas.Magnusson@mailbox.swipnet.se) > - void operator =3D (const ANTLRTokenPtr & lhs); // MR1 > - void operator =3D (ANTLRAbstractToken *addr); > + ANTLRTokenPtr& operator =3D (const ANTLRTokenPtr & lhs); // MR1 > + ANTLRTokenPtr& operator =3D (ANTLRAbstractToken *addr); > int operator !=3D (const ANTLRTokenPtr &q) const // MR1 // MR1= 1 unsigned -> int > { return this->ptr_ !=3D q.ptr_; } > int operator =3D=3D (const ANTLRTokenPtr &q) const // MR1 // MR1= 1 unsigned -> int > diff --git a/BaseTools/Source/C/VfrCompile/Pccts/h/ATokPtrImpl.h b/BaseTo= ols/Source/C/VfrCompile/Pccts/h/ATokPtrImpl.h > index 9c07cf5..a1efc3b 100644 > --- a/BaseTools/Source/C/VfrCompile/Pccts/h/ATokPtrImpl.h > +++ b/BaseTools/Source/C/VfrCompile/Pccts/h/ATokPtrImpl.h > @@ -71,18 +71,20 @@ ANTLRTokenPtr::~ANTLRTokenPtr() > // 8-Apr-97 MR1 Make operator -> a const member function > // as weall as some other member functions > // > -void ANTLRTokenPtr::operator =3D (const ANTLRTokenPtr & lhs) // MR1 > +ANTLRTokenPtr& ANTLRTokenPtr::operator =3D (const ANTLRTokenPtr & lhs) = // MR1 > { > lhs.ref(); // protect against "xp =3D xp"; ie same underlying object > deref(); > ptr_ =3D lhs.ptr_; > + return *this; > } >=20 > -void ANTLRTokenPtr::operator =3D (ANTLRAbstractToken *addr) > +ANTLRTokenPtr& ANTLRTokenPtr::operator =3D (ANTLRAbstractToken *addr) > { > if (addr !=3D NULL) { > addr->ref(); > } > deref(); > ptr_ =3D addr; > + return *this; > } > -- > 1.9.5.msysgit.0