Ticket #1241 (closed defect: fixed)
[PATCH] resultCacheMemberObj.classindex should be a signed type
| Reported by: | pere@… | Owned by: | mapserverbugs |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | Build Problems | Version: | 4.4 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
When trying to compile mapserver on Irix, I get the following
warning:
cc-1183 cc: WARNING File = maptemplate.c, Line = 2789
An unsigned integer is being compared to zero.
if(lp->resultcache->results[0].classindex >= 0 && lp->class[(int)(lp->resultcache->results[0].classindex)].template)
^
cc-1183 cc: WARNING File = maptemplate.c, Line = 2912
An unsigned integer is being compared to zero.
if(lp->resultcache->results[j].classindex >= 0 && lp->class[(int)(lp->resultcache->results[j].classindex)].template)
^
The 'classindex' struct member is a char (in resultCacheMemberObj),
and the code in question will not work as expected when char is an
unsigned type (which is the case on some archs).
This was discussed on IRC, and the recommandation there was to
change the type to 'int' as almost all the othere index members
are of type 'int'. This patch will fix the problem:
Index: map.h
===================================================================
RCS file: /data2/cvsroot/mapserver/map.h,v
retrieving revision 1.395
diff -u -u -r1.395 map.h
--- map.h 9 Feb 2005 21:51:17 -0000 1.395
+++ map.h 12 Feb 2005 20:24:23 -0000
@@ -694,7 +694,7 @@
typedef struct {
long shapeindex;
int tileindex;
- char classindex;
+ int classindex;
} resultCacheMemberObj;
#ifdef SWIG
%mutable;
Change History
Note: See
TracTickets for help on using
tickets.
