fix xcos scopes after changes on graphic uid 48/12948/1
Antoine ELIAS [Thu, 17 Oct 2013 16:56:46 +0000 (18:56 +0200)]
Change-Id: I2fe56ff306403242405c435b3cb569a6948ac3a3

scilab/modules/scicos_blocks/src/c/bouncexy.c
scilab/modules/scicos_blocks/src/c/canimxy.c
scilab/modules/scicos_blocks/src/c/canimxy3d.c
scilab/modules/scicos_blocks/src/c/cevscpe.c
scilab/modules/scicos_blocks/src/c/cfscope.c
scilab/modules/scicos_blocks/src/c/cmat3d.c
scilab/modules/scicos_blocks/src/c/cmatview.c
scilab/modules/scicos_blocks/src/c/cmscope.c
scilab/modules/scicos_blocks/src/c/cscope.c
scilab/modules/scicos_blocks/src/c/cscopxy.c
scilab/modules/scicos_blocks/src/c/cscopxy3d.c

index bd84a10..1c5b029 100644 (file)
@@ -293,14 +293,7 @@ static void freeScoData(scicos_block * block)
 
         FREE(sco->internal.data);
         FREE(sco->internal.ballsSize);
-
-        for (i = 0; i < block->insz[0]; i++)
-        {
-            FREE(sco->scope.cachedArcsUIDs[i]);
-            sco->scope.cachedArcsUIDs[i] = NULL;
-        }
-        FREE(sco->scope.cachedAxeUID);
-        sco->scope.cachedAxeUID = NULL;
+        FREE(sco->scope.cachedArcsUIDs);
 
         FREE(sco);
         *(block->work) = NULL;
@@ -383,7 +376,7 @@ static int getFigure(scicos_block * block)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedFigureUID != NULL)
+    if (sco->scope.cachedFigureUID)
     {
         return sco->scope.cachedFigureUID;
     }
@@ -440,7 +433,7 @@ static int getAxe(int iFigureUID, scicos_block * block)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedAxeUID != NULL)
+    if (sco->scope.cachedAxeUID)
     {
         return sco->scope.cachedAxeUID;
     }
@@ -497,7 +490,7 @@ static int getArc(int iAxeUID, scicos_block * block, int row)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedArcsUIDs[row] != NULL)
+    if (sco->scope.cachedArcsUIDs[row])
     {
         return sco->scope.cachedArcsUIDs[row];
     }
index 345ff83..ff29301 100644 (file)
@@ -278,16 +278,9 @@ static void freeScoData(scicos_block * block)
         {
             FREE(sco->internal.coordinates[i]);
         }
-        FREE(sco->internal.coordinates);
-
-        for (i = 0; i < block->insz[0]; i++)
-        {
-            FREE(sco->scope.cachedPolylinesUIDs[i]);
-            sco->scope.cachedPolylinesUIDs[i] = NULL;
-        }
-        FREE(sco->scope.cachedAxeUID);
-        sco->scope.cachedAxeUID = NULL;
 
+        FREE(sco->internal.coordinates);
+        FREE(sco->scope.cachedPolylinesUIDs);
         FREE(sco);
         *(block->work) = NULL;
     }
@@ -429,7 +422,7 @@ static int getFigure(scicos_block * block)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedFigureUID != NULL)
+    if (sco->scope.cachedFigureUID)
     {
         return sco->scope.cachedFigureUID;
     }
@@ -491,7 +484,7 @@ static int getAxe(int iFigureUID, scicos_block * block)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedAxeUID != NULL)
+    if (sco->scope.cachedAxeUID)
     {
         return sco->scope.cachedAxeUID;
     }
@@ -549,7 +542,7 @@ static int getPolyline(int iAxeUID, scicos_block * block, int row)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedPolylinesUIDs[row] != NULL)
+    if (sco->scope.cachedPolylinesUIDs[row])
     {
         return sco->scope.cachedPolylinesUIDs[row];
     }
