← Back to team overview

hipl-core team mailing list archive

[Branch ~hipl-core/hipl/trunk] Rev 4897: Do not cast the result of hip_get_next_param() to (struct hip_tlv_common *).

 

------------------------------------------------------------
revno: 4897
committer: Diego Biurrun <diego@xxxxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-08-18 19:57:40 +0200
message:
  Do not cast the result of hip_get_next_param() to (struct hip_tlv_common *).
  
  hip_get_next_param() returns (struct hip_tlv_common *) already.
modified:
  firewall/esp_prot_fw_msg.c
  firewall/midauth.c
  hipd/esp_prot_anchordb.c
  hipd/esp_prot_hipd_msg.c


--
lp:hipl
https://code.launchpad.net/~hipl-core/hipl/trunk

Your team HIPL core team is subscribed to branch lp:hipl.
To unsubscribe from this branch go to https://code.launchpad.net/~hipl-core/hipl/trunk/+edit-subscription
=== modified file 'firewall/esp_prot_fw_msg.c'
--- firewall/esp_prot_fw_msg.c	2010-08-18 16:14:20 +0000
+++ firewall/esp_prot_fw_msg.c	2010-08-18 17:57:40 +0000
@@ -630,7 +630,7 @@
         *hash_item_length = *((uint32_t *) hip_get_param_contents_direct(param));
         HIP_DEBUG("esp protection item length: %u\n", *hash_item_length);
 
-        HIP_IFEL(!(param = (struct hip_tlv_common *) hip_get_next_param(msg, param)),
+        HIP_IFEL(!(param = hip_get_next_param(msg, param)),
                  -1, "transform suggests num_anchors, but it is NOT included in msg\n");
         *num_anchors = *((uint16_t *) hip_get_param_contents_direct(param));
         HIP_DEBUG("esp protection number of transferred anchors: %u\n", *num_anchors);
@@ -646,7 +646,7 @@
                 memcpy(&esp_prot_anchors[i][0], anchor, hash_length);
                 HIP_HEXDUMP("esp protection anchor is ", &esp_prot_anchors[i][0], hash_length);
 
-                HIP_IFEL(!(param = (struct hip_tlv_common *) hip_get_next_param(msg, param)),
+                HIP_IFEL(!(param = hip_get_next_param(msg, param)),
                          -1, "awaiting further anchor, but it is NOT included in msg\n");
             }
         }

=== modified file 'firewall/midauth.c'
--- firewall/midauth.c	2010-07-04 17:54:18 +0000
+++ firewall/midauth.c	2010-08-18 17:57:40 +0000
@@ -286,7 +286,7 @@
     struct hip_tlv_common *i = NULL, *last = NULL;
     hip_tlv_type_t type;
 
-    while ((i = (struct hip_tlv_common *) hip_get_next_param(hip, i))) {
+    while ((i = hip_get_next_param(hip, i))) {
         last = i;
     }
 
@@ -304,7 +304,7 @@
     memcpy(buffer, last, len);
     i = NULL;
 
-    while ((i = (struct hip_tlv_common *) hip_get_next_param(hip, i))) {
+    while ((i = hip_get_next_param(hip, i))) {
         if (hip_get_param_type(i) > type) {
             offset = (char *) i - (char *) hip;
 

=== modified file 'hipd/esp_prot_anchordb.c'
--- hipd/esp_prot_anchordb.c	2010-08-18 16:30:31 +0000
+++ hipd/esp_prot_anchordb.c	2010-08-18 17:57:40 +0000
@@ -134,17 +134,17 @@
             esp_transforms[i] = *(uint8_t *) hip_get_param_contents_direct(param);
             HIP_DEBUG("esp_transform is %u\n", esp_transforms[i]);
 
-            HIP_IFEL(!(param = (struct hip_tlv_common *) hip_get_next_param(msg, param)),
+            HIP_IFEL(!(param = hip_get_next_param(msg, param)),
                      -1, "parameter missing in user-message from fw\n");
             anchor_db.num_anchors[esp_transforms[i]] = *(int *) hip_get_param_contents_direct(param);
             HIP_DEBUG("num_anchors is %i\n", anchor_db.num_anchors[esp_transforms[i]]);
 
-            HIP_IFEL(!(param = (struct hip_tlv_common *) hip_get_next_param(msg, param)),
+            HIP_IFEL(!(param = hip_get_next_param(msg, param)),
                      -1, "parameter missing in user-message from fw\n");
             anchor_db.anchor_lengths[esp_transforms[i]] = *(int *) hip_get_param_contents_direct(param);
             HIP_DEBUG("anchor_length is %i\n", anchor_db.anchor_lengths[esp_transforms[i]]);
 
-            HIP_IFEL(!(param = (struct hip_tlv_common *) hip_get_next_param(msg, param)),
+            HIP_IFEL(!(param = hip_get_next_param(msg, param)),
                      -1, "parameter missing in user-message from fw\n");
         }
 
@@ -171,8 +171,8 @@
 
                 // exclude getting the next param for the very last loop
                 if (!(i == esp_prot_num_transforms - 2 && j == anchor_db.num_anchors[esp_transforms[i]] - 1)) {
-                    HIP_IFEL(!(param = (struct hip_tlv_common *) hip_get_next_param(
-                                   msg, param)), -1, "parameter missing in user-message from fw\n");
+                    HIP_IFEL(!(param = hip_get_next_param(msg, param)),
+                             -1, "parameter missing in user-message from fw\n");
                 }
             }
         }

=== modified file 'hipd/esp_prot_hipd_msg.c'
--- hipd/esp_prot_hipd_msg.c	2010-08-18 16:30:31 +0000
+++ hipd/esp_prot_hipd_msg.c	2010-08-18 17:57:40 +0000
@@ -190,7 +190,7 @@
 
     for (i = 0; i < MAX_NUM_TRANSFORMS; i++) {
         if (i < esp_prot_num_transforms) {
-            param = (struct hip_tlv_common *) hip_get_next_param(msg, param);
+            param = hip_get_next_param(msg, param);
             esp_prot_transforms[i] = *((uint8_t *) hip_get_param_contents_direct(param));
             HIP_DEBUG("esp protection transform %i: %u\n", i + 1, esp_prot_transforms[i]);
         } else {