diff options
author | Even Rouault <even.rouault@spatialys.com> | 2022-11-13 16:23:21 +0100 |
---|---|---|
committer | Even Rouault <even.rouault@spatialys.com> | 2022-11-21 23:23:23 +0100 |
commit | 21d7dac23f44697c43fb9155c8e746678f0c2a68 (patch) | |
tree | 8e19cd580f0a8d6b4a784c6c89b98b8abfbb333a /libtiff/tiffio.h | |
parent | 352c1a7d03cb12f5bc18d116da6b8c1ab5a281d7 (diff) | |
download | libtiff-git-21d7dac23f44697c43fb9155c8e746678f0c2a68.tar.gz |
Rework TIFFOpenExt() and similar to use an opaque TIFFOpenOptions* opts argument, with alloc, free and setters
Diffstat (limited to 'libtiff/tiffio.h')
-rw-r--r-- | libtiff/tiffio.h | 46 |
1 files changed, 13 insertions, 33 deletions
diff --git a/libtiff/tiffio.h b/libtiff/tiffio.h index 36abdc4d..6523c048 100644 --- a/libtiff/tiffio.h +++ b/libtiff/tiffio.h @@ -465,53 +465,33 @@ extern void TIFFSetWarningHandlerExtR(TIFF*, TIFFErrorHandlerExtR, void* warnhan extern void TIFFWarningExtR(TIFF*, const char*, const char*, ...) TIFF_ATTRIBUTE((__format__ (__printf__,3,4))); extern void TIFFErrorExtR(TIFF*, const char*, const char*, ...) TIFF_ATTRIBUTE((__format__ (__printf__,3,4))); -typedef struct TIFFOpenExtStruct -{ - int version; /* should be set to 1 for now. */ - - TIFFErrorHandlerExtR errorhandler; /* may be NULL */ - void* errorhandler_user_data; /* may be NULL */ - TIFFErrorHandlerExtR warnhandler; /* may be NULL */ - void* warnhandler_user_data; /* may be NULL */ - /* If new fields are added, they should be handled by nVersion == 2 */ -} TIFFOpenExtStruct; +typedef struct TIFFOpenOptions TIFFOpenOptions; +extern TIFFOpenOptions* TIFFOpenOptionsAlloc(void); +extern void TIFFOpenOptionsFree(TIFFOpenOptions*); +extern void TIFFOpenOptionsSetErrorHandlerExtR(TIFFOpenOptions* opts, TIFFErrorHandlerExtR handler, void* errorhandler_user_data); +extern void TIFFOpenOptionsSetWarningHandlerExtR(TIFFOpenOptions* opts, TIFFErrorHandlerExtR handler, void* warnhandler_user_data); extern TIFF* TIFFOpen(const char*, const char*); -extern TIFF* TIFFOpenExt(const char*, const char*, TIFFOpenExtStruct* arguments); +extern TIFF* TIFFOpenExt(const char*, const char*, TIFFOpenOptions* opts); # ifdef __WIN32__ extern TIFF* TIFFOpenW(const wchar_t*, const char*); -extern TIFF* TIFFOpenWExt(const wchar_t*, const char*, TIFFOpenExtStruct* arguments); +extern TIFF* TIFFOpenWExt(const wchar_t*, const char*, TIFFOpenOptions* opts); # endif /* __WIN32__ */ extern TIFF* TIFFFdOpen(int, const char*, const char*); -extern TIFF* TIFFFdOpenExt(int, const char*, const char*, TIFFOpenExtStruct* arguments); +extern TIFF* TIFFFdOpenExt(int, const char*, const char*, TIFFOpenOptions* opts); extern TIFF* TIFFClientOpen(const char*, const char*, thandle_t, TIFFReadWriteProc, TIFFReadWriteProc, TIFFSeekProc, TIFFCloseProc, TIFFSizeProc, TIFFMapFileProc, TIFFUnmapFileProc); - -typedef struct TIFFClientOpenExtStruct -{ - int version; /* should be set to 1 for now. */ - - TIFFReadWriteProc readproc; /* must *NOT* be NULL */ - TIFFReadWriteProc writeproc; /* must *NOT* be NULL */ - TIFFSeekProc seekproc; /* must *NOT* be NULL */ - TIFFCloseProc closeproc; /* must *NOT* be NULL */ - TIFFSizeProc sizeproc; /* must *NOT* be NULL */ - TIFFMapFileProc mapproc; /* may be NULL */ - TIFFUnmapFileProc unmapproc; /* may be NULL */ - TIFFErrorHandlerExtR errorhandler; /* may be NULL */ - void* errorhandler_user_data; /* may be NULL */ - TIFFErrorHandlerExtR warnhandler; /* may be NULL */ - void* warnhandler_user_data; /* may be NULL */ - /* If new fields are added, they should be handled by nVersion == 2 */ -} TIFFClientOpenExtStruct; - extern TIFF* TIFFClientOpenExt(const char*, const char*, thandle_t, - TIFFClientOpenExtStruct* arguments); + TIFFReadWriteProc, TIFFReadWriteProc, + TIFFSeekProc, TIFFCloseProc, + TIFFSizeProc, + TIFFMapFileProc, TIFFUnmapFileProc, + TIFFOpenOptions* opts); extern TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc); extern uint32_t TIFFComputeTile(TIFF* tif, uint32_t x, uint32_t y, uint32_t z, uint16_t s); extern int TIFFCheckTile(TIFF* tif, uint32_t x, uint32_t y, uint32_t z, uint16_t s); |