[Freeciv-Dev] (PR#11323) size_t fixes in specvec.h
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: |
[Freeciv-Dev] (PR#11323) size_t fixes in specvec.h |
From: |
"Frédéric Brière" <fbriere@xxxxxxxxxxx> |
Date: |
Fri, 3 Dec 2004 13:50:53 -0800 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=11323 >
I'm getting a slew of warnings about comparisons between signed and
unsigned variables in specvec.h. Here's a patch that fixes this, by
changing an int for a size_t in one function, and adding a cast in
another. (Makes you pine for the long gone days of lint, doesn't it?)
--
Frédéric Brière <*> fbriere@xxxxxxxxxxx
=> <fbriere@xxxxxxxxxx> IS NO MORE: <http://www.abacomsucks.com> <=
Index: utility/specvec.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/utility/specvec.h,v
retrieving revision 1.8
diff -u -r1.8 specvec.h
--- utility/specvec.h 25 Sep 2004 18:49:37 -0000 1.8
+++ utility/specvec.h 3 Dec 2004 21:43:34 -0000
@@ -88,10 +88,10 @@
}
static inline void SPECVEC_FOO(_vector_reserve) (SPECVEC_VECTOR *tthis,
- int size)
+ size_t size)
{
if (size > tthis->size_alloc) {
- int new_size = MAX(size, tthis->size_alloc * 2);
+ size_t new_size = MAX(size, tthis->size_alloc * 2);
tthis->p = fc_realloc(tthis->p, new_size * sizeof(*tthis->p));
tthis->size_alloc = new_size;
@@ -109,7 +109,7 @@
{
if (index == -1 && tthis->size > 0) {
return tthis->p + tthis->size - 1;
- } else if (index >= 0 && index < tthis->size) {
+ } else if (index >= 0 && (size_t)index < tthis->size) {
return tthis->p + index;
} else {
return NULL;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#11323) size_t fixes in specvec.h,
Frédéric Brière <=
|
|