AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

1994.02.10 19:32 "LibTIFF working on MS-Windows 3.1.", by Soren Pingel Dalsgaard
1994.02.11 09:39 "Re: LibTIFF working on MS-Windows 3.1.", by Bjorn P. Brox
1994.02.11 01:09 "Re: LibTIFF working on MS-Windows 3.1.", by Richard Minner
1994.02.11 14:40 "Re: LibTIFF working on MS-Windows 3.1.", by Jie Yao
1994.02.11 01:16 "Re: LibTIFF working on MS-Windows 3.1.", by Richard Minner
1994.02.11 10:17 "Re: LIBTIFFW working on MS-Windows 3.1.", by Niles Ritter
1994.02.14 11:03 "Error/warning handlers in libtiff", by Erik Corry
1994.02.16 22:38 "Re: Error/warning handlers in libtiff", by Sam Leffler
1994.02.11 18:27 "Re: LibTIFF working on MS-Windows 3.1.", by Francois Gauthier
1994.02.11 21:29 "Re: LibTIFF working on MS-Windows 3.1.", by Sam Leffler

1994.02.11 14:40 "Re: LibTIFF working on MS-Windows 3.1.", by Jie Yao

Good News! (for some, anyway :-)

I have been toying with LibTIFF for a long time, but three days ago I took a serious look at the problems in generating LZW compressed pictures and other possible obstructions. My boss i paying me to do so, and then we though we would let YOU be beta-testers if you would like.

The following changes has been made to the library:

  • Errors and Warnings are reported in MessageBoxes - not via fprintf.

You should check what the library offers you!

The DEFAULT is to use fprintf.

This is a library, not an application.

The application using the library are free to define it's own error and warnings functions without modifying the library!

RTFM TIFFSetWarningHandler() and TIFFSetErrorHandler() in man/man3/TIFFWarning.3t and man/man3/TIFFError.3t

Example below:

#include <stdarg.h>     /* ANSI variant of varargs */
#include <stdlib.h>

...

static void MY_tiffWarningHandler(const char *module, const char *fmt, ...)
{
    char buf[512];

    va_list args;
    va_start(args, fmt);
    vsprintf(buf, (const char *)fmt, args);
    va_end(args);

    DisplayMessage(WarnType, buf);
}

static void MY_tiffErrorHandler(const char *module, const char *fmt, ...)
{
    char buf[512];

    va_list args;
    va_start(args, fmt);
    vsprintf(buf, (const char *)fmt, args);
    va_end(args);

    DisplayMessage(ErrType, buf);
}

main(int argc, char *argv[])
{
    (void)TIFFSetWarningHandler(MY_tiffWarningHandler);
    (void)TIFFSetErrorHandler(MY_tiffErrorHandler);

...

}

  • TiffPrintDirectory is not available (right now) because it uses fprintf.

Wrong again - this is a library.

The TiffPrintDirectory is used for debug purpose, and you are free to write your own variant - again without modifying the library.

As I remember, when I try to compile libtiff.dll under win 3, I used _WINDOWS and _WINDLL. If they are defeined, stdin, stdout, stderr become undefined. I think Windows 3.1 doesn't have the concept of standard input/output. I think the right fix for now is simply to put these fprintf's inside #ifndef _WINDOWS. The more correct way for libtiff to do, I think, is to have these routines set a variable like TIFFerrno, The library should never report error messages on its own way. If it fails, return a failure. The application then check the error number, and report in what ever way it likes. Currently, in the windows 3.1, we have to set error/warning handler anyway. I think to have them do nothing would be a good idea.

---
Jie Yao jyao@osf.org
Open Software Foundation uunet!osf.org!jyao