icoutils/0008-common-llist.c-Avoid-unnecessary-comparisons-unsigne.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

80 lines
2.3 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 2d6c1451631989d6eda202a0e996c4e39ab788fc Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 9 Mar 2017 13:10:34 +0000
Subject: [PATCH 08/26] common/llist.c: Avoid unnecessary comparisons unsigned
< 0.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Unsigned is always zero or positive, so there is no need to compare
with < 0.
The original warnings/errors from GCC were:
llist.c: In function llist_get:
llist.c:284:12: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
if (index < 0 || index >= list->size)
^
llist.c: In function llist_set:
llist.c:297:12: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
if (index < 0 || index >= list->size)
^
llist.c: In function llist_add_at:
llist.c:319:12: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
if (index < 0 || index > list->size)
^
llist.c: In function llist_remove_at:
llist.c:346:12: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
if (index < 0 || index >= list->size)
^
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
---
common/llist.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/common/llist.c b/common/llist.c
index 01a74de..873f36c 100644
--- a/common/llist.c
+++ b/common/llist.c
@@ -281,7 +281,7 @@ llist_get(LList *list, uint32_t index)
{
LNode *entry;
- if (index < 0 || index >= list->size)
+ if (index >= list->size)
return NULL;
entry = llist_get_entry(list, index);
@@ -294,7 +294,7 @@ llist_set(LList *list, uint32_t index, void *data)
LNode *entry;
void *old_data;
- if (index < 0 || index >= list->size)
+ if (index >= list->size)
return NULL;
entry = llist_get_entry(list, index);
@@ -316,7 +316,7 @@ llist_add_at(LList *list, uint32_t index, void *data)
{
LNode *entry;
- if (index < 0 || index > list->size)
+ if (index > list->size)
return;
entry = xmalloc(sizeof(LNode));
@@ -343,7 +343,7 @@ llist_remove_at(LList *list, uint32_t index)
LNode *entry;
void *data;
- if (index < 0 || index >= list->size)
+ if (index >= list->size)
return NULL;
entry = llist_get_entry(list, index);
--
2.10.2