This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

TIFF I/O, netpbm



Thanks for the response concerning my question about
"undefined reference to 'errno'."  As it turned out
the problem was in fact that

>(the problem) is because of non-ANSI behaviour in lots of old code 
>where instead of include errno.h, the code declares an 
>"extern int errno" which is wrong.

The "netpbm" graphics utilities suite compiled fine after the change.

**********************************************************************

However, I have run into difficulty getting the TIFF I/O utilities
to work.  I am running a program called tiffcut.c that inputs a TIFF
image and outputs a clipped TIFF given your clipping parameters.


After drilling down through the code I finally found the unix like i/o
calls in tif_unix.c.

/*
 * Open a TIFF file for read/writing.
 */
TIFF*
TIFFOpen(const char* name, const char* mode)
{
	static const char module[] = "TIFFOpen";
	int m, fd;

	m = _TIFFgetMode(mode, module);
	if (m == -1)
		return ((TIFF*)0);
#ifdef _AM29K
	fd = open(name, m);
/*I added the following line to open the tiff in binary form*/
	setmode(fd, O_BINARY);


 
#else
	fd = open(name, m, 0666);
/*I added the following line to open the tiff in binary form*/
	setmode(fd, O_BINARY);

#endif
	if (fd < 0) {
		TIFFError(module, "%s: Cannot open", name);
		return ((TIFF *)0);
	}
	return (TIFFFdOpen(fd, name, mode));
}

I checked the archives of the Gnu-Win32 mailing list and found that
I needed to add "setmode(fd, O_BINARY)" (which I did above)
for the open statement to properly read in the binary TIFF.  
This got rid of the error
"Can not read TIFF directory."

However the output TIFF file cannot be opened properly in a viewer.
I have a feeling I need to add the following

setmode(fileno(stdout), O_BINARY);

where the output of the TIFF is occuring, but I am not sure where
I should stick this line or if this is even the problem.  

If anyone using netpbm and the libtiff utilities has come across
porting problems inputing and outputing TIFFs using the libtiff
included in netpbm,  please let me know your solutions.

Thanks much,
Stephen Schweibinz
__________
/*******************************************************

   Stephen E. Schweibinz
   Planning Support Systems Group, MCP candidate, MIT
   (617) 679-0360
   plan@mit.edu
   http://www.vcp.com

*******************************************************/


















-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]