[U-Boot] [PATCH] tools: mkimage: Fixed build warnings

Wolfgang Denk wd at denx.de
Tue Aug 11 22:06:29 CEST 2009


Dear Prafulla Wadaskar,

In message <1249983988-3370-1-git-send-email-prafulla at marvell.com> you wrote:
> uninitialized retval variable warning fixed
> crc32 api moved to crc.h(new) and build warnings fixed

Hm... why are you changing the casts to new variable types?

> +/* lib_generic/crc32.c */
> +uint32_t crc32 (uint32_t, const unsigned char *, uint);
> +uint32_t crc32_wd (uint32_t, const unsigned char *, uint, uint);
> +uint32_t crc32_no_comp (uint32_t, const unsigned char *, uint);

So the prototypes (and the implementation) use "const unsigned char *"
for the second argument.

>  	checksum = crc32 (0,
> -			  (const char *)(ptr + image_get_header_size ()),
> +			  (const uint8_t *)(ptr + image_get_header_size ()),

Why are you changing the type here to "uint8_t"? I would expect to see
"unsigned char".

> -	checksum = crc32 (0, (const char *)hdr, image_get_header_size ());
> +	checksum = crc32 (0, (const uint8_t *)hdr, image_get_header_size ());

Ditto.

> @@ -485,7 +485,7 @@ static int
>  image_verify_header (char *ptr, int image_size)
>  {
>  	int len;
> -	char *data;
> +	uint8_t *data;

Ditto.

>  	uint32_t checksum;
>  	image_header_t header;
>  	image_header_t *hdr = &header;
> @@ -504,7 +504,7 @@ image_verify_header (char *ptr, int image_size)
>  		return -FDT_ERR_BADMAGIC;
>  	}
>  
> -	data = (char *)hdr;
> +	data = (uint8_t *)hdr;
>  	len  = sizeof(image_header_t);
>  
>  	checksum = be32_to_cpu(hdr->ih_hcrc);
> @@ -517,7 +517,7 @@ image_verify_header (char *ptr, int image_size)
>  		return -FDT_ERR_BADSTATE;
>  	}
>  
> -	data = ptr + sizeof(image_header_t);
> +	data = (uint8_t *)ptr + sizeof(image_header_t);

And again and again.

This does not look consistent to me.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
 The software required `Windows 95 or better', so I installed Linux.


More information about the U-Boot mailing list