[sr-dev] git:master:2a2780cb: call_obj: fix compile warning, size_t is unsigned int on 32 bit architectures

Daniel-Constantin Mierla miconda at gmail.com
Wed Sep 25 15:26:09 CEST 2019


I think the casts have to be to (unsigned long) not only to (long),
otherwise the compilers will give warning on sign mismatch.

Cheers,
Daniel

On 25.09.19 14:57, Henning Westerholt wrote:
> Module: kamailio
> Branch: master
> Commit: 2a2780cb6b043baca964db19b45c46d9d9adc754
> URL: https://github.com/kamailio/kamailio/commit/2a2780cb6b043baca964db19b45c46d9d9adc754
>
> Author: Henning Westerholt <hw at skalatan.de>
> Committer: Henning Westerholt <hw at skalatan.de>
> Date: 2019-09-25T14:19:21+02:00
>
> call_obj: fix compile warning, size_t is unsigned int on 32 bit architectures
>
> ---
>
> Modified: src/modules/call_obj/cobj.c
>
> ---
>
> Diff:  https://github.com/kamailio/kamailio/commit/2a2780cb6b043baca964db19b45c46d9d9adc754.diff
> Patch: https://github.com/kamailio/kamailio/commit/2a2780cb6b043baca964db19b45c46d9d9adc754.patch
>
> ---
>
> diff --git a/src/modules/call_obj/cobj.c b/src/modules/call_obj/cobj.c
> index be16c2c76a..1d513ded77 100644
> --- a/src/modules/call_obj/cobj.c
> +++ b/src/modules/call_obj/cobj.c
> @@ -112,15 +112,15 @@ int cobj_init(int start, int end)
>  	
>  	size_t total_size = (1 + end - start); /* [start, end] */
>  	size_t array_size = total_size * sizeof(co_object_t);
> -	LM_DBG("Element size: %lu\n", sizeof(co_object_t));
> -	LM_DBG("List element size: %lu\n", sizeof(cobj_elem_t));
> +	LM_DBG("Element size: %lu\n", (long)sizeof(co_object_t));
> +	LM_DBG("List element size: %lu\n", (long)sizeof(cobj_elem_t));
>  	
>  	co_data->ring = (co_object_t*)shm_malloc(array_size);
>  	if (!co_data->ring) {
>  		LM_ERR("Cannot allocate shm memory for ring in call object\n");
>  		return -1;
>  	}
> -	LM_DBG("Allocated %lu bytes for the ring\n", array_size);
> +	LM_DBG("Allocated %lu bytes for the ring\n", (long)array_size);
>  
>  	/*
>  	 * Initialize lock.
>
>
> _______________________________________________
> Kamailio (SER) - Development Mailing List
> sr-dev at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training, Oct 21-23, 2019, Berlin, Germany -- https://asipto.com/u/kat




More information about the sr-dev mailing list