public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Stephen E. Schweibinz" <plan@mit.edu>
To: gnu-win32@cygnus.com
Cc: jdevans@mit.edu, plan@mit.edu
Subject: TIFF I/O, netpbm
Date: Wed, 28 Oct 1998 23:22:00 -0000	[thread overview]
Message-ID: <199810290228.VAA28025@department-of-alchemy.mit.edu> (raw)

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".

             reply	other threads:[~1998-10-28 23:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-10-28 23:22 Stephen E. Schweibinz [this message]
1998-10-30  5:08 ` Mumit Khan
1998-10-29  9:39 Stephen E. Schweibinz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199810290228.VAA28025@department-of-alchemy.mit.edu \
    --to=plan@mit.edu \
    --cc=gnu-win32@cygnus.com \
    --cc=jdevans@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).