Patch to fix MAX/MIN error introduced in Bug 1305

Bill Binko bill at BINKO.NET
Fri May 13 02:55:14 EDT 2005


I made this change a while ago, but it never got applied. Basically, I
added MAX() and MIN() macros not knowing about MS_MAX and MS_MIN, so this
removes them and uses the right ones in msdraw.c

If someone could apply it, I'd appreciate it.

Bill
-------------- next part --------------
? 1
? configopts.txt
? mapscriptvars
? maxmin.patch
? nohup.out
? out
? patches
? shp2pdf
? mapscript/java/Makefile
Index: map.h
===================================================================
RCS file: /data2/cvsroot/mapserver/map.h,v
retrieving revision 1.407
diff -U5 -r1.407 map.h
--- map.h	11 May 2005 14:15:16 -0000	1.407
+++ map.h	13 May 2005 06:46:33 -0000
@@ -1933,9 +1933,6 @@
 
 #ifdef __cplusplus
 }
 #endif
 
-#define MAX(a,b)      ((a>b) ? a : b)
-#define MIN(a,b)      ((a<b) ? a : b)
-
 #endif /* MAP_H */
Index: mapdraw.c
===================================================================
RCS file: /data2/cvsroot/mapserver/mapdraw.c,v
retrieving revision 1.91
diff -U5 -r1.91 mapdraw.c
--- mapdraw.c	11 May 2005 21:45:18 -0000	1.91
+++ mapdraw.c	13 May 2005 06:46:33 -0000
@@ -2004,13 +2004,13 @@
   scaledVal = (fieldVal - style->minvalue)/range;
   
   /*At this point, we know where on the range we need to be*/
   /*However, we don't know how to map it yet, since RGB(A) can */
   /*Go up or down*/
-  style->color.red = (int)(MAX(0,(MIN(255, (style->mincolor.red + ((style->maxcolor.red - style->mincolor.red) * scaledVal))))));
-  style->color.green = (int)(MAX(0,(MIN(255,(style->mincolor.green + ((style->maxcolor.green - style->mincolor.green) * scaledVal))))));
-  style->color.blue = (int)(MAX(0,(MIN(255,(style->mincolor.blue + ((style->maxcolor.blue - style->mincolor.blue) * scaledVal))))));
+  style->color.red = (int)(MS_MAX(0,(MS_MIN(255, (style->mincolor.red + ((style->maxcolor.red - style->mincolor.red) * scaledVal))))));
+  style->color.green = (int)(MS_MAX(0,(MS_MIN(255,(style->mincolor.green + ((style->maxcolor.green - style->mincolor.green) * scaledVal))))));
+  style->color.blue = (int)(MS_MAX(0,(MS_MIN(255,(style->mincolor.blue + ((style->maxcolor.blue - style->mincolor.blue) * scaledVal))))));
   style->color.pen = MS_PEN_UNSET; /*so it will recalculate pen*/
 
   /*( "msMapRange(): %i %i %i", style->color.red , style->color.green, style->color.blue);*/
 
 #if ALPHACOLOR_ENABLED


More information about the mapserver-dev mailing list