bring back error checking removed by https://codereview.scilab.org/#/c/16673/ 60/16760/1
Vincent COUVERT [Thu, 2 Jul 2015 09:28:58 +0000 (11:28 +0200)]
Change-Id: I72a9a2065aedf700c16d0ff5f8c4549df17565d5

scilab/modules/graphics/src/c/getHandleProperty/get_mark_background_property.c
scilab/modules/graphics/src/c/getHandleProperty/get_mark_foreground_property.c
scilab/modules/graphics/src/c/getHandleProperty/get_mark_size_property.c

index f87238c..a37f0d7 100644 (file)
@@ -35,21 +35,27 @@ int get_mark_background_property(void* _pvCtx, int iObjUID)
     int iMarkBackground = 0;
     int* piMarkBackground = &iMarkBackground;
 
-       int * markBackgrounds = NULL;
+    int * markBackgrounds = NULL;
     int numMarkBackgrounds = 0;
     int * piNumMarkBackgrounds = &numMarkBackgrounds;
 
-       getGraphicObjectProperty(iObjUID, __GO_NUM_MARK_BACKGROUNDS__, jni_int, (void**)&piNumMarkBackgrounds);
-
-       if (numMarkBackgrounds == 0)
-       {
-               getGraphicObjectProperty(iObjUID, __GO_MARK_BACKGROUND__, jni_int, &piMarkBackground);
-               return sciReturnDouble(_pvCtx, iMarkBackground);
-       }
-       else
-       {
-               getGraphicObjectProperty(iObjUID, __GO_MARK_BACKGROUNDS__, jni_int_vector, &markBackgrounds);
-               return sciReturnRowVectorFromInt(_pvCtx, markBackgrounds, numMarkBackgrounds);
-       }
+    getGraphicObjectProperty(iObjUID, __GO_NUM_MARK_BACKGROUNDS__, jni_int, (void**)&piNumMarkBackgrounds);
+
+    if (piNumMarkBackgrounds == NULL)
+    {
+        Scierror(999, _("'%s' property does not exist for this handle.\n"), "mark_background");
+        return -1;
+    }
+
+    if (numMarkBackgrounds == 0)
+    {
+        getGraphicObjectProperty(iObjUID, __GO_MARK_BACKGROUND__, jni_int, &piMarkBackground);
+        return sciReturnDouble(_pvCtx, iMarkBackground);
+    }
+    else
+    {
+        getGraphicObjectProperty(iObjUID, __GO_MARK_BACKGROUNDS__, jni_int_vector, &markBackgrounds);
+        return sciReturnRowVectorFromInt(_pvCtx, markBackgrounds, numMarkBackgrounds);
+    }
 }
 /*------------------------------------------------------------------------*/
index 99c436b..79c42d2 100644 (file)
@@ -41,17 +41,23 @@ int get_mark_foreground_property(void* _pvCtx, int iObjUID)
     int numMarkForegrounds = 0;
     int * piNumMarkForegrounds = &numMarkForegrounds;
 
-       getGraphicObjectProperty(iObjUID, __GO_NUM_MARK_FOREGROUNDS__, jni_int, (void**)&piNumMarkForegrounds);
-
-       if (numMarkForegrounds == 0)
-       {
-               getGraphicObjectProperty(iObjUID, __GO_MARK_FOREGROUND__, jni_int, &piMarkForeground);
-               return sciReturnDouble(_pvCtx, iMarkForeground);
-       }
-       else
-       {
-               getGraphicObjectProperty(iObjUID, __GO_MARK_FOREGROUNDS__, jni_int_vector, &markForegrounds);
-               return sciReturnRowVectorFromInt(_pvCtx, markForegrounds, numMarkForegrounds);
-       }
+    getGraphicObjectProperty(iObjUID, __GO_NUM_MARK_FOREGROUNDS__, jni_int, (void**)&piNumMarkForegrounds);
+
+    if (piNumMarkForegrounds == NULL)
+    {
+        Scierror(999, _("'%s' property does not exist for this handle.\n"), "mark_foreground");
+        return -1;
+    }
+
+    if (numMarkForegrounds == 0)
+    {
+        getGraphicObjectProperty(iObjUID, __GO_MARK_FOREGROUND__, jni_int, &piMarkForeground);
+        return sciReturnDouble(_pvCtx, iMarkForeground);
+    }
+    else
+    {
+        getGraphicObjectProperty(iObjUID, __GO_MARK_FOREGROUNDS__, jni_int_vector, &markForegrounds);
+        return sciReturnRowVectorFromInt(_pvCtx, markForegrounds, numMarkForegrounds);
+    }
 }
 /*------------------------------------------------------------------------*/
index 7b721cc..3dd6a05 100644 (file)
@@ -39,17 +39,23 @@ int get_mark_size_property(void* _pvCtx, int iObjUID)
     int numMarkSizes = 0;
     int * piNumMarkSizes = &numMarkSizes;
 
-       getGraphicObjectProperty(iObjUID, __GO_NUM_MARK_SIZES__, jni_int, &piNumMarkSizes);
-
-       if (numMarkSizes == 0)
-       {
-               getGraphicObjectProperty(iObjUID, __GO_MARK_SIZE__, jni_int, &piMarkSize);
-               return sciReturnDouble(_pvCtx, iMarkSize);
-       }
-       else
-       {
-               getGraphicObjectProperty(iObjUID, __GO_MARK_SIZES__, jni_int_vector, &markSizes);
-               return sciReturnRowVectorFromInt(_pvCtx, markSizes, numMarkSizes);
-       }
+    getGraphicObjectProperty(iObjUID, __GO_NUM_MARK_SIZES__, jni_int, &piNumMarkSizes);
+
+    if (piNumMarkSizes == NULL)
+    {
+        Scierror(999, _("'%s' property does not exist for this handle.\n"), "mark_size");
+        return -1;
+    }
+
+    if (numMarkSizes == 0)
+    {
+        getGraphicObjectProperty(iObjUID, __GO_MARK_SIZE__, jni_int, &piMarkSize);
+        return sciReturnDouble(_pvCtx, iMarkSize);
+    }
+    else
+    {
+        getGraphicObjectProperty(iObjUID, __GO_MARK_SIZES__, jni_int_vector, &markSizes);
+        return sciReturnRowVectorFromInt(_pvCtx, markSizes, numMarkSizes);
+    }
 }
 /*------------------------------------------------------------------------*/