]> git.pld-linux.org Git - packages/acpica.git/blob - str-trunc-warn.patch
- updated tests
[packages/acpica.git] / str-trunc-warn.patch
1 Index: acpica-unix2-20220331/source/compiler/aslanalyze.c
2 ===================================================================
3 --- acpica-unix2-20220331.orig/source/compiler/aslanalyze.c
4 +++ acpica-unix2-20220331/source/compiler/aslanalyze.c
5 @@ -358,11 +358,16 @@ AnCheckMethodReturnValue (
6           */
7          if (ThisNodeBtype != 0)
8          {
9 -            sprintf (AslGbl_MsgBuffer,
10 +            int cnt;
11 +            char *strp;
12 +
13 +            cnt = asprintf (&strp,
14                  "Method returns [%s], %s operator requires [%s]",
15                  AslGbl_StringBuffer, OpInfo->Name, AslGbl_StringBuffer2);
16  
17 -            AslError (ASL_WARNING, ASL_MSG_INVALID_TYPE, ArgOp, AslGbl_MsgBuffer);
18 +            AslError (ASL_WARNING, ASL_MSG_INVALID_TYPE, ArgOp, strp);
19 +            if (cnt > 0)
20 +                free(strp);
21          }
22      }
23  
24 Index: acpica-unix2-20220331/source/compiler/aslpredef.c
25 ===================================================================
26 --- acpica-unix2-20220331.orig/source/compiler/aslpredef.c
27 +++ acpica-unix2-20220331/source/compiler/aslpredef.c
28 @@ -159,14 +159,19 @@ ApCheckForPredefinedMethod (
29          if (MethodInfo->NumReturnNoValue &&
30              ThisName->Info.ExpectedBtypes)
31          {
32 +            int cnt;
33 +            char *strp;
34 +
35              AcpiUtGetExpectedReturnTypes (AslGbl_StringBuffer,
36                  ThisName->Info.ExpectedBtypes);
37  
38 -            sprintf (AslGbl_MsgBuffer, "%s required for %4.4s",
39 -                AslGbl_StringBuffer, ThisName->Info.Name);
40 +            cnt = asprintf (&strp, "%s required for %4.4s",
41 +               AslGbl_StringBuffer, ThisName->Info.Name);
42  
43              AslError (ASL_WARNING, ASL_MSG_RESERVED_RETURN_VALUE, Op,
44 -                AslGbl_MsgBuffer);
45 +                strp);
46 +            if (cnt > 0)
47 +               free(strp);
48          }
49          break;
50      }
51 @@ -698,18 +703,26 @@ TypeErrorExit:
52  
53      AcpiUtGetExpectedReturnTypes (AslGbl_StringBuffer, ExpectedBtypes);
54  
55 -    if (PackageIndex == ACPI_NOT_PACKAGE_ELEMENT)
56 -    {
57 -        sprintf (AslGbl_MsgBuffer, "%4.4s: found %s, %s required",
58 -            PredefinedName, TypeName, AslGbl_StringBuffer);
59 -    }
60 -    else
61      {
62 -        sprintf (AslGbl_MsgBuffer, "%4.4s: found %s at index %u, %s required",
63 -            PredefinedName, TypeName, PackageIndex, AslGbl_StringBuffer);
64 +        int cnt;
65 +        char *strp;
66 +
67 +        if (PackageIndex == ACPI_NOT_PACKAGE_ELEMENT)
68 +        {
69 +            cnt = asprintf (&strp, "%4.4s: found %s, %s required",
70 +                PredefinedName, TypeName, AslGbl_StringBuffer);
71 +        }
72 +        else
73 +        {
74 +            cnt = asprintf (&strp, "%4.4s: found %s at index %u, %s required",
75 +                PredefinedName, TypeName, PackageIndex, AslGbl_StringBuffer);
76 +        }
77 +
78 +        AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Op, strp);
79 +        if (cnt > 0)
80 +            free(strp);
81      }
82  
83 -    AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Op, AslGbl_MsgBuffer);
84      return (AE_TYPE);
85  }
86  
87 Index: acpica-unix2-20220331/source/compiler/aslwalks.c
88 ===================================================================
89 --- acpica-unix2-20220331.orig/source/compiler/aslwalks.c
90 +++ acpica-unix2-20220331/source/compiler/aslwalks.c
91 @@ -515,15 +515,19 @@ AnOperandTypecheckWalkEnd (
92              else if (!CommonBtypes)
93              {
94                  /* No match -- this is a type mismatch error */
95 +               int cnt;
96 +               char *strp;
97  
98                  AnFormatBtype (AslGbl_StringBuffer, ThisNodeBtype);
99                  AnFormatBtype (AslGbl_StringBuffer2, RequiredBtypes);
100  
101 -                sprintf (AslGbl_MsgBuffer, "[%s] found, %s operator requires [%s]",
102 +                cnt = asprintf (&strp, "[%s] found, %s operator requires [%s]",
103                      AslGbl_StringBuffer, OpInfo->Name, AslGbl_StringBuffer2);
104  
105                  AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE,
106 -                    ArgOp, AslGbl_MsgBuffer);
107 +                    ArgOp, strp);
108 +               if (cnt > 0)
109 +                   free(strp);
110              }
111  
112          NextArgument:
This page took 0.074212 seconds and 4 git commands to generate.