AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
September 2006

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2006.09.21 16:30 "Re: TIFF file bigger than 2Go (Pallek, Bernie: #CIPO - OPIC)", by Phil Harvey
2006.09.22 03:56 "Re: TIFF file bigger than 2Go (Pallek, Bernie: #CIPO - OPIC)", by Graeme Gill
2006.09.22 16:43 "Re: TIFF file bigger than 2Go (Pallek, Bernie: #CIPO - OPIC)", by Bernie Pallek

2006.09.22 03:56 "Re: TIFF file bigger than 2Go (Pallek, Bernie: #CIPO - OPIC)", by Graeme Gill

Phil Harvey wrote:

> The application I'm developing can't seek past 2GB in a file because the 
> seek() library function takes a signed 4-byte integer.  I think this is 
> a common problem.  I can read larger files (so a >4GB JPEG image isn't a 
> problem for instance), but due to the TIFF structure, you have to be 
> able to seek to an arbitrary point in the file.  So the limit is 2GB.  
> Placing IFD0 first would help, but any data starting after the 2GB point 
> still couldn't be read.

It seems like you might be able to create a fake "seek to unsigned 32 bit offset"

function by doing a signed SEEK_SET to 2G, followed by a SEEK_CUR of the next 2G ?

ie., something like:

int fuseek(FILE *fp, unsigned long offset) {
	int rv;
	unsigned long offset;

	if (offset > LONG_MAX) {
		if ((rv = fseek(fp, LONG_MAX, SEEK_SET)) != 0)
			return rv;
		return fseek(fp, offset - LONG_MAX, SEEK_CUR);
	} else
		return fseek(fp, offset, SEEK_SET);
}

(although note this doesn't handle the one case where offset = ULONG_MAX)

Graeme Gill.