index 8b07879..bd849ce 100644 (file)
@@ -282,16 +282,9 @@ static void freeScoData(scicos_block * block)
         {
             FREE(sco->internal.coordinates[i]);
         }
-        FREE(sco->internal.coordinates);
-
-        for (i = 0; i < block->insz[0]; i++)
-        {
-            FREE(sco->scope.cachedPolylinesUIDs[i]);
-            sco->scope.cachedPolylinesUIDs[i] = NULL;
-        }
-        FREE(sco->scope.cachedAxeUID);
-        sco->scope.cachedAxeUID = NULL;
 
+        FREE(sco->internal.coordinates);
+        FREE(sco->scope.cachedPolylinesUIDs);
         FREE(sco);
         *(block->work) = NULL;
     }
@@ -440,7 +433,7 @@ static int getFigure(scicos_block * block)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedFigureUID != NULL)
+    if (sco->scope.cachedFigureUID != 0)
     {
         return sco->scope.cachedFigureUID;
     }
@@ -484,7 +477,7 @@ static int getFigure(scicos_block * block)
         setPolylinesBounds(block);
     }
 
-    if (sco->scope.cachedFigureUID == NULL)
+    if (sco->scope.cachedFigureUID == 0)
     {
         sco->scope.cachedFigureUID = iFigureUID;
     }
@@ -504,7 +497,7 @@ static int getAxe(int iFigureUID, scicos_block * block)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedAxeUID != NULL)
+    if (sco->scope.cachedAxeUID != 0)
     {
         return sco->scope.cachedAxeUID;
     }
@@ -562,7 +555,7 @@ static int getPolyline(int iAxeUID, scicos_block * block, int row)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedPolylinesUIDs[row] != NULL)
+    if (sco->scope.cachedPolylinesUIDs[row])
     {
         return sco->scope.cachedPolylinesUIDs[row];
     }
index cdcfe03..e722e09 100644 (file)
@@ -345,16 +345,11 @@ static void freeScoData(scicos_block * block)
         {
             FREE(sco->internal.data[i]);
         }
+
         FREE(sco->internal.data);
         FREE(sco->internal.maxNumberOfPoints);
         FREE(sco->internal.numberOfPoints);
-
-        for (i = 0; i < nclk; i++)
-        {
-            FREE(sco->scope.cachedSegsUIDs[i]);
-        }
-        FREE(sco->scope.cachedAxeUID);
-
+        FREE(sco->scope.cachedSegsUIDs);
         FREE(sco);
         *(block->work) = NULL;
     }
@@ -583,7 +578,7 @@ static int getFigure(scicos_block * block)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedFigureUID != NULL)
+    if (sco->scope.cachedFigureUID)
     {
         return sco->scope.cachedFigureUID;
     }
@@ -647,7 +642,7 @@ static int getAxe(int iFigureUID, scicos_block * block)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedAxeUID != NULL)
+    if (sco->scope.cachedAxeUID)
     {
         return sco->scope.cachedAxeUID;
     }
@@ -704,7 +699,7 @@ static int getSegs(int iAxeUID, scicos_block * block, int input)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedSegsUIDs[input] != 0)
+    if (sco->scope.cachedSegsUIDs[input])
     {
         return sco->scope.cachedSegsUIDs[input];
     }
index e569469..2c8dcca 100644 (file)
@@ -340,14 +340,9 @@ static void freeScoData(scicos_block * block)
             }
             FREE(sco->internal.coordinates[i]);
         }
-        FREE(sco->internal.coordinates);
-
-        for (i = 0; i < links_count; i++)
-        {
-            FREE(sco->scope.cachedPolylinesUIDs[i]);
-        }
-        FREE(sco->scope.cachedAxeUID);
 
+        FREE(sco->internal.coordinates);
+        FREE(sco->scope.cachedPolylinesUIDs);
         FREE(sco);
         *(block->work) = NULL;
     }
@@ -551,7 +546,7 @@ static int getFigure(scicos_block * block)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedFigureUID != NULL)
+    if (sco->scope.cachedFigureUID)
     {
         return sco->scope.cachedFigureUID;
     }
