[Libpst-devel] size_t fields

Treutwein Bernhard Bernhard.Treutwein at Verwaltung.Uni-Muenchen.DE
Tue Jan 30 13:17:29 CET 2007


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
> 
> 
> 
-------------- next part --------------
An embedded message was scrubbed...
From: "Treutwein Bernhard" <Bernhard.Treutwein at Verwaltung.Uni-Muenchen.DE>
Subject: RE: Status LibPST ?
Date: Fri, 17 Feb 2006 14:50:02 +0100
Size: 2420
Url: http://lists.alioth.debian.org/pipermail/libpst-devel/attachments/20070130/7743cc77/attachment.mht


More information about the Libpst-devel mailing list