api_scilab : manage getComplexMatrixOfDouble with real variable. 49/10049/3
Cedric Delamarre [Mon, 17 Sep 2012 13:54:01 +0000 (15:54 +0200)]
Change-Id: I9b2d7feb18701464a8c73bff73a351c249122910
(cherry picked from commit f963f161370d18406e75fd04a85e421c00d59438)

scilab/modules/api_scilab/src/cpp/api_double.cpp

index ea0a9eb..2ca9230 100644 (file)
@@ -123,12 +123,6 @@ SciErr getCommonMatrixOfDouble(void* _pvCtx, int* _piAddress, int _iComplex, int
         return sciErr;
     }
 
-    if (isVarComplex(_pvCtx, _piAddress) != _iComplex)
-    {
-        addErrorMessage(&sciErr, API_ERROR_INVALID_COMPLEXITY, _("%s: Bad call to get a non complex matrix"), "getComplexMatrixOfDouble");
-        return sciErr;
-    }
-
     sciErr = getVarDimension(_pvCtx, _piAddress, _piRows, _piCols);
     if (sciErr.iErr)
     {
@@ -140,7 +134,7 @@ SciErr getCommonMatrixOfDouble(void* _pvCtx, int* _piAddress, int _iComplex, int
     {
         *_pdblReal     = (double*)(_piAddress + 4);
     }
-    if (_iComplex && _pdblImg != NULL)
+    if (isVarComplex(_pvCtx, _piAddress) && _pdblImg != NULL)
     {
         *_pdblImg      = (double*)(_piAddress + 4) + *_piRows * *_piCols;
     }