@@ -617,7 +612,7 @@ static int getAxe(int iFigureUID, scicos_block * block, int input)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedAxeUID != NULL)
+    if (sco->scope.cachedAxeUID)
     {
         return sco->scope.cachedAxeUID;
     }
@@ -672,7 +667,7 @@ static int getPolyline(int iAxeUID, scicos_block * block, int row)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedPolylinesUIDs[row] != NULL)
+    if (sco->scope.cachedPolylinesUIDs[row])
     {
         return sco->scope.cachedPolylinesUIDs[row];
     }
index 2dc9e49..c4d4391 100644 (file)
@@ -220,9 +220,9 @@ static sco_data *getScoData(scicos_block * block)
             goto error_handler_sco;
         }
 
-        sco->scope.cachedFigureUID = NULL;
-        sco->scope.cachedAxeUID = NULL;
-        sco->scope.cachedPlot3dUID = NULL;
+        sco->scope.cachedFigureUID = 0;
+        sco->scope.cachedAxeUID = 0;
+        sco->scope.cachedPlot3dUID = 0;
 
         *(block->work) = sco;
     }
@@ -245,10 +245,6 @@ static void freeScoData(scicos_block * block)
 
     if (sco != NULL)
     {
-        FREE(sco->scope.cachedAxeUID);
-        FREE(sco->scope.cachedPlot3dUID);
-
-
         FREE(sco);
         *(block->work) = NULL;
     }
@@ -303,7 +299,7 @@ static int getFigure(scicos_block * block)
 
 
     // fast path for an existing object
-    if (sco->scope.cachedFigureUID != NULL)
+    if (sco->scope.cachedFigureUID)
     {
         return sco->scope.cachedFigureUID;
     }
@@ -364,7 +360,7 @@ static int getAxe(int iFigureUID, scicos_block * block)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedAxeUID != NULL)
+    if (sco->scope.cachedAxeUID)
     {
         return sco->scope.cachedAxeUID;
     }
@@ -411,7 +407,7 @@ static int getPlot3d(int iAxeUID, scicos_block * block)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedPlot3dUID != NULL)
+    if (sco->scope.cachedPlot3dUID)
     {
         return sco->scope.cachedPlot3dUID;
     }
index c3a00db..6ea730a 100644 (file)
@@ -320,7 +320,7 @@ static int getFigure(scicos_block * block)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedFigureUID != 0)
+    if (sco->scope.cachedFigureUID)
     {
         return sco->scope.cachedFigureUID;
     }
@@ -378,7 +378,7 @@ static int getAxe(int iFigureUID, scicos_block * block)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedAxeUID != 0)
+    if (sco->scope.cachedAxeUID)
     {
         return sco->scope.cachedAxeUID;
     }
@@ -427,7 +427,7 @@ static int getGrayplot(int iAxeUID, scicos_block * block)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedGrayplotUID != 0)
+    if (sco->scope.cachedGrayplotUID)
     {
         return sco->scope.cachedGrayplotUID;
     }
index e996ae0..ac36588 100644 (file)
@@ -478,8 +478,10 @@ static void freeScoData(scicos_block * block)
             FREE(sco->scope.cachedHistoryPolylinesUIDs[i]);
             FREE(sco->scope.cachedBufferPolylinesUIDs[i]);
         }
-        FREE(sco->scope.cachedAxeUID);
 
+        FREE(sco->scope.cachedHistoryPolylinesUIDs);
+        FREE(sco->scope.cachedBufferPolylinesUIDs);
+        FREE(sco->scope.cachedAxeUID);
         FREE(sco);
         *(block->work) = NULL;
     }
@@ -797,7 +799,7 @@ static int getFigure(scicos_block * block)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedFigureUID != 0)
+    if (sco->scope.cachedFigureUID)
     {
         return sco->scope.cachedFigureUID;
     }
@@ -867,7 +869,7 @@ static int getAxe(int iFigureUID, scicos_block * block, int input)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedAxeUID[input] != 0)
+    if (sco->scope.cachedAxeUID[input])
     {
         return sco->scope.cachedAxeUID[input];
     }
