From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.24; helo=mga09.intel.com; envelope-from=eric.jin@intel.com; receiver=edk2-devel@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id CAD6B211EA9EC for ; Fri, 29 Mar 2019 01:31:51 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Mar 2019 01:31:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,283,1549958400"; d="scan'208";a="135841454" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga008.fm.intel.com with ESMTP; 29 Mar 2019 01:31:50 -0700 Received: from fmsmsx115.amr.corp.intel.com (10.18.116.19) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 29 Mar 2019 01:31:50 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx115.amr.corp.intel.com (10.18.116.19) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 29 Mar 2019 01:31:49 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.134]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.158]) with mapi id 14.03.0415.000; Fri, 29 Mar 2019 16:31:47 +0800 From: "Jin, Eric" To: Supreeth Venkatesh , "edk2-devel@lists.01.org" CC: "Jin, Eric" Thread-Topic: [edk2] [edk2-test][PATCH v2] SctPkg/Tools: Fix incorrect line ending detection by GenBin tool Thread-Index: AQHU5bxNiZIWXzOUCkaTp/2vPgKsLKYiRxDQ Date: Fri, 29 Mar 2019 08:31:47 +0000 Message-ID: References: <1543397402-19411-1-git-send-email-lokesh.bv@arm.com> <1543397402-19411-5-git-send-email-lokesh.bv@arm.com> In-Reply-To: <1543397402-19411-5-git-send-email-lokesh.bv@arm.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: [edk2-test][PATCH v2] SctPkg/Tools: Fix incorrect line ending detection by GenBin tool X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Mar 2019 08:31:52 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Supreeth, This patch can't be applied to the lasted code base SHA-1: 33022e.=20 One patch from may already fix the issue. Please check again. Best Regards Eric -----Original Message----- From: edk2-devel On Behalf Of Supreeth Ve= nkatesh Sent: Friday, March 29, 2019 7:08 AM To: supreeth.venkatesh@arm.com; edk2-devel@lists.01.org Subject: [edk2] [edk2-test][PATCH v2] SctPkg/Tools: Fix incorrect line endi= ng detection by GenBin tool From: Lokesh B V Some windows editors uses "\r\n" for line feed. While processing uefi sct t= estcase info file, the GenBin tool logic to skip line feed doesn't consider= the presence of carraige return(\r) in line feed. So this results in incor= rect format error. Fixed this issue by changing logic of Trim and Getline functions used in Ge= nBin source code. Cc: Supreeth Venkatesh Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Lokesh B V --- Changes since v1: * Adopted changes suggested by Supreeth. * modified Copyright content uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c | 58 +++++++++++++-----------= ---- 1 file changed, 26 insertions(+), 32 deletions(-) diff --git a/uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c b/uefi-sct/SctPkg= /Tools/Source/GenBin/GenBin.c index 61bb35b..6d8e844 100644 --- a/uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c +++ b/uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c @@ -2,6 +2,7 @@ =20 Copyright 2006 - 2010 Unified EFI, Inc.
Copyright (c) 2010 Intel Corporation. All rights reserved.
+ Copyright (c) 2018 ARM Ltd. All rights reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License @@ -32,6 +33,7 @@ Abstract: #include #include #include +#include =20 // // Definitions @@ -49,7 +51,7 @@ PrintUsage ( void ); =20 -void +char * Trim ( char *String ); @@ -159,50 +161,42 @@ PrintUsage ( } =20 =20 -void +char * Trim ( char *String ) { - int Index1; - int Index2; int Length; + char *end; =20 Length =3D strlen (String); =20 - // - // Remove the space characters from the beginning of this string - // - for (Index1 =3D 0; Index1 < Length; Index1++) { - if ((String[Index1] !=3D ' ' ) && - (String[Index1] !=3D '\t') && - (String[Index1] !=3D '\n')) { - break; - } - } - - for (Index2 =3D Index1; Index2 < Length; Index2++) { - String[Index2 - Index1] =3D String[Index2]; + if (!Length) { + return String; } =20 - Length =3D Length - Index1; + end =3D String + Length - 1; =20 // // Remove the space characters from the end of this string // - for (Index1 =3D 0; Index1 < Length; Index1++) { - if ((String[Length - 1 - Index1] !=3D ' ' ) && - (String[Length - 1 - Index1] !=3D '\t') && - (String[Length - 1 - Index1] !=3D '\n')) { - break; - } + while (end >=3D String && isspace (*end)) { + end--; } =20 - String[Length - Index1] =3D '\0'; + *(end + 1) =3D '\0'; + + // + // Remove the space characters from the beginning of this string // =20 + while (*String && isspace (*String)) { + String++; + } =20 // // Done // + return String; } =20 =20 @@ -227,20 +221,20 @@ GetLine ( return -1; } =20 - (*LineNo)++; - // // Remove the beginning and ending space characters // - Trim (String); + String =3D Trim (Result); =20 // - // Ignore the empty line and comment line + // Skip the empty line and comment line // - if ((String[0] !=3D '\0') && - (String[0] !=3D '#' )) { - break; + if ((String[0] =3D=3D '\0') || + (String[0] =3D=3D '#' )) { + continue; } + + (*LineNo)++; } =20 // -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel