Package: rkdeveloptool / 1.32+git20210408.46bb4c0-3

0001-Simplify-convertChipType-and-fix-truncation-error.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
From: Matt Flax <flatmax@flatmax.org>
Date: Mon, 7 Mar 2022 10:23:42 +1100
Subject: Simplify convertChipType and fix truncation error.
Origin: https://github.com/rockchip-linux/rkdeveloptool/pull/67

The error stopping compilations is format-truncation.

---
 main.cpp | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/main.cpp b/main.cpp
index 72bd94b..f381e1a 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1488,10 +1488,7 @@ static bool saveEntry(FILE* outFile, char* path, rk_entry_type type,
 }
 
 static inline uint32_t convertChipType(const char* chip) {
-	char buffer[5];
-	memset(buffer, 0, sizeof(buffer));
-	snprintf(buffer, sizeof(buffer), "%s", chip);
-	return buffer[0] << 24 | buffer[1] << 16 | buffer[2] << 8 | buffer[3];
+	return chip[0] << 24 | chip[1] << 16 | chip[2] << 8 | chip[3];
 }
 
 static inline uint32_t getChipType(const char* chip) {