This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch for bfd/cache.c - explicit cast to void*


On Sat, Feb 28, 2009 at 07:46:53PM +0100, Jerker Bäck wrote:
> I suggest the attached patch to bfd/cache.c.
> 
> 
> This patch gives explicit cast from integer value to void*.
> 
> -chunk_nread = cache_bread_1(abfd, (char*)buf + nread, chunk_size);
> +chunk_nread = cache_bread_1(abfd, (void*)((file_ptr)buf + nread),
> chunk_size);
> 
> My compiler refuse to compile the current source - just to make it work.

I don't see why you need this.  "buf" is a void *,
"(char *) buf + nread" is a char *, which should be acceptable as a
void * parameter to cache_bread_1 without an explicit case.  In fact,
adding a file_ptr cast might well introduce a warning about casting
a pointer to a different size integer.

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]