mirror of https://github.com/acidanthera/audk.git
ArmPkg: Fix Ecc error 3002 in CompilerIntrinsicsLib
This patch fixes the following Ecc reported error: Non-Boolean comparisons should use a compare operator (==, !=, >, < >=, <=) Brackets are also added to comply to with the coding standard. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
This commit is contained in:
parent
e3fe63ddeb
commit
53aabb978e
|
@ -1,6 +1,7 @@
|
|||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2019, Pete Batard. All rights reserved.
|
||||
// Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
//
|
||||
|
@ -20,7 +21,7 @@ int memcmp(const void *s1, const void *s2, size_t n)
|
|||
unsigned char const *t1 = s1;
|
||||
unsigned char const *t2 = s2;
|
||||
|
||||
while (n--) {
|
||||
while (n-- != 0) {
|
||||
if (*t1 != *t2)
|
||||
return (int)*t1 - (int)*t2;
|
||||
t1++;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
|
||||
// Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
//
|
||||
|
@ -13,8 +14,9 @@ static void __memcpy(void *dest, const void *src, size_t n)
|
|||
unsigned char *d = dest;
|
||||
unsigned char const *s = src;
|
||||
|
||||
while (n--)
|
||||
while (n-- != 0) {
|
||||
*d++ = *s++;
|
||||
}
|
||||
}
|
||||
|
||||
void *memcpy(void *dest, const void *src, size_t n)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2017, Pete Batard. All rights reserved.<BR>
|
||||
// Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
//
|
||||
|
@ -20,8 +21,9 @@ void* memcpy(void *dest, const void *src, size_t n)
|
|||
unsigned char *d = dest;
|
||||
unsigned char const *s = src;
|
||||
|
||||
while (n--)
|
||||
while (n-- != 0) {
|
||||
*d++ = *s++;
|
||||
}
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2019, Pete Batard. All rights reserved.
|
||||
// Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
//
|
||||
|
@ -21,13 +22,15 @@ void* memmove(void *dest, const void *src, size_t n)
|
|||
unsigned char const *s = src;
|
||||
|
||||
if (d < s) {
|
||||
while (n--)
|
||||
while (n-- != 0) {
|
||||
*d++ = *s++;
|
||||
}
|
||||
} else {
|
||||
d += n;
|
||||
s += n;
|
||||
while (n--)
|
||||
while (n-- != 0) {
|
||||
*--d = *--s;
|
||||
}
|
||||
}
|
||||
|
||||
return dest;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
|
||||
// Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
//
|
||||
|
@ -13,8 +14,9 @@ void *__memset(void *s, int c, size_t n)
|
|||
{
|
||||
unsigned char *d = s;
|
||||
|
||||
while (n--)
|
||||
while (n-- != 0) {
|
||||
*d++ = c;
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2017, Pete Batard. All rights reserved.<BR>
|
||||
// Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
//
|
||||
|
@ -19,8 +20,9 @@ void *memset(void *s, int c, size_t n)
|
|||
{
|
||||
unsigned char *d = s;
|
||||
|
||||
while (n--)
|
||||
while (n-- != 0) {
|
||||
*d++ = (unsigned char)c;
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue