From f66c2b32cc1b0992def1923dd9ad9c3e4678e102 Mon Sep 17 00:00:00 2001 From: Pierre Gondois Date: Thu, 10 Dec 2020 10:38:26 +0000 Subject: ArmPkg: Fix Ecc error 3002 in SemihostFs This patch fixes the following Ecc reported error: Non-Boolean comparisons should use a compare operator (==, !=, >, < >=, <=) Signed-off-by: Pierre Gondois Reviewed-by: Ard Biesheuvel --- ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c') diff --git a/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c b/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c index a66bcb1369..69e983226b 100644 --- a/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c +++ b/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c @@ -2,7 +2,7 @@ Support a Semi Host file system over a debuggers JTAG Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- Portions copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.
+ Portions copyright (c) 2011 - 2021, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -196,8 +196,8 @@ FileOpen ( return EFI_INVALID_PARAMETER; } - if ((OpenMode & EFI_FILE_MODE_CREATE) && - (Attributes & EFI_FILE_DIRECTORY) ) { + if (((OpenMode & EFI_FILE_MODE_CREATE) != 0) && + ((Attributes & EFI_FILE_DIRECTORY) != 0)) { return EFI_WRITE_PROTECTED; } @@ -234,7 +234,7 @@ FileOpen ( Return = SemihostFileOpen (AsciiFileName, SemihostMode, &SemihostHandle); if (RETURN_ERROR (Return)) { - if (OpenMode & EFI_FILE_MODE_CREATE) { + if ((OpenMode & EFI_FILE_MODE_CREATE) != 0) { // // In the create if does not exist case, if the opening in update // mode failed, create it and open it in update mode. The update @@ -277,7 +277,8 @@ FileOpen ( FileFcb->Info.FileSize = Length; FileFcb->Info.PhysicalSize = Length; - FileFcb->Info.Attribute = (OpenMode & EFI_FILE_MODE_CREATE) ? Attributes : 0; + FileFcb->Info.Attribute = ((OpenMode & EFI_FILE_MODE_CREATE) != 0) ? + Attributes : 0; InsertTailList (&gFileList, &FileFcb->Link); -- cgit v1.2.3