icoutils/0014-icotool-extract.c-Use-correct-printf-format-for-uint.patch
Richard W.M. Jones 86a1ed311e Add a series of upstream patches to enable compiler warnings and
fix multiple issues.

Revert one of the checks which breaks processing of PE binaries.

Removed the 'Group' line, not needed with modern Fedora/RPM.
2017-03-10 12:18:04 +00:00

58 lines
2.2 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From a788dc640fe1184dfe4c5c3dc9de8ecf34375556 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 9 Mar 2017 14:10:29 +0000
Subject: [PATCH 14/26] icotool/extract.c: Use correct printf format for
uint32_t.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
"%d" is for printing ints only. To print other types, use the macros
defined in the portable <inttypes.h> header. For uint32_t the correct
way is "%"PRIu32.
Warnings were all of the form shown below:
extract.c:356:16: error: format %d expects argument of type int, but argument 7 has type uint32_t {aka unsigned int} [-Werror=format=]
printf(_("--%s --index=%d --width=%d --height=%d --bit-depth=%d --palette-size=%d"),
^
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
---
icotool/extract.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/icotool/extract.c b/icotool/extract.c
index ad83864..cb8b5dc 100644
--- a/icotool/extract.c
+++ b/icotool/extract.c
@@ -21,6 +21,7 @@
#include <stdint.h> /* POSIX/Gnulib */
#include <stdlib.h> /* C89 */
#include <stdio.h> /* C89 */
+#include <inttypes.h>
#if HAVE_PNG_H
# include <png.h>
#else
@@ -183,7 +184,7 @@ extract_icons(FILE *in, char *inname, bool listmode, ExtractNameGen outfile_gen,
matched++;
if (listmode) {
- printf(_("--%s --index=%d --width=%d --height=%d --bit-depth=%d --palette-size=%d"),
+ printf(_("--%s --index=%d --width=%d --height=%d --bit-depth=%" PRIu32 " --palette-size=%" PRIu32),
(dir.type == 1 ? "icon" : "cursor"), completed, width, height,
bit_count, palette_count);
if (dir.type == 2)
@@ -352,7 +353,7 @@ extract_icons(FILE *in, char *inname, bool listmode, ExtractNameGen outfile_gen,
}
if (listmode) {
- printf(_("--%s --index=%d --width=%d --height=%d --bit-depth=%d --palette-size=%d"),
+ printf(_("--%s --index=%d --width=%d --height=%d --bit-depth=%" PRIu32 " --palette-size=%" PRIu32),
(dir.type == 1 ? "icon" : "cursor"), completed, width, height,
bitmap.bit_count, palette_count);
if (dir.type == 2)
--
2.10.2