diff --git a/source/common/adwalk.c b/source/common/adwalk.c index c7dfdd582..7fdb063e7 100644 --- a/source/common/adwalk.c +++ b/source/common/adwalk.c @@ -726,8 +726,8 @@ AcpiDmLoadDescendingOp ( while (AcpiGbl_PreDefinedNames[PreDefineIndex].Name) { - if (!ACPI_STRNCMP (Node->Name.Ascii, - AcpiGbl_PreDefinedNames[PreDefineIndex].Name, 4)) + if (ACPI_COMPARE_NAME (Node->Name.Ascii, + AcpiGbl_PreDefinedNames[PreDefineIndex].Name)) { PreDefined = TRUE; break; diff --git a/source/compiler/aslcodegen.c b/source/compiler/aslcodegen.c index e20b57422..99a596070 100644 --- a/source/compiler/aslcodegen.c +++ b/source/compiler/aslcodegen.c @@ -517,7 +517,7 @@ CgWriteTableHeader ( /* Compiler ID */ - strncpy (TableHeader.AslCompilerId, ASL_CREATOR_ID, 4); + ACPI_MOVE_NAME (TableHeader.AslCompilerId, ASL_CREATOR_ID); /* Compiler version */ diff --git a/source/compiler/aslopt.c b/source/compiler/aslopt.c index 007fac934..e44653e9d 100644 --- a/source/compiler/aslopt.c +++ b/source/compiler/aslopt.c @@ -326,12 +326,11 @@ OptBuildShortestPath ( { /* Compare two single NameSegs */ - if (ACPI_STRNCMP ( - &((char *) TargetPath->Pointer)[(NumCommonSegments * - ACPI_PATH_SEGMENT_LENGTH) + 1], - &((char *) CurrentPath->Pointer)[(NumCommonSegments * - ACPI_PATH_SEGMENT_LENGTH) + 1], - ACPI_NAME_SIZE)) + if (!ACPI_COMPARE_NAME ( + &((char *) TargetPath->Pointer)[ + (NumCommonSegments * ACPI_PATH_SEGMENT_LENGTH) + 1], + &((char *) CurrentPath->Pointer)[ + (NumCommonSegments * ACPI_PATH_SEGMENT_LENGTH) + 1])) { /* Mismatch */ diff --git a/source/compiler/aslutils.c b/source/compiler/aslutils.c index 5937cf07c..5a6f8fbbf 100644 --- a/source/compiler/aslutils.c +++ b/source/compiler/aslutils.c @@ -908,7 +908,7 @@ UtAttachNameseg ( UtPadNameWithUnderscores (Name, PaddedNameSeg); } - strncpy (Op->Asl.NameSeg, PaddedNameSeg, 4); + ACPI_MOVE_NAME (Op->Asl.NameSeg, PaddedNameSeg); } diff --git a/source/components/debugger/dbfileio.c b/source/components/debugger/dbfileio.c index 428c7a8e9..697ffe342 100644 --- a/source/components/debugger/dbfileio.c +++ b/source/components/debugger/dbfileio.c @@ -400,9 +400,9 @@ AcpiDbReadTable ( #ifdef ACPI_OBSOLETE_CODE /* We only support a limited number of table types */ - if (ACPI_STRNCMP ((char *) TableHeader.Signature, DSDT_SIG, 4) && - ACPI_STRNCMP ((char *) TableHeader.Signature, PSDT_SIG, 4) && - ACPI_STRNCMP ((char *) TableHeader.Signature, SSDT_SIG, 4)) + if (!ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_DSDT) && + !ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_PSDT) && + !ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_SSDT)) { AcpiOsPrintf ("Table signature [%4.4s] is invalid or not supported\n", (char *) TableHeader.Signature); diff --git a/source/components/namespace/nsxfname.c b/source/components/namespace/nsxfname.c index b1ee775b6..1967e5c3a 100644 --- a/source/components/namespace/nsxfname.c +++ b/source/components/namespace/nsxfname.c @@ -299,8 +299,7 @@ AcpiGetName ( /* Just copy the ACPI name from the Node and zero terminate it */ - ACPI_STRNCPY (Buffer->Pointer, AcpiUtGetNodeName (Node), - ACPI_NAME_SIZE); + ACPI_MOVE_NAME (Buffer->Pointer, AcpiUtGetNodeName (Node)); ((char *) Buffer->Pointer) [ACPI_NAME_SIZE] = 0; Status = AE_OK; diff --git a/source/components/tables/tbfind.c b/source/components/tables/tbfind.c index 97414a1ec..1dc90b31d 100644 --- a/source/components/tables/tbfind.c +++ b/source/components/tables/tbfind.c @@ -158,7 +158,7 @@ AcpiTbFindTable ( /* Normalize the input strings */ ACPI_MEMSET (&Header, 0, sizeof (ACPI_TABLE_HEADER)); - ACPI_STRNCPY (Header.Signature, Signature, ACPI_NAME_SIZE); + ACPI_MOVE_NAME (Header.Signature, Signature); ACPI_STRNCPY (Header.OemId, OemId, ACPI_OEM_ID_SIZE); ACPI_STRNCPY (Header.OemTableId, OemTableId, ACPI_OEM_TABLE_ID_SIZE); diff --git a/source/os_specific/service_layers/oswinxf.c b/source/os_specific/service_layers/oswinxf.c index cc7636e94..4d7e45801 100644 --- a/source/os_specific/service_layers/oswinxf.c +++ b/source/os_specific/service_layers/oswinxf.c @@ -340,8 +340,8 @@ AcpiOsTableOverride ( /* Construct a null-terminated string from table signature */ + ACPI_MOVE_NAME (TableName, ExistingTable->Signature); TableName[ACPI_NAME_SIZE] = 0; - ACPI_STRNCPY (TableName, ExistingTable->Signature, ACPI_NAME_SIZE); *NewTable = OsGetTable (TableName); if (*NewTable) diff --git a/source/tools/acpibin/abcompare.c b/source/tools/acpibin/abcompare.c index eade4ad71..cdbe71339 100644 --- a/source/tools/acpibin/abcompare.c +++ b/source/tools/acpibin/abcompare.c @@ -743,7 +743,7 @@ AbExtractAmlFile ( { /* The 4-char ACPI signature appears at the beginning of a line */ - if (!strncmp (Buffer, TableSig, 4)) + if (ACPI_COMPARE_NAME (Buffer, TableSig)) { printf ("Found table [%4.4s]\n", TableSig); diff --git a/source/tools/acpiexec/aetables.c b/source/tools/acpiexec/aetables.c index 4696448dd..d68fa29fa 100644 --- a/source/tools/acpiexec/aetables.c +++ b/source/tools/acpiexec/aetables.c @@ -245,7 +245,7 @@ AeBuildLocalTables ( } ACPI_MEMSET (LocalXSDT, 0, XsdtSize); - ACPI_STRNCPY (LocalXSDT->Header.Signature, ACPI_SIG_XSDT, 4); + ACPI_MOVE_NAME (LocalXSDT->Header.Signature, ACPI_SIG_XSDT); LocalXSDT->Header.Length = XsdtSize; LocalXSDT->Header.Revision = 1; @@ -379,7 +379,7 @@ AeBuildLocalTables ( * Build a local FADT so we can test the hardware/event init */ ACPI_MEMSET (&LocalFADT, 0, sizeof (ACPI_TABLE_FADT)); - ACPI_STRNCPY (LocalFADT.Header.Signature, ACPI_SIG_FADT, 4); + ACPI_MOVE_NAME (LocalFADT.Header.Signature, ACPI_SIG_FADT); /* Setup FADT header and DSDT/FACS addresses */ @@ -430,7 +430,7 @@ AeBuildLocalTables ( /* Build a FACS */ ACPI_MEMSET (&LocalFACS, 0, sizeof (ACPI_TABLE_FACS)); - ACPI_STRNCPY (LocalFACS.Signature, ACPI_SIG_FACS, 4); + ACPI_MOVE_NAME (LocalFACS.Signature, ACPI_SIG_FACS); LocalFACS.Length = sizeof (ACPI_TABLE_FACS); LocalFACS.GlobalLock = 0x11AA0011; @@ -440,7 +440,7 @@ AeBuildLocalTables ( * ACPICA core ignores it */ ACPI_MEMSET (&LocalTEST, 0, sizeof (ACPI_TABLE_HEADER)); - ACPI_STRNCPY (LocalTEST.Signature, "TEST", 4); + ACPI_MOVE_NAME (LocalTEST.Signature, "TEST"); LocalTEST.Revision = 1; LocalTEST.Length = sizeof (ACPI_TABLE_HEADER); @@ -452,7 +452,7 @@ AeBuildLocalTables ( * sure that the ACPICA core ignores it */ ACPI_MEMSET (&LocalBADTABLE, 0, sizeof (ACPI_TABLE_HEADER)); - ACPI_STRNCPY (LocalBADTABLE.Signature, "BAD!", 4); + ACPI_MOVE_NAME (LocalBADTABLE.Signature, "BAD!"); LocalBADTABLE.Revision = 1; LocalBADTABLE.Length = sizeof (ACPI_TABLE_HEADER); diff --git a/source/tools/acpinames/antables.c b/source/tools/acpinames/antables.c index c721289a3..ec6460a1f 100644 --- a/source/tools/acpinames/antables.c +++ b/source/tools/acpinames/antables.c @@ -201,7 +201,7 @@ AeBuildLocalTables ( } ACPI_MEMSET (LocalXSDT, 0, XsdtSize); - ACPI_STRNCPY (LocalXSDT->Header.Signature, ACPI_SIG_XSDT, 4); + ACPI_MOVE_NAME (LocalXSDT->Header.Signature, ACPI_SIG_XSDT); LocalXSDT->Header.Length = XsdtSize; LocalXSDT->Header.Revision = 1; @@ -294,7 +294,7 @@ AeBuildLocalTables ( * Build a local FADT so we can test the hardware/event init */ ACPI_MEMSET (&LocalFADT, 0, sizeof (ACPI_TABLE_FADT)); - ACPI_STRNCPY (LocalFADT.Header.Signature, ACPI_SIG_FADT, 4); + ACPI_MOVE_NAME (LocalFADT.Header.Signature, ACPI_SIG_FADT); /* Setup FADT header and DSDT/FACS addresses */ @@ -345,7 +345,7 @@ AeBuildLocalTables ( /* Build a FACS */ ACPI_MEMSET (&LocalFACS, 0, sizeof (ACPI_TABLE_FACS)); - ACPI_STRNCPY (LocalFACS.Signature, ACPI_SIG_FACS, 4); + ACPI_MOVE_NAME (LocalFACS.Signature, ACPI_SIG_FACS); LocalFACS.Length = sizeof (ACPI_TABLE_FACS); LocalFACS.GlobalLock = 0x11AA0011; diff --git a/source/tools/acpixtract/acpixtract.c b/source/tools/acpixtract/acpixtract.c index 05dad0652..3d51cfe0d 100644 --- a/source/tools/acpixtract/acpixtract.c +++ b/source/tools/acpixtract/acpixtract.c @@ -424,7 +424,7 @@ AxCountTableInstances ( } AxNormalizeSignature (InstanceBuffer); - if (!strncmp (InstanceBuffer, Signature, 4)) + if (ACPI_COMPARE_NAME (InstanceBuffer, Signature)) { Instances++; } @@ -599,13 +599,13 @@ AxExtractTables ( } AxNormalizeSignature (LineBuffer); - strncpy (ThisSignature, LineBuffer, 4); + ACPI_MOVE_NAME (ThisSignature, LineBuffer); if (Signature) { /* Ignore signatures that don't match */ - if (strncmp (ThisSignature, Signature, 4)) + if (!ACPI_COMPARE_NAME (ThisSignature, Signature)) { continue; } @@ -788,7 +788,7 @@ AxListTables ( /* FACS has only signature and length */ - if (!strncmp (TableHeader->Signature, "FACS", 4)) + if (ACPI_COMPARE_NAME (TableHeader->Signature, "FACS")) { printf ("\n"); continue;