From 95b63bcf4dfbc28630ee68784f7619b34c1db30b Mon Sep 17 00:00:00 2001 From: root Date: Fri, 9 May 2008 12:42:50 +0000 Subject: *** empty log message *** --- Changes | 7 ++++--- lzf_c.c | 13 ++++++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Changes b/Changes index af394fb..37d2d32 100644 --- a/Changes +++ b/Changes @@ -1,7 +1,8 @@ - - include a workaround for a compiler bug on 64 bit windows - (microsoft claims to support POSIX, but is far from it). - (analysed nicely by John Lilley). +3.2 + - include a workaround for failing POSIX and real-world compliance + on 64 bit windows (microsoft claims to support POSIX, but is far + from it). (bug found and analysed nicely by John Lilley). 3.1 Fri Nov 30 11:33:04 CET 2007 - IMPORTANT BUGFIX: a too long final literal run would corrupt data diff --git a/lzf_c.c b/lzf_c.c index 268313a..c1847f3 100644 --- a/lzf_c.c +++ b/lzf_c.c @@ -113,12 +113,19 @@ lzf_compress (const void *const in_data, unsigned int in_len, u8 *out_end = op + out_len; const u8 *ref; - unsigned int hval; -#if WIN32 - unsigned _int64 off; /* workaround for microsoft bug (they claim to support POSIX) */ + /* off requires a type wide enough to hold a general pointer difference. + * ISO C doesn't have that (size_t might not be enough and ptrdiff_t only + * works for differences within a single object). We also assume that no + * no bit pattern traps. Since the only platform that is both non-POSIX + * and fails to support both assumptions is windows 64 bit, we make a + * special workaround for it. + */ +#if defined (WIN32) && defined (_M_X64) + unsigned _int64 off; /* workaround for missing POSIX compliance */ #else unsigned long off; #endif + unsigned int hval; int lit; if (!in_len || !out_len) -- cgit v1.2.3