Coverity #1098338, #1099164, #1099173 fixed 31/18431/2
Dhruv Khattar [Tue, 9 Aug 2016 11:20:34 +0000 (16:20 +0530)]
Change-Id: I856154489f8fcf6df6dc5202e36217d7674c0a48

scilab/modules/console/src/c/cmdLine/autoCompletionCli.c
scilab/modules/console/src/c/cmdLine/gotoFunctions.c

index 29e65d4..c85ca93 100644 (file)
@@ -107,11 +107,8 @@ static void doCompletion(char **wk_buf, unsigned int *cursor, unsigned int *curs
         TermCompletionOnAll(LineBeforeCaret, LineAfterCaret, SearchedPattern, wk_buf, cursor, cursor_max);
     }
 
-    if (LineBeforeCaret)
-    {
-        FREE(LineBeforeCaret);
-        LineBeforeCaret = NULL;
-    }
+    FREE(LineBeforeCaret);
+    LineBeforeCaret = NULL;
     if (LineAfterCaret)
     {
         FREE(LineAfterCaret);
@@ -317,7 +314,7 @@ static int CopyLineAtPrompt(char **wk_buf, char *line, unsigned int *cursor, uns
         FREE(wtmp);
 
         /* erase extra characters left over if any */
-        erase_nchar(GET_MAX(0, (*cursor_max - *cursor)));
+        erase_nchar(GET_MAX(0, (int)(*cursor_max - *cursor)));
         *cursor_max = *cursor;
         return 1;
     }
index 9e43637..bafb7f6 100644 (file)
@@ -154,10 +154,7 @@ int gotoLeft(wchar_t * CommandLine, unsigned int *cursorLocation)
             {
                 setStringCapacities("up");
                 i--;
-                if (CommandLine != NULL)
-                {
-                    *cursorLocation = i;
-                }
+                *cursorLocation = i;
                 return i;
             }
             /* If the cursor will move to a previous line separated by L'\n' */