icoutils/0012-icotool-Fix-some-comparisons-of-signed-unsigned.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

78 lines
3.1 KiB
Diff

From 7d8a205535a4368a0b24358e122767153d0e1fdf Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 9 Mar 2017 13:52:08 +0000
Subject: [PATCH 12/26] icotool: Fix some comparisons of signed/unsigned.
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
---
icotool/create.c | 8 ++++----
icotool/extract.c | 6 +++---
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/icotool/create.c b/icotool/create.c
index 20a0630..0e922e0 100644
--- a/icotool/create.c
+++ b/icotool/create.c
@@ -222,7 +222,7 @@ create_icon(size_t filec, char **filev, size_t raw_filec, char** raw_filev, Crea
img[c].palette_count = 0;
}
else if (palette_count(img[c].palette) <= 256) {
- for (d = 1; palette_count(img[c].palette) > 1 << d; d <<= 1);
+ for (d = 1; palette_count(img[c].palette) > (uint32_t)(1 << d); d <<= 1);
if (d == 2) /* four colors (two bits) are not supported */
d = 4;
img[c].bit_count = d;
@@ -235,9 +235,9 @@ create_icon(size_t filec, char **filev, size_t raw_filec, char** raw_filev, Crea
/* Does the user want to change number of bits per pixel? */
if (bit_count != -1) {
- if (img[c].bit_count == bit_count) {
+ if (img[c].bit_count == (uint32_t) bit_count) {
/* No operation */
- } else if (img[c].bit_count < bit_count) {
+ } else if (img[c].bit_count < (uint32_t) bit_count) {
img[c].bit_count = bit_count;
img[c].palette_count = (bit_count > 16 ? 0 : 1 << bit_count);
} else {
@@ -357,7 +357,7 @@ create_icon(size_t filec, char **filev, size_t raw_filec, char** raw_filev, Crea
* programs that read icons assume it. Especially gdk-pixbuf.
*/
memset(&color, 0, sizeof(Win32RGBQuad));
- for (d = palette_count(img[c].palette); d < 1 << img[c].bit_count; d++)
+ for (d = palette_count(img[c].palette); d < (uint32_t) (1 << img[c].bit_count); d++)
fwrite(&color, sizeof(Win32RGBQuad), 1, out);
}
diff --git a/icotool/extract.c b/icotool/extract.c
index f987de4..ad83864 100644
--- a/icotool/extract.c
+++ b/icotool/extract.c
@@ -236,7 +236,7 @@ extract_icons(FILE *in, char *inname, bool listmode, ExtractNameGen outfile_gen,
offset += bitmap.size;
if (bitmap.clr_used != 0 || bitmap.bit_count < 24) {
- palette_count = (bitmap.clr_used != 0 ? bitmap.clr_used : 1 << bitmap.bit_count);
+ palette_count = (bitmap.clr_used != 0 ? bitmap.clr_used : (uint32_t) (1 << bitmap.bit_count));
if (palette_count > 256) {
warn(_("palette too large"));
goto done;
@@ -319,13 +319,13 @@ extract_icons(FILE *in, char *inname, bool listmode, ExtractNameGen outfile_gen,
row = xmalloc(width * 4);
- for (d = 0; d < height; d++) {
+ for (d = 0; d < (uint32_t) height; d++) {
uint32_t x;
uint32_t y = (bitmap.height < 0 ? d : height - d - 1);
uint32_t imod = y * (image_size / height) * 8 / bitmap.bit_count;
uint32_t mmod = y * (mask_size / height) * 8;
- for (x = 0; x < width; x++) {
+ for (x = 0; x < (uint32_t) width; x++) {
uint32_t color = simple_vec(image_data, x + imod, bitmap.bit_count);
if (bitmap.bit_count <= 16) {
--
2.10.2