From 764ef0515d13e66403dc8a0578ff91b88675ade6 Mon Sep 17 00:00:00 2001 From: Jung-uk Kim Date: Wed, 17 Jun 2015 17:11:44 +0000 Subject: [PATCH] Remove all internal macros and cast various invocations as necessary. https://github.com/acpica/acpica/commit/47d22a7 --- source/compiler/dtutils.c | 6 ++-- source/components/debugger/dbinput.c | 2 +- source/components/disassembler/dmopcode.c | 6 ++-- source/components/namespace/nsdump.c | 2 +- source/components/namespace/nsrepair2.c | 2 +- source/components/tables/tbprint.c | 2 +- source/components/utilities/utprint.c | 6 ++-- source/components/utilities/utstring.c | 18 +++++----- source/include/acutils.h | 18 ---------- source/include/platform/acenv.h | 44 ----------------------- source/tools/acpidump/apfiles.c | 8 ++--- source/tools/acpisrc/asutils.c | 2 +- 12 files changed, 27 insertions(+), 89 deletions(-) diff --git a/source/compiler/dtutils.c b/source/compiler/dtutils.c index 51068ed7ba32..95f005dcbbc1 100644 --- a/source/compiler/dtutils.c +++ b/source/compiler/dtutils.c @@ -241,7 +241,7 @@ DtStrtoul64 ( while (*ThisChar) { - if (isdigit (*ThisChar)) + if (isdigit ((int) *ThisChar)) { /* Convert ASCII 0-9 to Decimal value */ @@ -249,8 +249,8 @@ DtStrtoul64 ( } else /* Letter */ { - ThisDigit = (UINT32) toupper (*ThisChar); - if (!isxdigit ((char) ThisDigit)) + ThisDigit = (UINT32) toupper ((int) *ThisChar); + if (!isxdigit ((int) ThisDigit)) { /* Not A-F */ diff --git a/source/components/debugger/dbinput.c b/source/components/debugger/dbinput.c index 76d2455dc1ae..e588167dd03e 100644 --- a/source/components/debugger/dbinput.c +++ b/source/components/debugger/dbinput.c @@ -361,7 +361,7 @@ AcpiDbMatchCommandHelp ( while ((*Command) && (*Invocation) && (*Invocation != ' ')) { - if (tolower (*Command) != tolower (*Invocation)) + if (tolower ((int) *Command) != tolower ((int) *Invocation)) { return (FALSE); } diff --git a/source/components/disassembler/dmopcode.c b/source/components/disassembler/dmopcode.c index a312582e595e..60345fcaa599 100644 --- a/source/components/disassembler/dmopcode.c +++ b/source/components/disassembler/dmopcode.c @@ -269,10 +269,10 @@ AcpiDmPredefinedDescription ( * Note: NameString is guaranteed to be upper case here. */ LastCharIsDigit = - (isdigit (NameString[3])); /* d */ + (isdigit ((int) NameString[3])); /* d */ LastCharsAreHex = - (isxdigit (NameString[2]) && /* xx */ - isxdigit (NameString[3])); + (isxdigit ((int) NameString[2]) && /* xx */ + isxdigit ((int) NameString[3])); switch (NameString[1]) { diff --git a/source/components/namespace/nsdump.c b/source/components/namespace/nsdump.c index 8e3c3ddc499e..0e692baf3f96 100644 --- a/source/components/namespace/nsdump.c +++ b/source/components/namespace/nsdump.c @@ -122,7 +122,7 @@ AcpiNsPrintPathname ( { for (i = 0; i < 4; i++) { - isprint (Pathname[i]) ? + isprint ((int) Pathname[i]) ? AcpiOsPrintf ("%c", Pathname[i]) : AcpiOsPrintf ("?"); } diff --git a/source/components/namespace/nsrepair2.c b/source/components/namespace/nsrepair2.c index e7efbae6f859..f68f8bcced32 100644 --- a/source/components/namespace/nsrepair2.c +++ b/source/components/namespace/nsrepair2.c @@ -637,7 +637,7 @@ AcpiNsRepair_HID ( */ for (Dest = NewString->String.Pointer; *Source; Dest++, Source++) { - *Dest = (char) toupper (*Source); + *Dest = (char) toupper ((int) *Source); } AcpiUtRemoveReference (ReturnObject); diff --git a/source/components/tables/tbprint.c b/source/components/tables/tbprint.c index 2563cec17ebb..af73279cc6ee 100644 --- a/source/components/tables/tbprint.c +++ b/source/components/tables/tbprint.c @@ -84,7 +84,7 @@ AcpiTbFixString ( while (Length && *String) { - if (!isprint (*String)) + if (!isprint ((int) *String)) { *String = '?'; } diff --git a/source/components/utilities/utprint.c b/source/components/utilities/utprint.c index 832d04fd35c2..6d7b87cd3e8a 100644 --- a/source/components/utilities/utprint.c +++ b/source/components/utilities/utprint.c @@ -227,7 +227,7 @@ AcpiUtScanNumber ( UINT64 Number = 0; - while (isdigit (*String)) + while (isdigit ((int) *String)) { Number *= 10; Number += *(String++) - '0'; @@ -505,7 +505,7 @@ AcpiUtVsnprintf ( /* Process width */ Width = -1; - if (isdigit (*Format)) + if (isdigit ((int) *Format)) { Format = AcpiUtScanNumber (Format, &Number); Width = (INT32) Number; @@ -527,7 +527,7 @@ AcpiUtVsnprintf ( if (*Format == '.') { ++Format; - if (isdigit(*Format)) + if (isdigit ((int) *Format)) { Format = AcpiUtScanNumber (Format, &Number); Precision = (INT32) Number; diff --git a/source/components/utilities/utstring.c b/source/components/utilities/utstring.c index 737903d334df..33060f063fec 100644 --- a/source/components/utilities/utstring.c +++ b/source/components/utilities/utstring.c @@ -89,7 +89,7 @@ AcpiUtStrlwr ( for (String = SrcString; *String; String++) { - *String = (char) tolower (*String); + *String = (char) tolower ((int) *String); } return; @@ -168,7 +168,7 @@ AcpiUtStrupr ( for (String = SrcString; *String; String++) { - *String = (char) toupper (*String); + *String = (char) toupper ((int) *String); } return; @@ -234,7 +234,7 @@ AcpiUtStrtoul64 ( /* Skip over any white space in the buffer */ - while ((*String) && (isspace (*String) || *String == '\t')) + while ((*String) && (isspace ((int) *String) || *String == '\t')) { String++; } @@ -245,7 +245,7 @@ AcpiUtStrtoul64 ( * Base equal to ACPI_ANY_BASE means 'ToInteger operation case'. * We need to determine if it is decimal or hexadecimal. */ - if ((*String == '0') && (tolower (*(String + 1)) == 'x')) + if ((*String == '0') && (tolower ((int) *(String + 1)) == 'x')) { SignOf0x = 1; Base = 16; @@ -261,7 +261,7 @@ AcpiUtStrtoul64 ( /* Any string left? Check that '0x' is not followed by white space. */ - if (!(*String) || isspace (*String) || *String == '\t') + if (!(*String) || isspace ((int) *String) || *String == '\t') { if (ToIntegerOp) { @@ -283,7 +283,7 @@ AcpiUtStrtoul64 ( while (*String) { - if (isdigit (*String)) + if (isdigit ((int) *String)) { /* Convert ASCII 0-9 to Decimal value */ @@ -297,8 +297,8 @@ AcpiUtStrtoul64 ( } else { - ThisDigit = (UINT8) toupper (*String); - if (isxdigit ((char) ThisDigit)) + ThisDigit = (UINT8) toupper ((int) *String); + if (isxdigit ((int) ThisDigit)) { /* Convert ASCII Hex char to value */ @@ -469,7 +469,7 @@ AcpiUtPrintString ( /* Check for printable character or hex escape */ - if (isprint (String[i])) + if (isprint ((int) String[i])) { /* This is a normal character */ diff --git a/source/include/acutils.h b/source/include/acutils.h index 4f4a13efd7ff..5cd6ecf81a82 100644 --- a/source/include/acutils.h +++ b/source/include/acutils.h @@ -379,24 +379,6 @@ extern const UINT8 _acpi_ctype[]; #define isprint(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_XS | _ACPI_PU)) #define isalpha(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP)) -#ifndef ACPI_CLIBRARY -#define strstr(s1,s2) strstr ((s1), (s2)) -#define strchr(s1,c) strchr ((s1), (c)) -#define strlen(s) (ACPI_SIZE) strlen ((s)) -#define strcpy(d,s) (void) strcpy ((d), (s)) -#define strncpy(d,s,n) (void) strncpy ((d), (s), (ACPI_SIZE)(n)) -#define strncmp(d,s,n) strncmp ((d), (s), (ACPI_SIZE)(n)) -#define strcmp(d,s) strcmp ((d), (s)) -#define strcat(d,s) (void) strcat ((d), (s)) -#define strncat(d,s,n) strncat ((d), (s), (ACPI_SIZE)(n)) -#define strtoul(d,s,n) strtoul ((d), (s), (ACPI_SIZE)(n)) -#define memcmp(s1,s2,n) memcmp((void *)(s1), (void *)(s2), (ACPI_SIZE)(n)) -#define memcpy(d,s,n) (void) memcpy ((d), (s), (ACPI_SIZE)(n)) -#define memset(d,v,n) (void) memset ((d), (v), (ACPI_SIZE)(n)) -#define toupper(c) toupper ((int) (c)) -#define tolower(c) tolower ((int) (c)) -#endif /* ACPI_CLIBRARY */ - #endif /* !ACPI_USE_SYSTEM_CLIBRARY */ #define ACPI_IS_ASCII(c) ((c) < 0x80) diff --git a/source/include/platform/acenv.h b/source/include/platform/acenv.h index 768059c160d6..2a502adc4366 100644 --- a/source/include/platform/acenv.h +++ b/source/include/platform/acenv.h @@ -349,50 +349,6 @@ /* We will be linking to the standard Clib functions */ -#undef strstr -#undef strchr -#undef strlen -#undef strcpy -#undef strncpy -#undef strncmp -#undef strcmp -#undef strcat -#undef strncat -#undef strtoul -#undef memcmp -#undef memcpy -#undef memset -#undef toupper -#undef tolower -#undef isxdigit -#undef isdigit -#undef isspace -#undef isupper -#undef isprint -#undef isalpha - -#define strstr(s1,s2) strstr((s1), (s2)) -#define strchr(s1,c) strchr((s1), (c)) -#define strlen(s) (ACPI_SIZE) strlen((s)) -#define strcpy(d,s) (void) strcpy((d), (s)) -#define strncpy(d,s,n) (void) strncpy((d), (s), (ACPI_SIZE)(n)) -#define strncmp(d,s,n) strncmp((d), (s), (ACPI_SIZE)(n)) -#define strcmp(d,s) strcmp((d), (s)) -#define strcat(d,s) (void) strcat((d), (s)) -#define strncat(d,s,n) strncat((d), (s), (ACPI_SIZE)(n)) -#define strtoul(d,s,n) strtoul((d), (s), (ACPI_SIZE)(n)) -#define memcmp(s1,s2,n) memcmp((const char *)(s1), (const char *)(s2), (ACPI_SIZE)(n)) -#define memcpy(d,s,n) (void) memcpy((d), (s), (ACPI_SIZE)(n)) -#define memset(d,s,n) (void) memset((d), (s), (ACPI_SIZE)(n)) -#define toupper(i) toupper((int) (i)) -#define tolower(i) tolower((int) (i)) -#define isxdigit(i) isxdigit((int) (i)) -#define isdigit(i) isdigit((int) (i)) -#define isspace(i) isspace((int) (i)) -#define isupper(i) isupper((int) (i)) -#define isprint(i) isprint((int) (i)) -#define isalpha(i) isalpha((int) (i)) - #else /****************************************************************************** diff --git a/source/tools/acpidump/apfiles.c b/source/tools/acpidump/apfiles.c index 9c187271371b..1b05984da567 100644 --- a/source/tools/acpidump/apfiles.c +++ b/source/tools/acpidump/apfiles.c @@ -159,10 +159,10 @@ ApWriteToBinaryFile ( { ACPI_MOVE_NAME (Filename, Table->Signature); } - Filename[0] = (char) tolower (Filename[0]); - Filename[1] = (char) tolower (Filename[1]); - Filename[2] = (char) tolower (Filename[2]); - Filename[3] = (char) tolower (Filename[3]); + Filename[0] = (char) tolower ((int) Filename[0]); + Filename[1] = (char) tolower ((int) Filename[1]); + Filename[2] = (char) tolower ((int) Filename[2]); + Filename[3] = (char) tolower ((int) Filename[3]); Filename[ACPI_NAME_SIZE] = 0; /* Handle multiple SSDTs - create different filenames for each */ diff --git a/source/tools/acpisrc/asutils.c b/source/tools/acpisrc/asutils.c index 03a45b910079..31103a09fbda 100644 --- a/source/tools/acpisrc/asutils.c +++ b/source/tools/acpisrc/asutils.c @@ -72,7 +72,7 @@ AsStrlwr ( { for (String = SrcString; *String; String++) { - *String = (char) tolower (*String); + *String = (char) tolower ((int) *String); } } }