OLD | NEW |
1 /* $Id: tiffiop.h,v 1.84 2012-05-30 01:50:17 fwarmerdam Exp $ */ | 1 /* $Id: tiffiop.h,v 1.87 2015-08-23 17:49:01 bfriesen Exp $ */ |
2 | 2 |
3 /* | 3 /* |
4 * Copyright (c) 1988-1997 Sam Leffler | 4 * Copyright (c) 1988-1997 Sam Leffler |
5 * Copyright (c) 1991-1997 Silicon Graphics, Inc. | 5 * Copyright (c) 1991-1997 Silicon Graphics, Inc. |
6 * | 6 * |
7 * Permission to use, copy, modify, distribute, and sell this software and | 7 * Permission to use, copy, modify, distribute, and sell this software and |
8 * its documentation for any purpose is hereby granted without fee, provided | 8 * its documentation for any purpose is hereby granted without fee, provided |
9 * that (i) the above copyright notices and this permission notice appear in | 9 * that (i) the above copyright notices and this permission notice appear in |
10 * all copies of the software and related documentation, and (ii) the names of | 10 * all copies of the software and related documentation, and (ii) the names of |
11 * Sam Leffler and Silicon Graphics may not be used in any advertising or | 11 * Sam Leffler and Silicon Graphics may not be used in any advertising or |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 # define assert(x) | 50 # define assert(x) |
51 #endif | 51 #endif |
52 | 52 |
53 #ifdef HAVE_SEARCH_H | 53 #ifdef HAVE_SEARCH_H |
54 # include <search.h> | 54 # include <search.h> |
55 #else | 55 #else |
56 extern void *lfind(const void *, const void *, size_t *, size_t, | 56 extern void *lfind(const void *, const void *, size_t *, size_t, |
57 int (*)(const void *, const void *)); | 57 int (*)(const void *, const void *)); |
58 #endif | 58 #endif |
59 | 59 |
| 60 #if !defined(HAVE_SNPRINTF) && !defined(HAVE__SNPRINTF) |
| 61 #undef snprintf |
| 62 #define snprintf _TIFF_snprintf_f |
| 63 extern int snprintf(char* str, size_t size, const char* format, ...); |
| 64 #endif |
| 65 |
60 #include "tiffio.h" | 66 #include "tiffio.h" |
61 | 67 |
62 #include "tif_dir.h" | 68 #include "tif_dir.h" |
63 | 69 |
64 #ifndef STRIP_SIZE_DEFAULT | 70 #ifndef STRIP_SIZE_DEFAULT |
65 # define STRIP_SIZE_DEFAULT 8192 | 71 # define STRIP_SIZE_DEFAULT 8192 |
66 #endif | 72 #endif |
67 | 73 |
68 #define streq(a,b) (strcmp(a,b) == 0) | 74 #define streq(a,b) (strcmp(a,b) == 0) |
69 | 75 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 #define TIFFroundup_64(x, y) (TIFFhowmany_64(x,y)*(y)) | 257 #define TIFFroundup_64(x, y) (TIFFhowmany_64(x,y)*(y)) |
252 | 258 |
253 /* Safe multiply which returns zero if there is an integer overflow */ | 259 /* Safe multiply which returns zero if there is an integer overflow */ |
254 #define TIFFSafeMultiply(t,v,m) ((((t)(m) != (t)0) && (((t)(((v)*(m))/(m))) == (
t)(v))) ? (t)((v)*(m)) : (t)0) | 260 #define TIFFSafeMultiply(t,v,m) ((((t)(m) != (t)0) && (((t)(((v)*(m))/(m))) == (
t)(v))) ? (t)((v)*(m)) : (t)0) |
255 | 261 |
256 #define TIFFmax(A,B) ((A)>(B)?(A):(B)) | 262 #define TIFFmax(A,B) ((A)>(B)?(A):(B)) |
257 #define TIFFmin(A,B) ((A)<(B)?(A):(B)) | 263 #define TIFFmin(A,B) ((A)<(B)?(A):(B)) |
258 | 264 |
259 #define TIFFArrayCount(a) (sizeof (a) / sizeof ((a)[0])) | 265 #define TIFFArrayCount(a) (sizeof (a) / sizeof ((a)[0])) |
260 | 266 |
| 267 /* |
| 268 Support for large files. |
| 269 |
| 270 Windows read/write APIs support only 'unsigned int' rather than 'size_t'. |
| 271 Windows off_t is only 32-bit, even in 64-bit builds. |
| 272 */ |
| 273 #if defined(HAVE_FSEEKO) |
| 274 /* |
| 275 Use fseeko() and ftello() if they are available since they use |
| 276 'off_t' rather than 'long'. It is wrong to use fseeko() and |
| 277 ftello() only on systems with special LFS support since some systems |
| 278 (e.g. FreeBSD) support a 64-bit off_t by default. |
| 279 |
| 280 For MinGW, __MSVCRT_VERSION__ must be at least 0x800 to expose these |
| 281 interfaces. The MinGW compiler must support the requested version. MinGW |
| 282 does not distribute the CRT (it is supplied by Microsoft) so the correct CRT |
| 283 must be available on the target computer in order for the program to run. |
| 284 */ |
| 285 #if defined(HAVE_FSEEKO) |
| 286 # define fseek(stream,offset,whence) fseeko(stream,offset,whence) |
| 287 # define ftell(stream,offset,whence) ftello(stream,offset,whence) |
| 288 #endif |
| 289 #endif |
| 290 #if defined(__WIN32__) && \ |
| 291 !(defined(_MSC_VER) && _MSC_VER < 1400) && \ |
| 292 !(defined(__MSVCRT_VERSION__) && __MSVCRT_VERSION__ < 0x800) |
| 293 typedef unsigned int TIFFIOSize_t; |
| 294 #define _TIFF_lseek_f(fildes,offset,whence) _lseeki64(fildes,/* __int64 */ offs
et,whence) |
| 295 /* #define _TIFF_tell_f(fildes) /\* __int64 *\/ _telli64(fildes) */ |
| 296 #define _TIFF_fseek_f(stream,offset,whence) _fseeki64(stream,/* __int64 */ offse
t,whence) |
| 297 #define _TIFF_fstat_f(fildes,stat_buff) _fstati64(fildes,/* struct _stati64 */ s
tat_buff) |
| 298 /* #define _TIFF_ftell_f(stream) /\* __int64 *\/ _ftelli64(stream) */ |
| 299 /* #define _TIFF_stat_f(path,stat_buff) _stati64(path,/\* struct _stati64 *\/ st
at_buff) */ |
| 300 #define _TIFF_stat_s struct _stati64 |
| 301 #define _TIFF_off_t __int64 |
| 302 #else |
| 303 typedef size_t TIFFIOSize_t; |
| 304 #define _TIFF_lseek_f(fildes,offset,whence) lseek(fildes,offset,whence) |
| 305 /* #define _TIFF_tell_f(fildes) (_TIFF_lseek_f(fildes,0,SEEK_CUR)) */ |
| 306 #define _TIFF_fseek_f(stream,offset,whence) fseek(stream,offset,whence) |
| 307 #define _TIFF_fstat_f(fildes,stat_buff) fstat(fildes,stat_buff) |
| 308 /* #define _TIFF_ftell_f(stream) ftell(stream) */ |
| 309 /* #define _TIFF_stat_f(path,stat_buff) stat(path,stat_buff) */ |
| 310 #define _TIFF_stat_s struct stat |
| 311 #define _TIFF_off_t off_t |
| 312 #endif |
| 313 |
261 #if defined(__cplusplus) | 314 #if defined(__cplusplus) |
262 extern "C" { | 315 extern "C" { |
263 #endif | 316 #endif |
264 extern int _TIFFgetMode(const char* mode, const char* module); | 317 extern int _TIFFgetMode(const char* mode, const char* module); |
265 extern int _TIFFNoRowEncode(TIFF* tif, uint8* pp, tmsize_t cc, uint16 s); | 318 extern int _TIFFNoRowEncode(TIFF* tif, uint8* pp, tmsize_t cc, uint16 s); |
266 extern int _TIFFNoStripEncode(TIFF* tif, uint8* pp, tmsize_t cc, uint16 s); | 319 extern int _TIFFNoStripEncode(TIFF* tif, uint8* pp, tmsize_t cc, uint16 s); |
267 extern int _TIFFNoTileEncode(TIFF*, uint8* pp, tmsize_t cc, uint16 s); | 320 extern int _TIFFNoTileEncode(TIFF*, uint8* pp, tmsize_t cc, uint16 s); |
268 extern int _TIFFNoRowDecode(TIFF* tif, uint8* pp, tmsize_t cc, uint16 s); | 321 extern int _TIFFNoRowDecode(TIFF* tif, uint8* pp, tmsize_t cc, uint16 s); |
269 extern int _TIFFNoStripDecode(TIFF* tif, uint8* pp, tmsize_t cc, uint16 s); | 322 extern int _TIFFNoStripDecode(TIFF* tif, uint8* pp, tmsize_t cc, uint16 s); |
270 extern int _TIFFNoTileDecode(TIFF*, uint8* pp, tmsize_t cc, uint16 s); | 323 extern int _TIFFNoTileDecode(TIFF*, uint8* pp, tmsize_t cc, uint16 s); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 #endif /* _TIFFIOP_ */ | 411 #endif /* _TIFFIOP_ */ |
359 | 412 |
360 /* vim: set ts=8 sts=8 sw=8 noet: */ | 413 /* vim: set ts=8 sts=8 sw=8 noet: */ |
361 /* | 414 /* |
362 * Local Variables: | 415 * Local Variables: |
363 * mode: c | 416 * mode: c |
364 * c-basic-offset: 8 | 417 * c-basic-offset: 8 |
365 * fill-column: 78 | 418 * fill-column: 78 |
366 * End: | 419 * End: |
367 */ | 420 */ |
OLD | NEW |