PATCH: dlls/cabinet/cabextract.c and off_t

Greg Turner gmturner007 at
Fri Dec 27 15:06:38 CST 2002

On Friday 27 December 2002 01:49 pm, Gerald Pfeifer wrote:
> On Fri, 27 Dec 2002, Greg Turner wrote:
> >>>> If we really want to use off_t in this file (instead of
> >>>> cab_off_t) we need to #include sys/types.h, or we'll break
> >>>> non-Linux systems.
> >>
> >> Short to medium term, do you agree with my fix (#include
> >> <sys/types.h>) so that Wine also builds on non-Linux systems?
> >
> > Maybe.  I don't object, since it should be harmless to add this,
> > but I seem to be missing the point of why sys/types.h is needed at
> > all. cab_off_t is just typedef'ed to UINT32, which should compile
> > just fine with only winnt.h, I think.  Is there a particular
> > scenario you are encountering that fails?  If so, what is the
> > compile error?
> The following line is the problem:
>  fol->offset[0]  = base_offset + (off_t)
> EndGetI32(buf+cffold_DataOffset); ^^^^^
> Here we use off_t (which requires sys/types.h), that's why I wrote
> "If we really want to use off_t in this file.  Should this simply
> become cab_off_t?

Bingo.  Although I never formally grepped for it, I made every attempt 
to convert all off_t's to cab_off_t's or signed integers as 
appropriate.  So, yes, this is most certainly an error on my part, and 
your fix is likely the correct one.  Out of curiosity, what is your 
platform?  I am slightly surprised that off_t compiles at all without 
sys/types.h, even on linux... 

Would you be so kind as to change that to cab_off_t, and then run the 
compile again to make sure that we've really eliminated all the off_t's 
in there?  Let me know your results and I will submit a patch including 
this, and the renaming I discussed before.

A random thought: It's notable, that cab_off_t is unsigned, whereas 
off_t is signed.  I began, but did not finish, the process of pouring 
over the source to ensure this is a nonissue.  Perhaps, I might sleep 
easier if I just turned it back to a signed INT32, although if I 
recall, I used to think I had a good reason not to do that.  Before I 
submit I'll take a look at that once more, as well.

Thanks for spotting this,


"It does not take a majority to prevail ... but rather an irate,
tireless minority, keen on setting brushfires of freedom in the
minds of men." --Samuel Adams, Patriot

More information about the wine-devel mailing list