Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/acpica/dist kill sprintf



details:   https://anonhg.NetBSD.org/src/rev/ddad71214087
branches:  trunk
changeset: 794715:ddad71214087
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Mar 22 21:42:44 2014 +0000

description:
kill sprintf

diffstat:

 sys/external/bsd/acpica/dist/compiler/aslanalyze.c                   |   2 +-
 sys/external/bsd/acpica/dist/compiler/aslcompiler.l                  |   2 +-
 sys/external/bsd/acpica/dist/compiler/aslerror.c                     |   2 +-
 sys/external/bsd/acpica/dist/compiler/aslfileio.c                    |   2 +-
 sys/external/bsd/acpica/dist/compiler/aslfiles.c                     |   2 +-
 sys/external/bsd/acpica/dist/compiler/aslload.c                      |   4 ++--
 sys/external/bsd/acpica/dist/compiler/asllookup.c                    |   2 +-
 sys/external/bsd/acpica/dist/compiler/aslpredef.c                    |  10 +++++-----
 sys/external/bsd/acpica/dist/compiler/aslprepkg.c                    |   6 +++---
 sys/external/bsd/acpica/dist/compiler/aslsupport.l                   |   2 +-
 sys/external/bsd/acpica/dist/compiler/aslutils.c                     |   4 ++--
 sys/external/bsd/acpica/dist/compiler/aslwalks.c                     |   2 +-
 sys/external/bsd/acpica/dist/compiler/aslxref.c                      |   6 +++---
 sys/external/bsd/acpica/dist/compiler/dtcompile.c                    |   7 ++++---
 sys/external/bsd/acpica/dist/compiler/dtfield.c                      |   8 ++++----
 sys/external/bsd/acpica/dist/compiler/dtsubtable.c                   |   2 +-
 sys/external/bsd/acpica/dist/compiler/dttable.c                      |   4 ++--
 sys/external/bsd/acpica/dist/compiler/dtutils.c                      |   4 ++--
 sys/external/bsd/acpica/dist/compiler/prutils.c                      |   3 ++-
 sys/external/bsd/acpica/dist/os_specific/service_layers/oslinuxtbl.c |   6 ++++--
 sys/external/bsd/acpica/dist/tools/acpidump/apfiles.c                |   2 +-
 sys/external/bsd/acpica/dist/tools/acpixtract/acpixtract.c           |   4 ++--
 22 files changed, 45 insertions(+), 41 deletions(-)

diffs (truncated from 428 to 300 lines):

diff -r ead33a9520a0 -r ddad71214087 sys/external/bsd/acpica/dist/compiler/aslanalyze.c
--- a/sys/external/bsd/acpica/dist/compiler/aslanalyze.c        Sat Mar 22 20:56:04 2014 +0000
+++ b/sys/external/bsd/acpica/dist/compiler/aslanalyze.c        Sat Mar 22 21:42:44 2014 +0000
@@ -341,7 +341,7 @@
          */
         if (ThisNodeBtype != 0)
         {
-            sprintf (MsgBuffer,
+            snprintf (MsgBuffer, sizeof(MsgBuffer),
                 "Method returns [%s], %s operator requires [%s]",
                 StringBuffer, OpInfo->Name, StringBuffer2);
 
diff -r ead33a9520a0 -r ddad71214087 sys/external/bsd/acpica/dist/compiler/aslcompiler.l
--- a/sys/external/bsd/acpica/dist/compiler/aslcompiler.l       Sat Mar 22 20:56:04 2014 +0000
+++ b/sys/external/bsd/acpica/dist/compiler/aslcompiler.l       Sat Mar 22 21:42:44 2014 +0000
@@ -633,7 +633,7 @@
                                 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);}
diff -r ead33a9520a0 -r ddad71214087 sys/external/bsd/acpica/dist/compiler/aslerror.c
--- a/sys/external/bsd/acpica/dist/compiler/aslerror.c  Sat Mar 22 20:56:04 2014 +0000
+++ b/sys/external/bsd/acpica/dist/compiler/aslerror.c  Sat Mar 22 21:42:44 2014 +0000
@@ -862,7 +862,7 @@
     BOOLEAN                 Abort)
 {
 
-    sprintf (MsgBuffer, "%s %s", AcpiFormatException (Status), ExtraMessage);
+    snprintf (MsgBuffer, sizeof(MsgBuffer), "%s %s", AcpiFormatException (Status), ExtraMessage);
 
     if (Op)
     {
diff -r ead33a9520a0 -r ddad71214087 sys/external/bsd/acpica/dist/compiler/aslfileio.c
--- a/sys/external/bsd/acpica/dist/compiler/aslfileio.c Sat Mar 22 20:56:04 2014 +0000
+++ b/sys/external/bsd/acpica/dist/compiler/aslfileio.c Sat Mar 22 21:42:44 2014 +0000
@@ -97,7 +97,7 @@
     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);
 }
