[PATCH] Fix format of sprintf
authorNobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
Mon, 1 Nov 2021 00:14:43 +0000 (09:14 +0900)
committerNobuhiro Iwamatsu <iwamatsu@debian.org>
Wed, 22 Dec 2021 08:29:11 +0000 (08:29 +0000)
https://buildd.debian.org/status/fetch.php?pkg=target-factory&arch=armel&ver=1.4-2&stamp=1635640153&raw=0

```
<<PKGBUILDDIR>>/src/create_target_DPUCVDX8G_ISA1.cpp: In function ‘const vitis::ai::Target vitis::ai::create_target_DPUCVDX8G_ISA1(uint64_t)’:
/<<PKGBUILDDIR>>/src/create_target_DPUCVDX8G_ISA1.cpp:61:29: error: format ‘%lX’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘long long unsigned int’ [-Werror=format=]
   61 |   sprintf(finger_hex, "%016lX", fingerprint);
      |                        ~~~~~^   ~~~~~~~~~~~
      |                             |   |
      |                             |   long long unsigned int
      |                             long unsigned int
      |                        %016llX
```

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
Gbp-Pq: Name 0004-Fix-format-of-sprintf.patch

src/create_target_DPUCVDX8G_ISA0.cpp
src/create_target_DPUCVDX8G_ISA1.cpp
src/create_target_v2.cpp

index 2ebaae0e6f392a25196ba57a42112937a378507b..d03647b0be5f3bbbaf4db11e6c7d5ae1fe9bba3c 100644 (file)
@@ -15,6 +15,7 @@ limitations under the License.
 */
 
 #include "target.pb.h"
+#include <cinttypes>
 
 namespace vitis {
 namespace ai {
@@ -59,7 +60,7 @@ const Target create_target_DPUCVDX8G_ISA0(const std::uint64_t fingerprint) {
 
   std::string NAME = "DPUCVDX8G_ISAx_CxBx_x";
   char finger_hex[17];
-  sprintf(finger_hex, "%016lX", fingerprint);
+  sprintf(finger_hex, "%016" PRIx64, fingerprint);
   NAME.replace(20, 1, finger_hex);
   NAME.replace(18, 1, std::to_string(BATCH));
   NAME.replace(16, 1, std::to_string(OCP));
index 18b0850e04a2529024b1a507fc47766a1b7664a4..106e83af6277206f5addd72752969d06a8e11869 100644 (file)
@@ -15,6 +15,7 @@ limitations under the License.
 */
 
 #include "target.pb.h"
+#include <cinttypes>
 
 namespace vitis {
 namespace ai {
@@ -58,7 +59,7 @@ const Target create_target_DPUCVDX8G_ISA1(const std::uint64_t fingerprint) {
 
   std::string NAME = "DPUCVDX8G_ISAx_CxBx_x";
   char finger_hex[17];
-  sprintf(finger_hex, "%016lX", fingerprint);
+  sprintf(finger_hex, "%016" PRIx64, fingerprint);
   NAME.replace(20, 1, finger_hex);
   NAME.replace(18, 1, std::to_string(BATCH));
   NAME.replace(16, 1, std::to_string(OCP));
index 521e310f36952dc4f1a50928d5418a88f3dcadbc..d62eb350d2cf189a37a5f3c34f84c109eb315674 100644 (file)
@@ -15,6 +15,7 @@ limitations under the License.
 */
 
 #include "target.pb.h"
+#include <cinttypes>
 
 namespace vitis {
 namespace ai {
@@ -54,7 +55,7 @@ const Target create_target_v2(const std::uint64_t fingerprint) {
 
   std::string NAME = "DPUCVDX8G_ISAx_Bx_x";
   char finger_hex[17];
-  sprintf(finger_hex, "%016lX", fingerprint);
+  sprintf(finger_hex, "%016" PRIx64, fingerprint);
   NAME.replace(18, 1, finger_hex);
   NAME.replace(16, 1, std::to_string(PEAK));
   NAME.replace(13, 1, std::to_string(ISA));