[Libpst-devel] size_t fields
Chris Halls
chris.halls at credativ.co.uk
Tue Jan 30 14:35:11 CET 2007
Hi Bernhard
Thanks a lot for forwarding your mail! Actually, this was also reported in
tracker #304314, and I applied that patch in revision 78. It's not released
but you should find it is fixed in svn trunk.
Chris
On Tuesday 30 January 2007 12:17, you wrote:
> Hi Chris,
>
> quite some time ago, I too had problems with occurences
> of size_t in the header file. I am not an C guru and
> quickly hacked the header to compile OK under cygwin.
>
> I sent my changes to Joseph back then and include them
> again here as an attachment. Last year it was very very
> quiet on th emailing list ...
>
> regards
> --
> Bernhard Treutwein, IuK, Ref. III A 3
> Bernhard.Treutwein(at)verwaltung uni-muenchen de
>
> > -----Original Message-----
> > From: Chris Halls [mailto:chris.halls at credativ.co.uk]
> > Sent: Monday, January 29, 2007 9:00 PM
> > To: libpst-devel at lists.alioth.debian.org
> > Subject: [Libpst-devel] size_t fields
> >
> >
> > Hi
> >
> > We have a problem with the attachment->size field. It's a 32
> > bit integer in
> > the PST file but is a size_t in libpst.h. That means on a 64
> > bit machine you
> > have difference sizes when doing a memcpy of size sizeof(size_t).
> >
> > To fix this we can either change the size field to be of type
> > int32_t or
> > convert to 64 bit when setting the field. I reckon it is
> > better to keep the
> > size_t field and do the conversion when reading the PST file:
> >
> > - memcpy(&(attach->size), list->items[x]->data,
> > - sizeof(attach->size));
> > + t = (*(int32_t*)list->items[x]->data);
> > + LE32_CPU(t);
> > + attach->size = t;
> >
> > That way we keep the original ABI, the size_t field is the
> > preferred type for
> > the processor and we have room for expansion later should it
> > become possible
> > to attach files > 2GB in the future.
> >
> > I've checked in this fix on r86, along with some other memory
> > management fixes
> > for errors that valgrind picked up.
> >
> > There are a few more size_t fields in libpst.h so I guess we
> > might need to do
> > a similar thing there too.
> >
> > Chris
More information about the Libpst-devel
mailing list