diff -r ead33a9520a0 -r ddad71214087 sys/external/bsd/acpica/dist/compiler/aslfiles.c
--- a/sys/external/bsd/acpica/dist/compiler/aslfiles.c  Sat Mar 22 20:56:04 2014 +0000
+++ b/sys/external/bsd/acpica/dist/compiler/aslfiles.c  Sat Mar 22 21:42:44 2014 +0000
@@ -416,7 +416,7 @@
     /* 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);
 }
 
diff -r ead33a9520a0 -r ddad71214087 sys/external/bsd/acpica/dist/compiler/aslload.c
--- a/sys/external/bsd/acpica/dist/compiler/aslload.c   Sat Mar 22 20:56:04 2014 +0000
+++ b/sys/external/bsd/acpica/dist/compiler/aslload.c   Sat Mar 22 21:42:44 2014 +0000
@@ -536,7 +536,7 @@
              * 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 @@
 
             /* 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);
 
diff -r ead33a9520a0 -r ddad71214087 sys/external/bsd/acpica/dist/compiler/asllookup.c
--- a/sys/external/bsd/acpica/dist/compiler/asllookup.c Sat Mar 22 20:56:04 2014 +0000
+++ b/sys/external/bsd/acpica/dist/compiler/asllookup.c Sat Mar 22 21:42:44 2014 +0000
@@ -163,7 +163,7 @@
              * 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);
diff -r ead33a9520a0 -r ddad71214087 sys/external/bsd/acpica/dist/compiler/aslpredef.c
--- a/sys/external/bsd/acpica/dist/compiler/aslpredef.c Sat Mar 22 20:56:04 2014 +0000
+++ b/sys/external/bsd/acpica/dist/compiler/aslpredef.c Sat Mar 22 21:42:44 2014 +0000
@@ -114,7 +114,7 @@
 
         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 @@
 
         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 @@
             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 @@
 
     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);
     }
 
diff -r ead33a9520a0 -r ddad71214087 sys/external/bsd/acpica/dist/compiler/aslprepkg.c
--- a/sys/external/bsd/acpica/dist/compiler/aslprepkg.c Sat Mar 22 20:56:04 2014 +0000
+++ b/sys/external/bsd/acpica/dist/compiler/aslprepkg.c Sat Mar 22 21:42:44 2014 +0000
@@ -617,7 +617,7 @@
     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 @@
     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 @@
     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);
diff -r ead33a9520a0 -r ddad71214087 sys/external/bsd/acpica/dist/compiler/aslsupport.l
--- a/sys/external/bsd/acpica/dist/compiler/aslsupport.l        Sat Mar 22 20:56:04 2014 +0000
+++ b/sys/external/bsd/acpica/dist/compiler/aslsupport.l        Sat Mar 22 21:42:44 2014 +0000
@@ -349,7 +349,7 @@
              * 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,
diff -r ead33a9520a0 -r ddad71214087 sys/external/bsd/acpica/dist/compiler/aslutils.c
--- a/sys/external/bsd/acpica/dist/compiler/aslutils.c  Sat Mar 22 20:56:04 2014 +0000
+++ b/sys/external/bsd/acpica/dist/compiler/aslutils.c  Sat Mar 22 21:42:44 2014 +0000
@@ -572,7 +572,7 @@
     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 @@
     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);
     }
diff -r ead33a9520a0 -r ddad71214087 sys/external/bsd/acpica/dist/compiler/aslwalks.c
--- a/sys/external/bsd/acpica/dist/compiler/aslwalks.c  Sat Mar 22 20:56:04 2014 +0000
+++ b/sys/external/bsd/acpica/dist/compiler/aslwalks.c  Sat Mar 22 21:42:44 2014 +0000
@@ -427,7 +427,7 @@
                 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);
diff -r ead33a9520a0 -r ddad71214087 sys/external/bsd/acpica/dist/compiler/aslxref.c
--- a/sys/external/bsd/acpica/dist/compiler/aslxref.c   Sat Mar 22 20:56:04 2014 +0000
+++ b/sys/external/bsd/acpica/dist/compiler/aslxref.c   Sat Mar 22 21:42:44 2014 +0000
@@ -580,7 +580,7 @@
 
             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 @@
          */
         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 @@
              */
             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)
diff -r ead33a9520a0 -r ddad71214087 sys/external/bsd/acpica/dist/compiler/dtcompile.c
--- a/sys/external/bsd/acpica/dist/compiler/dtcompile.c Sat Mar 22 20:56:04 2014 +0000
+++ b/sys/external/bsd/acpica/dist/compiler/dtcompile.c Sat Mar 22 21:42:44 2014 +0000
@@ -211,7 +211,8 @@
     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 @@
     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 @@
 
         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;
diff -r ead33a9520a0 -r ddad71214087 sys/external/bsd/acpica/dist/compiler/dtfield.c
--- a/sys/external/bsd/acpica/dist/compiler/dtfield.c   Sat Mar 22 20:56:04 2014 +0000
+++ b/sys/external/bsd/acpica/dist/compiler/dtfield.c   Sat Mar 22 21:42:44 2014 +0000
@@ -174,7 +174,7 @@
 
     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 @@
     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 @@
 
     if (Value > MaxValue)
     {
-        sprintf (MsgBuffer, "%8.8X%8.8X - max %u bytes",



Home | Main Index | Thread Index | Old Index