2007.12.31 17:03 "Re: [Tiff] libtiff4 - 64-bit problems", by Edward Lam

Hi Folks,

This morning I updated to libtiff CVS HEAD and found some problems when trying to compile on my MSVC 2005 (x64) tool chain. I'll be sending out separate emails for those issues I should raise in general. For the specific changes I managed to make, I'm sending to Frank directly since he's graciously offered to check them.

Looking at tif_unix.c now that it is used by default on Windows, it appears that it's using the low-level file i/o functions that won't support 64-bit file sizes because the size arguments on Windows for read()/write() are still unsigned int. We might want to give a warning for this somewhere that tif_win32.c should be used if one wishes to use bigtiff's on Windows?

It also appears that many of the tools (bmp2tiff, tiffdump, tiff2pdf, tiff2ps, tiffcp, tiffcrop) are not 64-bit safe as there are many conversion warnings. I tried to fix some of these warnings where it was safe and easy.

In particular, note that something like this is NOT 64-bit safe:

     tmsize_t foo = 1 << ((int32)bit_shift);

This is because the RHS will only be a 32-bit result and can never be 64-bit.

Finally, several of the tools (bmp2tiff, tiffdump, fax2ps, raw2tiff) are not 64-bit safe because they use the low-level file i/o functions directly which presents problems on Windows because its C run time library hasn't been updated or has different API. I don't have an easy solution to this but I figure I should raise it just in case.

Regards,

-Edward