--- "richardvoigt@gmail.com" richardvoigt@gmail.com wrote:
On 2/7/07, Joris Huizer joris_huizer@yahoo.com wrote:
I believe this one causes problems -- please do
not commit yet
Joris Huizer joris_huizer@yahoo.com wrote:
Need Mail bonding? Go to the Yahoo! Mail Q&A for great tips from
Yahoo! Answers users.>From
8686a200bd1f1cbd934d761013c487a9ddc195c9 Mon Sep
17
00:00:00 2001 From: Joris Huizer Date: Wed, 7 Feb 2007 15:19:25 +0100 Subject: [PATCH] winegcc sign-compare fixes To: wine-patches
tools/winegcc/utils.c | 13 +++++++------ tools/winegcc/winegcc.c | 11 ++++++----- 2 files changed, 13 insertions(+), 11
deletions(-)
diff --git a/tools/winegcc/utils.c
b/tools/winegcc/utils.c
index 1af91e9..c144077 100644 --- a/tools/winegcc/utils.c +++ b/tools/winegcc/utils.c @@ -120,14 +120,14 @@ void strarray_add(strarray*
arr, const c
void strarray_del(strarray* arr, int i) {
- if (i < 0 || i >= arr->size) error("Invalid
index i=%d", i);
- if (i < 0 || (unsigned int)i >= arr->size)
error("Invalid index i=%d", i);
The unsigned int comparison here makes the negative check superfluous. Perhaps the argument should even be changed to unsigned as well, to match the range of arr->size (if the element is one byte).
Alright, that makes sence, will do
memmove(&arr->base[i], &arr->base[i + 1],
(arr->size - i - 1) *
sizeof(arr->base[0])); arr->size--; }
If the element size could be greater than one byte, the multiplication here should be checked for overflow (actually, this is more necessary when the array is created or expanded).
Well, the base field in the structure is defined as "const char** base" so sizeof(base[0]) == sizeof(const char *), should be 4 or so. How do you mean overflow in this case? sorry for asking dumb questions...
____________________________________________________________________________________ Finding fabulous fares is fun. Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains. http://farechase.yahoo.com/promo-generic-14795097