kill sprintf
This commit is contained in:
parent
15eceb53d1
commit
52afc2f519
@ -341,7 +341,7 @@ AnCheckMethodReturnValue (
|
||||
*/
|
||||
if (ThisNodeBtype != 0)
|
||||
{
|
||||
sprintf (MsgBuffer,
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer),
|
||||
"Method returns [%s], %s operator requires [%s]",
|
||||
StringBuffer, OpInfo->Name, StringBuffer2);
|
||||
|
||||
|
@ -633,7 +633,7 @@ NamePathTail [.]{NameSeg}
|
||||
AslCompilererror ("Parse error, expecting ASL keyword or name");}
|
||||
|
||||
. { count (1);
|
||||
sprintf (MsgBuffer,
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer),
|
||||
"Invalid character (0x%2.2X), expecting ASL keyword or name",
|
||||
*AslCompilertext);
|
||||
AslCompilererror (MsgBuffer);}
|
||||
|
@ -862,7 +862,7 @@ AslCoreSubsystemError (
|
||||
BOOLEAN Abort)
|
||||
{
|
||||
|
||||
sprintf (MsgBuffer, "%s %s", AcpiFormatException (Status), ExtraMessage);
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "%s %s", AcpiFormatException (Status), ExtraMessage);
|
||||
|
||||
if (Op)
|
||||
{
|
||||
|
@ -97,7 +97,7 @@ FlFileError (
|
||||
UINT8 ErrorId)
|
||||
{
|
||||
|
||||
sprintf (MsgBuffer, "\"%s\" (%s)", Gbl_Files[FileId].Filename,
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "\"%s\" (%s)", Gbl_Files[FileId].Filename,
|
||||
strerror (errno));
|
||||
AslCommonError (ASL_ERROR, ErrorId, 0, 0, 0, 0, NULL, MsgBuffer);
|
||||
}
|
||||
|
@ -416,7 +416,7 @@ FlOpenIncludeFile (
|
||||
/* We could not open the include file after trying very hard */
|
||||
|
||||
ErrorExit:
|
||||
sprintf (MsgBuffer, "%s, %s", Op->Asl.Value.String, strerror (errno));
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "%s, %s", Op->Asl.Value.String, strerror (errno));
|
||||
AslError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, Op, MsgBuffer);
|
||||
}
|
||||
|
||||
|
@ -536,7 +536,7 @@ LdNamespace1Begin (
|
||||
* Which is used to workaround the fact that the MS interpreter
|
||||
* does not allow Scope() forward references.
|
||||
*/
|
||||
sprintf (MsgBuffer, "%s [%s], changing type to [Scope]",
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "%s [%s], changing type to [Scope]",
|
||||
Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type));
|
||||
AslError (ASL_REMARK, ASL_MSG_SCOPE_TYPE, Op, MsgBuffer);
|
||||
|
||||
@ -555,7 +555,7 @@ LdNamespace1Begin (
|
||||
|
||||
/* All other types are an error */
|
||||
|
||||
sprintf (MsgBuffer, "%s [%s]", Op->Asl.ExternalName,
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "%s [%s]", Op->Asl.ExternalName,
|
||||
AcpiUtGetTypeName (Node->Type));
|
||||
AslError (ASL_ERROR, ASL_MSG_SCOPE_TYPE, Op, MsgBuffer);
|
||||
|
||||
|
@ -163,7 +163,7 @@ LkIsObjectUsed (
|
||||
* Issue a remark even if it is a reserved name (starts
|
||||
* with an underscore).
|
||||
*/
|
||||
sprintf (MsgBuffer, "Name is within method [%4.4s]",
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "Name is within method [%4.4s]",
|
||||
Next->Name.Ascii);
|
||||
AslError (ASL_REMARK, ASL_MSG_NOT_REFERENCED,
|
||||
LkGetNameOp (Node->Op), MsgBuffer);
|
||||
|
@ -114,7 +114,7 @@ ApCheckForPredefinedMethod (
|
||||
|
||||
if (MethodInfo->NumArguments != 0)
|
||||
{
|
||||
sprintf (MsgBuffer, "%s requires %u", Op->Asl.ExternalName, 0);
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "%s requires %u", Op->Asl.ExternalName, 0);
|
||||
|
||||
AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op,
|
||||
MsgBuffer);
|
||||
@ -136,7 +136,7 @@ ApCheckForPredefinedMethod (
|
||||
|
||||
if (MethodInfo->NumArguments != RequiredArgCount)
|
||||
{
|
||||
sprintf (MsgBuffer, "%4.4s requires %u",
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "%4.4s requires %u",
|
||||
ThisName->Info.Name, RequiredArgCount);
|
||||
|
||||
if (MethodInfo->NumArguments < RequiredArgCount)
|
||||
@ -162,7 +162,7 @@ ApCheckForPredefinedMethod (
|
||||
AcpiUtGetExpectedReturnTypes (StringBuffer,
|
||||
ThisName->Info.ExpectedBtypes);
|
||||
|
||||
sprintf (MsgBuffer, "%s required for %4.4s",
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "%s required for %4.4s",
|
||||
StringBuffer, ThisName->Info.Name);
|
||||
|
||||
AslError (ASL_WARNING, ASL_MSG_RESERVED_RETURN_VALUE, Op,
|
||||
@ -693,12 +693,12 @@ TypeErrorExit:
|
||||
|
||||
if (PackageIndex == ACPI_NOT_PACKAGE_ELEMENT)
|
||||
{
|
||||
sprintf (MsgBuffer, "%4.4s: found %s, %s required",
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "%4.4s: found %s, %s required",
|
||||
PredefinedName, TypeName, StringBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf (MsgBuffer, "%4.4s: found %s at index %u, %s required",
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "%4.4s: found %s at index %u, %s required",
|
||||
PredefinedName, TypeName, PackageIndex, StringBuffer);
|
||||
}
|
||||
|
||||
|
@ -617,7 +617,7 @@ ApPackageTooSmall (
|
||||
UINT32 ExpectedCount)
|
||||
{
|
||||
|
||||
sprintf (MsgBuffer, "%s: length %u, required minimum is %u",
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "%s: length %u, required minimum is %u",
|
||||
PredefinedName, Count, ExpectedCount);
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESERVED_PACKAGE_LENGTH, Op, MsgBuffer);
|
||||
@ -646,7 +646,7 @@ ApZeroLengthPackage (
|
||||
ACPI_PARSE_OBJECT *Op)
|
||||
{
|
||||
|
||||
sprintf (MsgBuffer, "%s: length is zero", PredefinedName);
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "%s: length is zero", PredefinedName);
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESERVED_PACKAGE_LENGTH, Op, MsgBuffer);
|
||||
}
|
||||
@ -675,7 +675,7 @@ ApPackageTooLarge (
|
||||
UINT32 ExpectedCount)
|
||||
{
|
||||
|
||||
sprintf (MsgBuffer, "%s: length is %u, only %u required",
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "%s: length is %u, only %u required",
|
||||
PredefinedName, Count, ExpectedCount);
|
||||
|
||||
AslError (ASL_REMARK, ASL_MSG_RESERVED_PACKAGE_LENGTH, Op, MsgBuffer);
|
||||
|
@ -349,7 +349,7 @@ AslInsertLineBuffer (
|
||||
* Warning if we have split a long source line.
|
||||
* <Probably overkill>
|
||||
*/
|
||||
sprintf (MsgBuffer, "Max %u", Gbl_LineBufferSize);
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "Max %u", Gbl_LineBufferSize);
|
||||
AslCommonError (ASL_WARNING, ASL_MSG_LONG_LINE,
|
||||
Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
|
||||
Gbl_CurrentLineOffset, Gbl_CurrentColumn,
|
||||
|
@ -572,7 +572,7 @@ UtCheckIntegerRange (
|
||||
if ((Op->Asl.Value.Integer < LowValue) ||
|
||||
(Op->Asl.Value.Integer > HighValue))
|
||||
{
|
||||
sprintf (MsgBuffer, "0x%X, allowable: 0x%X-0x%X",
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "0x%X, allowable: 0x%X-0x%X",
|
||||
(UINT32) Op->Asl.Value.Integer, LowValue, HighValue);
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RANGE, Op, MsgBuffer);
|
||||
@ -909,7 +909,7 @@ UtDoConstant (
|
||||
Status = UtStrtoul64 (String, 0, &Converted);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
sprintf (ErrBuf, "%s %s\n", "Conversion error:",
|
||||
snprintf (ErrBuf, sizeof(ErrBuf), "%s %s\n", "Conversion error:",
|
||||
AcpiFormatException (Status));
|
||||
AslCompilererror (ErrBuf);
|
||||
}
|
||||
|
@ -427,7 +427,7 @@ AnOperandTypecheckWalkEnd (
|
||||
AnFormatBtype (StringBuffer, ThisNodeBtype);
|
||||
AnFormatBtype (StringBuffer2, RequiredBtypes);
|
||||
|
||||
sprintf (MsgBuffer, "[%s] found, %s operator requires [%s]",
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "[%s] found, %s operator requires [%s]",
|
||||
StringBuffer, OpInfo->Name, StringBuffer2);
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, MsgBuffer);
|
||||
|
@ -580,7 +580,7 @@ XfNamespaceLocateBegin (
|
||||
|
||||
if (Message)
|
||||
{
|
||||
sprintf (MsgBuffer, "Size mismatch, Tag: %u bit%s, Field: %u bit%s",
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "Size mismatch, Tag: %u bit%s, Field: %u bit%s",
|
||||
TagBitLength, (TagBitLength > 1) ? "s" : "",
|
||||
FieldBitLength, (FieldBitLength > 1) ? "s" : "");
|
||||
|
||||
@ -646,7 +646,7 @@ XfNamespaceLocateBegin (
|
||||
*/
|
||||
if (Node->Type != ACPI_TYPE_METHOD)
|
||||
{
|
||||
sprintf (MsgBuffer, "%s is a %s",
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "%s is a %s",
|
||||
Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type));
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_NOT_METHOD, Op, MsgBuffer);
|
||||
@ -686,7 +686,7 @@ XfNamespaceLocateBegin (
|
||||
*/
|
||||
if (PassedArgs != Node->Value)
|
||||
{
|
||||
sprintf (MsgBuffer, "%s requires %u", Op->Asl.ExternalName,
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "%s requires %u", Op->Asl.ExternalName,
|
||||
Node->Value);
|
||||
|
||||
if (PassedArgs < Node->Value)
|
||||
|
@ -211,7 +211,8 @@ DtInitialize (
|
||||
Gbl_RootTable = NULL;
|
||||
Gbl_SubtableStack = NULL;
|
||||
|
||||
sprintf (VersionString, "%X", (UINT32) ACPI_CA_VERSION);
|
||||
snprintf (VersionString, sizeof(VersionBuffer), "%X",
|
||||
(UINT32) ACPI_CA_VERSION);
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
@ -292,7 +293,7 @@ DtCompileDataTable (
|
||||
Signature = DtGetFieldValue (*FieldList);
|
||||
if (!Signature)
|
||||
{
|
||||
sprintf (MsgBuffer, "Expected \"%s\"", "Signature");
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "Expected \"%s\"", "Signature");
|
||||
DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
|
||||
*FieldList, MsgBuffer);
|
||||
return (AE_ERROR);
|
||||
@ -485,7 +486,7 @@ DtCompileTable (
|
||||
|
||||
if (!LocalField)
|
||||
{
|
||||
sprintf (MsgBuffer, "Found NULL field - Field name \"%s\" needed",
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "Found NULL field - Field name \"%s\" needed",
|
||||
Info->Name);
|
||||
DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer);
|
||||
Status = AE_BAD_DATA;
|
||||
|
@ -174,7 +174,7 @@ DtCompileString (
|
||||
|
||||
if (Length > ByteLength)
|
||||
{
|
||||
sprintf (MsgBuffer, "Maximum %u characters", ByteLength);
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "Maximum %u characters", ByteLength);
|
||||
DtError (ASL_ERROR, ASL_MSG_STRING_LENGTH, Field, MsgBuffer);
|
||||
Length = ByteLength;
|
||||
}
|
||||
@ -254,7 +254,7 @@ DtCompileUuid (
|
||||
Status = AuValidateUuid (InString);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
sprintf (MsgBuffer, "%s", Field->Value);
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "%s", Field->Value);
|
||||
DtNameError (ASL_ERROR, ASL_MSG_INVALID_UUID, Field, MsgBuffer);
|
||||
}
|
||||
else
|
||||
@ -340,7 +340,7 @@ DtCompileInteger (
|
||||
|
||||
if (Value > MaxValue)
|
||||
{
|
||||
sprintf (MsgBuffer, "%8.8X%8.8X - max %u bytes",
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "%8.8X%8.8X - max %u bytes",
|
||||
ACPI_FORMAT_UINT64 (Value), ByteLength);
|
||||
DtError (ASL_ERROR, ASL_MSG_INTEGER_SIZE, Field, MsgBuffer);
|
||||
}
|
||||
@ -563,7 +563,7 @@ DtCompileFlag (
|
||||
|
||||
if (Value >= ((UINT64) 1 << BitLength))
|
||||
{
|
||||
sprintf (MsgBuffer, "Maximum %u bit", BitLength);
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "Maximum %u bit", BitLength);
|
||||
DtError (ASL_ERROR, ASL_MSG_FLAG_VALUE, Field, MsgBuffer);
|
||||
Value = 0;
|
||||
}
|
||||
|
@ -343,7 +343,7 @@ DtGetSubtableLength (
|
||||
Error:
|
||||
if (!Field)
|
||||
{
|
||||
sprintf (MsgBuffer, "Found NULL field - Field name \"%s\" needed",
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "Found NULL field - Field name \"%s\" needed",
|
||||
Info->Name);
|
||||
DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer);
|
||||
}
|
||||
|
@ -2437,7 +2437,7 @@ DtCompileGeneric (
|
||||
Info = DtGetGenericTableInfo ((*PFieldList)->Name);
|
||||
if (!Info)
|
||||
{
|
||||
sprintf (MsgBuffer, "Generic data type \"%s\" not found",
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "Generic data type \"%s\" not found",
|
||||
(*PFieldList)->Name);
|
||||
DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
|
||||
(*PFieldList), MsgBuffer);
|
||||
@ -2458,7 +2458,7 @@ DtCompileGeneric (
|
||||
|
||||
if (Status == AE_NOT_FOUND)
|
||||
{
|
||||
sprintf (MsgBuffer, "Generic data type \"%s\" not found",
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "Generic data type \"%s\" not found",
|
||||
(*PFieldList)->Name);
|
||||
DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
|
||||
(*PFieldList), MsgBuffer);
|
||||
|
@ -600,7 +600,7 @@ DtGetFieldLength (
|
||||
else
|
||||
{ /* At this point, this is a fatal error */
|
||||
|
||||
sprintf (MsgBuffer, "Expected \"%s\"", Info->Name);
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "Expected \"%s\"", Info->Name);
|
||||
DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer);
|
||||
return (0);
|
||||
}
|
||||
@ -626,7 +626,7 @@ DtGetFieldLength (
|
||||
else
|
||||
{ /* At this point, this is a fatal error */
|
||||
|
||||
sprintf (MsgBuffer, "Expected \"%s\"", Info->Name);
|
||||
snprintf (MsgBuffer, sizeof(MsgBuffer), "Expected \"%s\"", Info->Name);
|
||||
DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer);
|
||||
return (0);
|
||||
}
|
||||
|
@ -298,7 +298,8 @@ PrOpenIncludeFile (
|
||||
/* We could not open the include file after trying very hard */
|
||||
|
||||
ErrorExit:
|
||||
sprintf (Gbl_MainTokenBuffer, "%s, %s", Filename, strerror (errno));
|
||||
snprintf (Gbl_MainTokenBuffer, ASL_LINE_BUFFER_SIZE, "%s, %s",
|
||||
Filename, strerror (errno));
|
||||
PrError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, 0);
|
||||
}
|
||||
|
||||
|
@ -1420,11 +1420,13 @@ OslGetCustomizedTable (
|
||||
|
||||
if (Instance != 0)
|
||||
{
|
||||
sprintf (TableFilename, "%s/%4.4s%d", Pathname, TempName, Instance);
|
||||
snprintf (TableFilename, sizeof(TableFilename), "%s/%4.4s%d",
|
||||
Pathname, TempName, Instance);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf (TableFilename, "%s/%4.4s", Pathname, TempName);
|
||||
snprintf (TableFilename, sizeof(TableFilename), "%s/%4.4s",
|
||||
Pathname, TempName);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ ApWriteToBinaryFile (
|
||||
|
||||
if (Instance > 0)
|
||||
{
|
||||
sprintf (InstanceStr, "%u", Instance);
|
||||
snprintf (InstanceStr, sizeof(InstanceStr), "%u", Instance);
|
||||
strcat (Filename, InstanceStr);
|
||||
}
|
||||
|
||||
|
@ -587,11 +587,11 @@ AxExtractTables (
|
||||
|
||||
if (ThisInstance > 0)
|
||||
{
|
||||
sprintf (Filename, "%4.4s%u.dat", ThisSignature, ThisInstance);
|
||||
snprintf (Filename, sizeof(Filename), "%4.4s%u.dat", ThisSignature, ThisInstance);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf (Filename, "%4.4s.dat", ThisSignature);
|
||||
snprintf (Filename, sizeof(Filename), "%4.4s.dat", ThisSignature);
|
||||
}
|
||||
|
||||
AxStrlwr (Filename);
|
||||
|
Loading…
Reference in New Issue
Block a user