Browse Source

fixed cppcheck findings

stefan 9 months ago
parent
commit
ba09be2d7a
3 changed files with 30 additions and 10 deletions
  1. 25 5
      cfg/cppcheck/cppcheck_suppressions.xml
  2. 2 2
      src/shellmatta.c
  3. 3 3
      src/shellmatta_ymodem.c

+ 25 - 5
cfg/cppcheck/cppcheck_suppressions.xml

@@ -19,11 +19,6 @@
         <fileName>src/shellmatta.c</fileName>
         <symbolName>shellmatta_resetShell</symbolName>
     </suppress>
-    <suppress>
-        <id>unusedFunction</id>
-        <fileName>src/shellmatta.c</fileName>
-        <symbolName>shellmatta_addCmd</symbolName>
-    </suppress>
     <suppress>
         <id>unusedFunction</id>
         <fileName>src/shellmatta.c</fileName>
@@ -44,6 +39,11 @@
         <fileName>src/shellmatta.c</fileName>
         <symbolName>shellmatta_printf</symbolName>
     </suppress>
+    <suppress>
+        <id>unusedFunction</id>
+        <fileName>src/shellmatta.c</fileName>
+        <symbolName>shellmatta_write</symbolName>
+    </suppress>
     <suppress>
         <id>unusedFunction</id>
         <fileName>src/shellmatta_opt.c</fileName>
@@ -69,4 +69,24 @@
         <fileName>src/shellmatta_auth.c</fileName>
         <symbolName>shellmatta_auth_chpasswd</symbolName>
     </suppress>
+    <suppress>
+        <id>unusedFunction</id>
+        <fileName>src/shellmatta_ymodem.c</fileName>
+        <symbolName>shellmatta_ymodem_init</symbolName>
+    </suppress>
+    <suppress>
+        <id>unusedFunction</id>
+        <fileName>src/shellmatta_ymodem.c</fileName>
+        <symbolName>shellmatta_ymodem_pause</symbolName>
+    </suppress>
+    <suppress>
+        <id>unusedFunction</id>
+        <fileName>src/shellmatta_ymodem.c</fileName>
+        <symbolName>shellmatta_ymodem_resume</symbolName>
+    </suppress>
+    <suppress>
+        <id>unusedFunction</id>
+        <fileName>src/shellmatta_ymodem.c</fileName>
+        <symbolName>shellmatta_ymodem_cancel</symbolName>
+    </suppress>
 </suppressions>

+ 2 - 2
src/shellmatta.c

@@ -776,8 +776,8 @@ shellmatta_retCode_t shellmatta_processData(shellmatta_handle_t     handle,
                                             char                    *data,
                                             uint32_t                 size)
 {
-    shellmatta_retCode_t    ret   = SHELLMATTA_OK;
-    shellmatta_instance_t   *inst = (shellmatta_instance_t*)handle;
+    shellmatta_retCode_t        ret   = SHELLMATTA_OK;
+    const shellmatta_instance_t *inst = (shellmatta_instance_t*)handle;
 #ifdef SHELLMATTA_TRANSPORT
     char                    *tmpData;
     uint32_t                tmpSize = 0;

+ 3 - 3
src/shellmatta_ymodem.c

@@ -261,7 +261,7 @@ static shellmatta_retCode_t ymodem_stateMachine(shellmatta_handle_t handle, uint
 shellmatta_retCode_t shellmatta_ymodem_processByte(shellmatta_handle_t handle, char byte)
 {
     shellmatta_instance_t *inst = (shellmatta_instance_t*)handle;
-    shellmatta_retCode_t ret;
+    shellmatta_retCode_t ret = SHELLMATTA_OK;
 
     /** -# check if session is cancelled - accept only if ymodem is between packets */
     if((('\x03' == byte) || (YMODEM_CA == byte)) && (inst->ymodem.state == SHELLMATTA_YMODEM_WAIT_FOR_START))
@@ -476,8 +476,8 @@ shellmatta_retCode_t shellmatta_ymodem_resume(shellmatta_handle_t handle)
 */
 shellmatta_retCode_t shellmatta_ymodem_cancel(shellmatta_handle_t handle, bool doCancel)
 {
-    shellmatta_retCode_t ret = SHELLMATTA_OK;
-    shellmatta_instance_t *inst = (shellmatta_instance_t *)handle;
+    shellmatta_retCode_t        ret = SHELLMATTA_OK;
+    const shellmatta_instance_t *inst = (shellmatta_instance_t *)handle;
 
     /** -# check parameters for plausibility  */
     if(     (NULL               != inst)