[mapserver-commits] r10822 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Sun Jan 2 16:31:37 EST 2011


Author: sdlime
Date: 2011-01-02 13:31:37 -0800 (Sun, 02 Jan 2011)
New Revision: 10822

Modified:
   trunk/mapserver/mapdraw.c
   trunk/mapserver/mapimagemap.c
   trunk/mapserver/mapswf.c
Log:
Standardize return values for msDrawLabelCache and msDrawLabel function. Imapacted SWF and image map driver source. (#3646)

Modified: trunk/mapserver/mapdraw.c
===================================================================
--- trunk/mapserver/mapdraw.c	2011-01-02 21:07:15 UTC (rev 10821)
+++ trunk/mapserver/mapdraw.c	2011-01-02 21:31:37 UTC (rev 10822)
@@ -466,7 +466,7 @@
 
   if(map->debug >= MS_DEBUGLEVEL_TUNING) msGettimeofday(&starttime, NULL);
 
-  if(msDrawLabelCache(image, map) == -1) {
+  if(msDrawLabelCache(image, map) != MS_SUCCESS) {
     msFreeImage(image);
 #if defined(USE_WMS_LYR) || defined(USE_WFS_LYR)
     if (pasOWSReqInfo) {

Modified: trunk/mapserver/mapimagemap.c
===================================================================
--- trunk/mapserver/mapimagemap.c	2011-01-02 21:07:15 UTC (rev 10821)
+++ trunk/mapserver/mapimagemap.c	2011-01-02 21:31:37 UTC (rev 10822)
@@ -1875,7 +1875,7 @@
 
       /* TO DO: at the moment only checks the bottom style, perhaps should check all of them */
       if (msGetMarkerSize(&map->symbolset, &(cachePtr->styles[0]), &marker_width, &marker_height, layerPtr->scalefactor) != MS_SUCCESS)
-	return(-1);
+	return(MS_FAILURE);
 
       marker_width = (int) (marker_width * layerPtr->scalefactor);
       marker_height = (int) (marker_height * layerPtr->scalefactor);
@@ -1979,7 +1979,7 @@
    } /* next label in cache */
   } /* next priority */
 
-  return(0);
+  return(MS_SUCCESS);
 }
 
 /*

Modified: trunk/mapserver/mapswf.c
===================================================================
--- trunk/mapserver/mapswf.c	2011-01-02 21:07:15 UTC (rev 10821)
+++ trunk/mapserver/mapswf.c	2011-01-02 21:31:37 UTC (rev 10822)
@@ -2261,8 +2261,9 @@
 /************************************************************************/
 /*                             int draw_textSWF                         */
 /*                                                                      */
-/*      Renders a text using FDB fonts. FDB fonts are specific to       */
-/*      ming library. Returns 0 on success and -1 on error.             */
+/*  Renders a text using FDB fonts. FDB fonts are specific to           */
+/*  ming library. Returns MS_SUCCESS on success and MS_FAILURE          */
+/*  on error.                                                           */
 /************************************************************************/
 int draw_textSWF(imageObj *image, pointObj labelPnt, char *string, 
                 labelObj *label, fontSetObj *fontset, double scalefactor)
@@ -2285,16 +2286,16 @@
 /*      if not SWF, return.                                             */
 /* -------------------------------------------------------------------- */
     if (image == NULL || !MS_DRIVER_SWF(image->format))
-        return 0;
+        return MS_SUCCESS;
 
 /* -------------------------------------------------------------------- */
 /*      validate arguments.                                             */
 /* -------------------------------------------------------------------- */
     if(!string || strlen(string) == 0 || !label || !fontset)
-        return(0); /* not an error, just don't want to do anything */
+        return(MS_SUCCESS); /* not an error, just don't want to do anything */
 
     if(strlen(string) == 0)
-        return(0); /* not an error, just don't want to do anything */
+        return(MS_SUCCESS); /* not an error, just don't want to do anything */
 
     x = MS_NINT(labelPnt.x);
     y = MS_NINT(labelPnt.y);
@@ -2312,13 +2313,13 @@
     if(!fontset) 
     {
         msSetError(MS_TTFERR, "No fontset defined.", "draw_textSWF()");
-        return(-1);
+        return(MS_FAILURE);
     }
 
     if(!label->font) 
     {
         msSetError(MS_TTFERR, "No font defined.", "draw_textSWF()");
-        return(-1);
+        return(MS_FAILURE);
     }
 
     font = msLookupHashTable(&(fontset->fonts), label->font);
@@ -2327,7 +2328,7 @@
     {
         msSetError(MS_TTFERR, "Requested font (%s) not found.", "draw_textSWF()",
                    label->font);
-        return(-1);
+        return(MS_FAILURE);
     }
 
 /* -------------------------------------------------------------------- */
@@ -2353,7 +2354,7 @@
     else
     {
         msSetError(MS_TTFERR, "Invalid color", "draw_textSWF()");
-	return(-1);
+	return(MS_FAILURE);
     }
     if (MS_VALID_COLOR(label->shadowcolor))
     {
@@ -2398,7 +2399,7 @@
         SWFDisplayItem_rotate(oDisplay, (float)label->angle);
     }
     
-    return 0;
+    return MS_SUCCESS;
 }
 
 
