Fix compilation warning/error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Mon, 18 Jun 2018 12:17:07 +0300
changeset 2190 b7d803fc44db
parent 2189 49a6738b7c63
child 2191 b579e2155d02
Fix compilation warning/error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
targets/plc_debug.c
--- a/targets/plc_debug.c	Mon Jun 18 12:12:57 2018 +0300
+++ b/targets/plc_debug.c	Mon Jun 18 12:17:07 2018 +0300
@@ -61,7 +61,7 @@
 typedef void(*__for_each_variable_do_fp)(dbgvardsc_t*);
 void __for_each_variable_do(__for_each_variable_do_fp fp)
 {
-    int i;
+    unsigned int i;
     for(i = 0; i < sizeof(dbgvardsc)/sizeof(dbgvardsc_t); i++){
         dbgvardsc_t *dsc = &dbgvardsc[i];
         if(dsc->type != UNKNOWN_ENUM) 
@@ -299,7 +299,7 @@
              *(((__IEC_##TYPENAME##_p *)varp)->value) = *((TYPENAME *)force);\
             }\
             break;
-void RegisterDebugVariable(int idx, void* force)
+void RegisterDebugVariable(unsigned int idx, void* force)
 {
     if(idx  < sizeof(dbgvardsc)/sizeof(dbgvardsc_t)){
         unsigned char flags = force ?