PATCH: dlls/cabinet/cabextract.c and off_t

Greg Turner gmturner007 at ameritech.net
Thu Dec 26 21:44:23 CST 2002


On Thursday 26 December 2002 02:48 pm, Gerald Pfeifer 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.
>
> Gerald
>
>
> ChangeLog:
> #include <sys/types.h> to obtain off_t.

actually I don't think we really want to use off_t.  The relationship to 
off_t is historical: cabextract (the unix executable, which I ported) 
used off_t because it used the fopen/fseek/fgetpos/etc family of 
functions.  Wanting to depend only on kernel32, I ported these to use 
windowsy api's like CreateFile/SetFilePointer/etc, which take LONG 
arguments, IIRC.

My memory on this is already a bit hazy, but I think I created cab_off_t 
to save myself keystrokes -- I basically was able to go through much of 
the code and just turn "off_t"'s into "cab_off_t"'s.  Initially I tried 
to support huge (64 bit offset) files -- cab_off_t was going to be a 
struct with two LONGS -- but later I decided I was too lazy, since this 
would have required a substantial reworking of the logic, some of which 
I didn't even take the time to fully understand.

There's a fair amount of math in there and in some places off_t's got 
passed around, converted to other types, etc.... so I decided I should 
bang out the port first and worry about the finer details later.

The easy version of the right fix is probably just to rename "cab_off_t" 
to something less confusing (i.e., cab_file_offset).  The fancy fix 
would be to support huge files, which might be a bit of a project.

-- 
gmt

"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