Coverity fixed: CID #1415535 to 1415545 79/21279/2
Clement David [Tue, 4 Feb 2020 15:49:58 +0000 (16:49 +0100)]
Change-Id: I5a51681104c49781e726190383dbd0fc70929623

scilab/modules/ast/src/cpp/system_env/configvariable.cpp
scilab/modules/core/src/cpp/InitScilab.cpp
scilab/modules/elementary_functions/sci_gateway/cpp/sci_linspace.cpp
scilab/modules/fileio/src/c/getFullFilename.c
scilab/modules/history_browser/src/cpp/CommandHistory_Wrap.cpp
scilab/modules/scicos/src/cpp/createblklist.cpp

index e27d008..f1c2083 100644 (file)
@@ -210,14 +210,9 @@ int ConfigVariable::getConsoleWidth(void)
         {
             return tgetnum((char *)"co");
         }
-        else
-        {
-            return m_iConsoleWidth;
-        }
-    }    
-#else
-    return m_iConsoleWidth;
+    }
 #endif
+    return m_iConsoleWidth;
 }
 /*
 ** \}
index b711739..986514c 100644 (file)
@@ -547,7 +547,15 @@ void StopScilabEngine(ScilabEngineInfo* _pSEI)
     FileManager::destroy();
 
     /* Remove TMPDIR before exit */
-    clearTMPDIR();
+    try
+    {
+        clearTMPDIR();
+    }
+    catch (const ast::InternalError& /*ie*/)
+    {
+        // unable to delete the directory, let's continue
+    }
+
 
     //Unload dynamic modules
     UnloadModules();
index 84a5247..78c1d2e 100644 (file)
@@ -256,6 +256,8 @@ int convertToSize(types::InternalType *pIT)
         {
             return convertTypeToInt32(pIT->getAs<types::UInt64>());
         }
+        default:
+            return 0;
     }
 }
 
index 19d9484..2d8d4f3 100644 (file)
@@ -77,13 +77,10 @@ wchar_t *getFullFilenameW(const wchar_t* FilenameInput)
             }
         }
 
-        if (wcTmp)
-        {
-            wcTmp = get_full_pathW((const wchar_t*)wcPath);
-            wcscpy(wcPath, wcTmp);
-            FREE(wcTmp);
-            wcTmp = NULL;
-        }
+        wcTmp = get_full_pathW((const wchar_t*)wcPath);
+        wcscpy(wcPath, wcTmp);
+        FREE(wcTmp);
+        wcTmp = NULL;
 
         lenPath = (int)wcslen(wcPath);
         if (lenPath - 1 >= 0)
index 1a17631..09da552 100644 (file)
@@ -32,7 +32,15 @@ void CommandHistoryAppendLine (char* _pstLine)
     {
         if (strlen(_pstLine) != 0)
         {
-            CommandHistory::appendLine(getScilabJavaVM(), _pstLine);
+            try
+            {
+                CommandHistory::appendLine(getScilabJavaVM(), _pstLine);
+            }
+            catch (const GiwsException::JniException& e)
+            {
+                // don't do anything, something gets really wrong there!
+                return;
+            }
         }
     }
 }
index b73b6d8..2659abc 100644 (file)
@@ -92,7 +92,7 @@ static types::InternalType* vartosci(types::InternalType* pIT, void* data, const
     {
         case SCSREAL_N:
         {
-            if (~pIT->isDouble())
+            if (!pIT->isDouble())
             {
                 return pIT;
             }
@@ -105,7 +105,7 @@ static types::InternalType* vartosci(types::InternalType* pIT, void* data, const
         }
         case SCSCOMPLEX_N:
         {
-            if (~pIT->isDouble())
+            if (!pIT->isDouble())
             {
                 return pIT;
             }
@@ -119,7 +119,7 @@ static types::InternalType* vartosci(types::InternalType* pIT, void* data, const
         }
         case SCSINT8_N:
         {
-            if (~pIT->isInt8())
+            if (!pIT->isInt8())
             {
                 return pIT;
             }
@@ -132,7 +132,7 @@ static types::InternalType* vartosci(types::InternalType* pIT, void* data, const
         }
         case SCSINT16_N:
         {
-            if (~pIT->isInt16())
+            if (!pIT->isInt16())
             {
                 return pIT;
             }
@@ -145,7 +145,7 @@ static types::InternalType* vartosci(types::InternalType* pIT, void* data, const
         }
         case SCSINT32_N:
         {
-            if (~pIT->isInt32())
+            if (!pIT->isInt32())
             {
                 return pIT;
             }
@@ -158,7 +158,7 @@ static types::InternalType* vartosci(types::InternalType* pIT, void* data, const
         }
         case SCSUINT8_N:
         {
-            if (~pIT->isUInt8())
+            if (!pIT->isUInt8())
             {
                 return pIT;
             }
@@ -171,7 +171,7 @@ static types::InternalType* vartosci(types::InternalType* pIT, void* data, const
         }
         case SCSUINT16_N:
         {
-            if (~pIT->isUInt16())
+            if (!pIT->isUInt16())
             {
                 return pIT;
             }
@@ -184,7 +184,7 @@ static types::InternalType* vartosci(types::InternalType* pIT, void* data, const
         }
         case SCSUINT32_N:
         {
-            if (~pIT->isUInt32())
+            if (!pIT->isUInt32())
             {
                 return pIT;
             }
@@ -578,7 +578,7 @@ types::InternalType* createblklist(const scicos_block* const Blocks, const int f
 /*--------------------------------------------------------------------------*/
 types::InternalType* refreshblklist(types::InternalType* pIT, const scicos_block* const Blocks, const int flag_imp, const int /*funtyp*/)
 {
-    if (~pIT->isTList())
+    if (!pIT->isTList())
     {
         return pIT;
     }