]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/ArmDisassemblerLib: replace AsciiStrCat() with AsciiStrCatS()
authorLaszlo Ersek <lersek@redhat.com>
Fri, 21 Oct 2016 19:31:09 +0000 (21:31 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Tue, 25 Oct 2016 08:46:40 +0000 (10:46 +0200)
AsciiStrCat() is deprecated / disabled under the
DISABLE_NEW_DEPRECATED_INTERFACES feature test macro.

The "Str" variable serves no particular purpose in the MRegList() and
ThumbMRegList() functions; replace it with the pointed-to "mMregListStr" /
"mThumbMregListStr" global variable (as appropriate), so that the new
AsciiStrCatS() calls are as clear as possible.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Michael Zimmermann <sigmaepsilon92@gmail.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=164
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=165
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c
ArmPkg/Library/ArmDisassemblerLib/ThumbDisassembler.c

index 29a8d4438622a156680ad857b7b2d86fe8738329..29d9414a78b335c10708139c9fa0abbf24bbb27c 100644 (file)
@@ -88,12 +88,10 @@ MRegList (
   )\r
 {\r
   UINTN     Index, Start, End;\r
-  CHAR8     *Str;\r
   BOOLEAN   First;\r
 \r
-  Str = mMregListStr;\r
-  *Str = '\0';\r
-  AsciiStrCat  (Str, "{");\r
+  mMregListStr[0] = '\0';\r
+  AsciiStrCatS (mMregListStr, sizeof mMregListStr, "{");\r
   for (Index = 0, First = TRUE; Index <= 15; Index++) {\r
     if ((OpCode & (1 << Index)) != 0) {\r
       Start = End = Index;\r
@@ -102,25 +100,25 @@ MRegList (
       }\r
 \r
       if (!First) {\r
-        AsciiStrCat  (Str, ",");\r
+        AsciiStrCatS (mMregListStr, sizeof mMregListStr, ",");\r
       } else {\r
         First = FALSE;\r
       }\r
 \r
       if (Start == End) {\r
-        AsciiStrCat  (Str, gReg[Start]);\r
-        AsciiStrCat  (Str, ", ");\r
+        AsciiStrCatS (mMregListStr, sizeof mMregListStr, gReg[Start]);\r
+        AsciiStrCatS (mMregListStr, sizeof mMregListStr, ", ");\r
       } else {\r
-        AsciiStrCat  (Str, gReg[Start]);\r
-        AsciiStrCat  (Str, "-");\r
-        AsciiStrCat  (Str, gReg[End]);\r
+        AsciiStrCatS (mMregListStr, sizeof mMregListStr, gReg[Start]);\r
+        AsciiStrCatS (mMregListStr, sizeof mMregListStr, "-");\r
+        AsciiStrCatS (mMregListStr, sizeof mMregListStr, gReg[End]);\r
       }\r
     }\r
   }\r
   if (First) {\r
-    AsciiStrCat  (Str, "ERROR");\r
+    AsciiStrCatS (mMregListStr, sizeof mMregListStr, "ERROR");\r
   }\r
-  AsciiStrCat  (Str, "}");\r
+  AsciiStrCatS (mMregListStr, sizeof mMregListStr, "}");\r
 \r
   // BugBug: Make caller pass in buffer it is cleaner\r
   return mMregListStr;\r
index 5bad3afcfbf636a0b05305ac4cabeef386f79a11..8c7285bcaee9cc49757f442e62894ed195db712e 100644 (file)
@@ -397,12 +397,10 @@ ThumbMRegList (
   )\r
 {\r
   UINTN     Index, Start, End;\r
-  CHAR8     *Str;\r
   BOOLEAN   First;\r
 \r
-  Str = mThumbMregListStr;\r
-  *Str = '\0';\r
-  AsciiStrCat  (Str, "{");\r
+  mThumbMregListStr[0] = '\0';\r
+  AsciiStrCatS (mThumbMregListStr, sizeof mThumbMregListStr, "{");\r
 \r
   for (Index = 0, First = TRUE; Index <= 15; Index++) {\r
     if ((RegBitMask & (1 << Index)) != 0) {\r
@@ -412,24 +410,24 @@ ThumbMRegList (
       }\r
 \r
       if (!First) {\r
-        AsciiStrCat  (Str, ",");\r
+        AsciiStrCatS (mThumbMregListStr, sizeof mThumbMregListStr, ",");\r
       } else {\r
         First = FALSE;\r
       }\r
 \r
       if (Start == End) {\r
-        AsciiStrCat  (Str, gReg[Start]);\r
+        AsciiStrCatS (mThumbMregListStr, sizeof mThumbMregListStr, gReg[Start]);\r
       } else {\r
-        AsciiStrCat  (Str, gReg[Start]);\r
-        AsciiStrCat  (Str, "-");\r
-        AsciiStrCat  (Str, gReg[End]);\r
+        AsciiStrCatS (mThumbMregListStr, sizeof mThumbMregListStr, gReg[Start]);\r
+        AsciiStrCatS (mThumbMregListStr, sizeof mThumbMregListStr, "-");\r
+        AsciiStrCatS (mThumbMregListStr, sizeof mThumbMregListStr, gReg[End]);\r
       }\r
     }\r
   }\r
   if (First) {\r
-    AsciiStrCat  (Str, "ERROR");\r
+    AsciiStrCatS (mThumbMregListStr, sizeof mThumbMregListStr, "ERROR");\r
   }\r
-  AsciiStrCat  (Str, "}");\r
+  AsciiStrCatS (mThumbMregListStr, sizeof mThumbMregListStr, "}");\r
 \r
   // BugBug: Make caller pass in buffer it is cleaner\r
   return mThumbMregListStr;\r