Przeglądaj źródła

Use unsigned type for number of connectable objects constant.

Also replaced iterator types used in conjunction with this constant
as size_t isn't really appropriate here. Resolves signed/unsigned
comparison warnings, e.g., Visual Studio C4018.
Jason Valenzuela 4 lat temu
rodzic
commit
a585e30f46
1 zmienionych plików z 4 dodań i 4 usunięć
  1. 4 4
      source/src/cip/cipconnectionmanager.c

+ 4 - 4
source/src/cip/cipconnectionmanager.c

@@ -32,8 +32,8 @@
 const size_t g_kForwardOpenHeaderLength = 36; /**< the length in bytes of the forward open command specific data till the start of the connection path (including con path size)*/
 const size_t g_kLargeForwardOpenHeaderLength = 40; /**< the length in bytes of the large forward open command specific data till the start of the connection path (including con path size)*/
 
-static const int g_kNumberOfConnectableObjects = 2 +
-                                                 OPENER_CIP_NUM_APPLICATION_SPECIFIC_CONNECTABLE_OBJECTS;
+static const unsigned int g_kNumberOfConnectableObjects = 2 +
+                                                          OPENER_CIP_NUM_APPLICATION_SPECIFIC_CONNECTABLE_OBJECTS;
 
 typedef struct {
   EipUint32 class_id;
@@ -1720,7 +1720,7 @@ EipStatus AddConnectableObject(const CipUdint class_code,
   EipStatus status = kEipStatusError;
 
   /*parsing is now finished all data is available and check now establish the connection */
-  for(size_t i = 0; i < g_kNumberOfConnectableObjects; ++i) {
+  for(unsigned int i = 0; i < g_kNumberOfConnectableObjects; ++i) {
     if( (0 == g_connection_management_list[i].class_id) ||
         (class_code == g_connection_management_list[i].class_id) ) {
       g_connection_management_list[i].class_id = class_code;
@@ -1739,7 +1739,7 @@ GetConnectionManagementEntry(const EipUint32 class_id) {
 
   ConnectionManagementHandling *connection_management_entry = NULL;
 
-  for(size_t i = 0; i < g_kNumberOfConnectableObjects; ++i) {
+  for(unsigned int i = 0; i < g_kNumberOfConnectableObjects; ++i) {
     if(class_id == g_connection_management_list[i].class_id) {
       connection_management_entry = &(g_connection_management_list[i]);
       break;