@@ -2535,7 +2536,7 @@
 /*      test for driver.                                                */
 /* -------------------------------------------------------------------- */
     if (!image || !MS_DRIVER_SWF(image->format))
-        return -1;
+        return MS_FAILURE;
 
     marker_rect.minx = marker_rect.miny = marker_rect.maxx = marker_rect.maxy = 0;      
 #ifdef USE_POINT_Z_M
@@ -2563,7 +2564,7 @@
         StoreShape(oShape, image);
         /* nTmp = ((SWFObj *)image->img.swf)->nCurrentMovie; */
         SWFMovie_add(GetCurrentMovie(map, image), oShape);
-        return 0;
+        return MS_SUCCESS;
     }
 /* -------------------------------------------------------------------- */
 /*      keep the current layer index.                                   */
@@ -2625,7 +2626,7 @@
 
         if(msGetLabelSizeSWF(cachePtr->text, labelPtr, &r, 
                              &(map->fontset), layerPtr->scalefactor) == -1)
-            return(-1);
+            return(MS_FAILURE);
 
         label_offset_x = labelPtr->offsetx*layerPtr->scalefactor;
         label_offset_y = labelPtr->offsety*layerPtr->scalefactor;
@@ -2640,7 +2641,7 @@
 
 	    /* TO DO: at the moment only checks the bottom style, perhaps should check all of them */
             if(msGetMarkerSize(&map->symbolset, &(cachePtr->styles[0]), &marker_width, &marker_height, layerPtr->scalefactor) != MS_SUCCESS)
-	      return(-1);
+	      return(MS_FAILURE);
             
             marker_width = (int)(marker_width);
             marker_height = (int)(marker_height);
@@ -2754,7 +2755,7 @@
     
     ((SWFObj *)image->img.swf)->nCurrentMovie = nCurrentMovie;
 
-    return(0);
+    return(MS_SUCCESS);
 }
 
 
@@ -2769,16 +2770,16 @@
 {
     pointObj p;
     rectObj r;
-    int label_offset_x, label_offset_y;
+    int label_offset_x, label_offset_y;    
 
     if (!image || !MS_DRIVER_SWF(image->format))
-        return 0;
+        return MS_SUCCESS;
 
     if(!string)
-        return(0); /* not an error, just don't want to do anything */
+        return MS_SUCCESS; /* not an error, just don't want to do anything */
 
     if(strlen(string) == 0)
-        return(0); /* not an error, just don't want to do anything */
+        return MS_SUCCESS; /* not an error, just don't want to do anything */
     
     msGetLabelSizeSWF(string, label, &r, fontset, scalefactor);
     label_offset_x = label->offsetx*scalefactor;
@@ -2788,8 +2789,7 @@
                     label_offset_y, label->angle, 0, NULL);
     /* labelPnt.x += label->offsetx; */
     /* labelPnt.y += label->offsety; */
-    return draw_textSWF(image, p, string, label, fontset, scalefactor);
-
+    return(draw_textSWF(image, p, string, label, fontset, scalefactor));
 }
 
 /************************************************************************/



More information about the mapserver-commits mailing list