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*


Hello Alan and thanks for answering

OK, to make it more simple - this will also work and is maybe better:

chunk_nread = cache_bread_1(abfd, (void*)((char*)buf + nread), chunk_size);


Attached patch file with new suggestion

thanks
Jerker Bäck


> -----Original Message-----
> From: binutils-owner@sourceware.org [mailto:binutils-owner@sourceware.org]
> On Behalf Of Alan Modra
> Sent: Sunday, March 01, 2009 12:33 AM
> To: Jerker Bäck
> Cc: binutils@sourceware.org
> Subject: 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

Attachment: bfd_cache.patch
Description: Binary data


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