← Back to team overview

hipl-core team mailing list archive

Re: [Branch ~hipl-core/hipl/trunk] Rev 4888: Fixed 'cast discards qualifiers' warnings in hip_get_next_param()

 

On Wed, Aug 18, 2010 at 01:53:21PM +0000, noreply@xxxxxxxxxxxxx wrote:
> message:
>   Fixed 'cast discards qualifiers' warnings in hip_get_next_param()
>   
>   Since the message to iterate through is passed as a const pointer, the return value must be const as well. Fixing this necessitated a large number of additional const declarations. I added *_readwrite() versions of the functions also used in ways that require a non-const return.

Could you please write your log messages in an editor and break the
long lines?  Thank you..

>   Also set the warning to be treated as an error.

This could have been done in a separate commit.

> --- firewall/cache.c	2010-07-19 16:15:46 +0000
> +++ firewall/cache.c	2010-08-18 13:51:12 +0000
> @@ -132,7 +133,7 @@
>  
> -    while ((current_param = hip_get_next_param(msg, current_param)) != NULL) {
> +    while ((current_param = hip_get_next_param(msg, current_param))) {

unrelated --> separate commit

> --- firewall/conntrack.c	2010-07-29 08:31:12 +0000
> +++ firewall/conntrack.c	2010-08-18 13:51:12 +0000
> @@ -799,14 +799,14 @@
>   * @return zero on success and non-zero on error
>   */
>  static int hipfw_handle_relay_to_r2(const struct hip_common *common,
> -                                 const hip_fw_context_t *ctx)
> +                                    const hip_fw_context_t *ctx)

unrelated cosmetics

> @@ -899,8 +899,7 @@
>  
>      // handling HOST_ID param
> -    HIP_IFEL(!(host_id = (struct hip_host_id *) hip_get_param(common,
> -                                                              HIP_PARAM_HOST_ID)),
> +    HIP_IFEL(!(host_id = hip_get_param(common, HIP_PARAM_HOST_ID)),

unrelated pointless cast removal

> @@ -974,12 +973,11 @@
>  
> -    HIP_IFEL(!(spi = (struct hip_esp_info *) hip_get_param(common,
> -                                                           HIP_PARAM_ESP_INFO)),
> -                                                           0, "no spi found\n");
> +    HIP_IFEL(!(spi = hip_get_param(common,HIP_PARAM_ESP_INFO)),
> +             0, "no spi found\n");

space after comma

>      // might not be there in case of BLIND
> -    host_id = (struct hip_host_id *) hip_get_param(common, HIP_PARAM_HOST_ID);
> +    host_id = hip_get_param(common, HIP_PARAM_HOST_ID);

unrelated

> @@ -1070,14 +1068,14 @@
>  
> -    HIP_IFEL(!(spi = (struct hip_esp_info *) hip_get_param(common, HIP_PARAM_ESP_INFO)),
> +    HIP_IFEL(!(spi = hip_get_param(common, HIP_PARAM_ESP_INFO)),
>               0, "no spi found\n");

again

> @@ -1262,21 +1260,21 @@
>  
>      /* get params from UPDATE message */
> -    seq      = (struct hip_seq *) hip_get_param(common, HIP_PARAM_SEQ);
> -    esp_info = (struct hip_esp_info *) hip_get_param(common, HIP_PARAM_ESP_INFO);
> -    ack      = (struct hip_ack *) hip_get_param(common, HIP_PARAM_ACK);
> -    locator  = (struct hip_locator *) hip_get_param(common, HIP_PARAM_LOCATOR);
> -    spi      = (struct hip_spi *) hip_get_param(common, HIP_PARAM_ESP_INFO);
> +    seq      = hip_get_param(common, HIP_PARAM_SEQ);
> +    esp_info = hip_get_param(common, HIP_PARAM_ESP_INFO);
> +    ack      = hip_get_param(common, HIP_PARAM_ACK);
> +    locator  = hip_get_param(common, HIP_PARAM_LOCATOR);
> +    spi      = hip_get_param(common, HIP_PARAM_ESP_INFO);

more of the same

> --- firewall/esp_prot_conntrack.c	2010-07-04 17:54:18 +0000
> +++ firewall/esp_prot_conntrack.c	2010-08-18 13:51:12 +0000
> @@ -1018,29 +1018,29 @@
>  
>      // get params from UPDATE message
> -    seq = (struct hip_seq *) hip_get_param(common, HIP_PARAM_SEQ);
> -    ack = (struct hip_ack *) hip_get_param(common, HIP_PARAM_ACK);
> +    seq = hip_get_param(common, HIP_PARAM_SEQ);
> +    ack = hip_get_param(common, HIP_PARAM_ACK);

yet again


I could continue reviewing this, but it's pointless.
The commit should be reverted and split properly.

Diego



Follow ups

References