index d9b8b44..7a11b30 100644 (file)
@@ -415,7 +415,6 @@ static void freeScoData(scicos_block * block)
 
         FREE(sco->scope.cachedHistoryPolylinesUIDs);
         FREE(sco->scope.cachedBufferPolylinesUIDs);
-        FREE(sco->scope.cachedAxeUID);
 
         FREE(sco);
         *(block->work) = NULL;
@@ -777,7 +776,7 @@ static int getAxe(int iFigureUID, scicos_block * block, int input)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedAxeUID != NULL)
+    if (sco->scope.cachedAxeUID != 0)
     {
         return sco->scope.cachedAxeUID;
     }
index c657562..5f003b2 100644 (file)
@@ -237,8 +237,8 @@ static sco_data *getScoData(scicos_block * block)
             }
         }
 
-        sco->scope.cachedFigureUID = NULL;
-        sco->scope.cachedAxeUID = NULL;
+        sco->scope.cachedFigureUID = 0;
+        sco->scope.cachedAxeUID = 0;
 
         sco->scope.cachedPolylinesUIDs = (int*)CALLOC(block->insz[0], sizeof(int));
 
@@ -276,14 +276,9 @@ static void freeScoData(scicos_block * block)
         {
             FREE(sco->internal.coordinates[i]);
         }
-        FREE(sco->internal.coordinates);
-
-        for (i = 0; i < block->insz[0]; i++)
-        {
-            FREE(sco->scope.cachedPolylinesUIDs[i]);
-        }
-        FREE(sco->scope.cachedAxeUID);
 
+        FREE(sco->internal.coordinates);
+        FREE(sco->scope.cachedPolylinesUIDs);
         FREE(sco);
         *(block->work) = NULL;
     }
@@ -459,7 +454,7 @@ static int getFigure(scicos_block * block)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedFigureUID != 0)
+    if (sco->scope.cachedFigureUID)
     {
         return sco->scope.cachedFigureUID;
     }
@@ -521,7 +516,7 @@ static int getAxe(int iFigureUID, scicos_block * block)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedAxeUID != 0)
+    if (sco->scope.cachedAxeUID)
     {
         return sco->scope.cachedAxeUID;
     }
@@ -579,7 +574,7 @@ static int getPolyline(int iAxeUID, scicos_block * block, int row)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedPolylinesUIDs[row] != 0)
+    if (sco->scope.cachedPolylinesUIDs[row])
     {
         return sco->scope.cachedPolylinesUIDs[row];
     }
index 03708fc..fb5a27c 100644 (file)
@@ -280,14 +280,9 @@ static void freeScoData(scicos_block * block)
         {
             FREE(sco->internal.coordinates[i]);
         }
-        FREE(sco->internal.coordinates);
-
-        for (i = 0; i < block->insz[0]; i++)
-        {
-            FREE(sco->scope.cachedPolylinesUIDs[i]);
-        }
-        FREE(sco->scope.cachedAxeUID);
 
+        FREE(sco->internal.coordinates);
+        FREE(sco->scope.cachedPolylinesUIDs);
         FREE(sco);
         *(block->work) = NULL;
     }
@@ -474,7 +469,7 @@ static int getFigure(scicos_block * block)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedFigureUID != NULL)
+    if (sco->scope.cachedFigureUID)
     {
         return sco->scope.cachedFigureUID;
     }
@@ -538,7 +533,7 @@ static int getAxe(int iFigureUID, scicos_block * block)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedAxeUID != 0)
+    if (sco->scope.cachedAxeUID)
     {
         return sco->scope.cachedAxeUID;
     }
@@ -596,7 +591,7 @@ static int getPolyline(int iAxeUID, scicos_block * block, int row)
     }
 
     // fast path for an existing object
-    if (sco->scope.cachedPolylinesUIDs[row] != 0)
+    if (sco->scope.cachedPolylinesUIDs[row])
     {
         return sco->scope.cachedPolylinesUIDs[row];
     }