/* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. */ #include "tiffiop.h" #include <limits.h> /* * Dummy functions to fill the omitted client procedures. */ static int _tiffDummyMapProc(thandle_t fd, void **pbase, toff_t *psize) { … } static void _tiffDummyUnmapProc(thandle_t fd, void *base, toff_t size) { … } int _TIFFgetMode(TIFFOpenOptions *opts, thandle_t clientdata, const char *mode, const char *module) { … } TIFFOpenOptions *TIFFOpenOptionsAlloc() { … } void TIFFOpenOptionsFree(TIFFOpenOptions *opts) { … } /** Define a limit in bytes for a single memory allocation done by libtiff. * If max_single_mem_alloc is set to 0, no other limit that the underlying * _TIFFmalloc() will be applied, which is the default. */ void TIFFOpenOptionsSetMaxSingleMemAlloc(TIFFOpenOptions *opts, tmsize_t max_single_mem_alloc) { … } void TIFFOpenOptionsSetErrorHandlerExtR(TIFFOpenOptions *opts, TIFFErrorHandlerExtR handler, void *errorhandler_user_data) { … } void TIFFOpenOptionsSetWarningHandlerExtR(TIFFOpenOptions *opts, TIFFErrorHandlerExtR handler, void *warnhandler_user_data) { … } static void _TIFFEmitErrorAboveMaxSingleMemAlloc(TIFF *tif, const char *pszFunction, tmsize_t s) { … } /** malloc() version that takes into account memory-specific open options */ void *_TIFFmallocExt(TIFF *tif, tmsize_t s) { … } /** calloc() version that takes into account memory-specific open options */ void *_TIFFcallocExt(TIFF *tif, tmsize_t nmemb, tmsize_t siz) { … } /** realloc() version that takes into account memory-specific open options */ void *_TIFFreallocExt(TIFF *tif, void *p, tmsize_t s) { … } /** free() version that takes into account memory-specific open options */ void _TIFFfreeExt(TIFF *tif, void *p) { … } TIFF *TIFFClientOpen(const char *name, const char *mode, thandle_t clientdata, TIFFReadWriteProc readproc, TIFFReadWriteProc writeproc, TIFFSeekProc seekproc, TIFFCloseProc closeproc, TIFFSizeProc sizeproc, TIFFMapFileProc mapproc, TIFFUnmapFileProc unmapproc) { … } TIFF *TIFFClientOpenExt(const char *name, const char *mode, thandle_t clientdata, TIFFReadWriteProc readproc, TIFFReadWriteProc writeproc, TIFFSeekProc seekproc, TIFFCloseProc closeproc, TIFFSizeProc sizeproc, TIFFMapFileProc mapproc, TIFFUnmapFileProc unmapproc, TIFFOpenOptions *opts) { … } /* * Query functions to access private data. */ /* * Return open file's name. */ const char *TIFFFileName(TIFF *tif) { … } /* * Set the file name. */ const char *TIFFSetFileName(TIFF *tif, const char *name) { … } /* * Return open file's I/O descriptor. */ int TIFFFileno(TIFF *tif) { … } /* * Set open file's I/O descriptor, and return previous value. */ int TIFFSetFileno(TIFF *tif, int fd) { … } /* * Return open file's clientdata. */ thandle_t TIFFClientdata(TIFF *tif) { … } /* * Set open file's clientdata, and return previous value. */ thandle_t TIFFSetClientdata(TIFF *tif, thandle_t newvalue) { … } /* * Return read/write mode. */ int TIFFGetMode(TIFF *tif) { … } /* * Return read/write mode. */ int TIFFSetMode(TIFF *tif, int mode) { … } /* * Return nonzero if file is organized in * tiles; zero if organized as strips. */ int TIFFIsTiled(TIFF *tif) { … } /* * Return current row being read/written. */ uint32_t TIFFCurrentRow(TIFF *tif) { … } /* * Return index of the current directory. */ tdir_t TIFFCurrentDirectory(TIFF *tif) { … } /* * Return current strip. */ uint32_t TIFFCurrentStrip(TIFF *tif) { … } /* * Return current tile. */ uint32_t TIFFCurrentTile(TIFF *tif) { … } /* * Return nonzero if the file has byte-swapped data. */ int TIFFIsByteSwapped(TIFF *tif) { … } /* * Return nonzero if the data is returned up-sampled. */ int TIFFIsUpSampled(TIFF *tif) { … } /* * Return nonzero if the data is returned in MSB-to-LSB bit order. */ int TIFFIsMSB2LSB(TIFF *tif) { … } /* * Return nonzero if given file was written in big-endian order. */ int TIFFIsBigEndian(TIFF *tif) { … } /* * Return nonzero if given file is BigTIFF style. */ int TIFFIsBigTIFF(TIFF *tif) { … } /* * Return pointer to file read method. */ TIFFReadWriteProc TIFFGetReadProc(TIFF *tif) { … } /* * Return pointer to file write method. */ TIFFReadWriteProc TIFFGetWriteProc(TIFF *tif) { … } /* * Return pointer to file seek method. */ TIFFSeekProc TIFFGetSeekProc(TIFF *tif) { … } /* * Return pointer to file close method. */ TIFFCloseProc TIFFGetCloseProc(TIFF *tif) { … } /* * Return pointer to file size requesting method. */ TIFFSizeProc TIFFGetSizeProc(TIFF *tif) { … } /* * Return pointer to memory mapping method. */ TIFFMapFileProc TIFFGetMapFileProc(TIFF *tif) { … } /* * Return pointer to memory unmapping method. */ TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF *tif) { … }