Bsoft  1.9
Bernard's software package
tif_open.c
Go to the documentation of this file.
1 /* $Id: tif_open.c,v 1.33.2.1 2010-06-08 18:50:42 bfriesen Exp $ */
2 
3 /*
4  * Copyright (c) 1988-1997 Sam Leffler
5  * Copyright (c) 1991-1997 Silicon Graphics, Inc.
6  *
7  * Permission to use, copy, modify, distribute, and sell this software and
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
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
12  * publicity relating to the software without the specific, prior written
13  * permission of Sam Leffler and Silicon Graphics.
14  *
15  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
16  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
17  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
18  *
19  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
20  * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
21  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
22  * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
23  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
24  * OF THIS SOFTWARE.
25  */
26 
27 /*
28  * TIFF Library.
29  */
30 #include "tiffiop.h"
31 
32 static const long typemask[13] = {
33  (long)0L, /* TIFF_NOTYPE */
34  (long)0x000000ffL, /* TIFF_BYTE */
35  (long)0xffffffffL, /* TIFF_ASCII */
36  (long)0x0000ffffL, /* TIFF_SHORT */
37  (long)0xffffffffL, /* TIFF_LONG */
38  (long)0xffffffffL, /* TIFF_RATIONAL */
39  (long)0x000000ffL, /* TIFF_SBYTE */
40  (long)0x000000ffL, /* TIFF_UNDEFINED */
41  (long)0x0000ffffL, /* TIFF_SSHORT */
42  (long)0xffffffffL, /* TIFF_SLONG */
43  (long)0xffffffffL, /* TIFF_SRATIONAL */
44  (long)0xffffffffL, /* TIFF_FLOAT */
45  (long)0xffffffffL, /* TIFF_DOUBLE */
46 };
47 static const int bigTypeshift[13] = {
48  0, /* TIFF_NOTYPE */
49  24, /* TIFF_BYTE */
50  0, /* TIFF_ASCII */
51  16, /* TIFF_SHORT */
52  0, /* TIFF_LONG */
53  0, /* TIFF_RATIONAL */
54  24, /* TIFF_SBYTE */
55  24, /* TIFF_UNDEFINED */
56  16, /* TIFF_SSHORT */
57  0, /* TIFF_SLONG */
58  0, /* TIFF_SRATIONAL */
59  0, /* TIFF_FLOAT */
60  0, /* TIFF_DOUBLE */
61 };
62 static const int litTypeshift[13] = {
63  0, /* TIFF_NOTYPE */
64  0, /* TIFF_BYTE */
65  0, /* TIFF_ASCII */
66  0, /* TIFF_SHORT */
67  0, /* TIFF_LONG */
68  0, /* TIFF_RATIONAL */
69  0, /* TIFF_SBYTE */
70  0, /* TIFF_UNDEFINED */
71  0, /* TIFF_SSHORT */
72  0, /* TIFF_SLONG */
73  0, /* TIFF_SRATIONAL */
74  0, /* TIFF_FLOAT */
75  0, /* TIFF_DOUBLE */
76 };
77 
78 /*
79  * Dummy functions to fill the omitted client procedures.
80  */
81 static int
82 _tiffDummyMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)
83 {
84  (void) fd; (void) pbase; (void) psize;
85  return (0);
86 }
87 
88 static void
89 _tiffDummyUnmapProc(thandle_t fd, tdata_t base, toff_t size)
90 {
91  (void) fd; (void) base; (void) size;
92 }
93 
94 /*
95  * Initialize the shift & mask tables, and the
96  * byte swapping state according to the file
97  * contents and the machine architecture.
98  */
99 static void
100 TIFFInitOrder(TIFF* tif, int magic, int bigendian)
101 {
102  tif->tif_typemask = typemask;
103  if (magic == TIFF_BIGENDIAN) {
104  tif->tif_typeshift = bigTypeshift;
105  if (!bigendian)
106  tif->tif_flags |= TIFF_SWAB;
107  } else {
108  tif->tif_typeshift = litTypeshift;
109  if (bigendian)
110  tif->tif_flags |= TIFF_SWAB;
111  }
112 }
113 
114 int
115 _TIFFgetMode(const char* mode, const char* module)
116 {
117  int m = -1;
118 
119  switch (mode[0]) {
120  case 'r':
121  m = O_RDONLY;
122  if (mode[1] == '+')
123  m = O_RDWR;
124  break;
125  case 'w':
126  case 'a':
127  m = O_RDWR|O_CREAT;
128  if (mode[0] == 'w')
129  m |= O_TRUNC;
130  break;
131  default:
132  TIFFErrorExt(0, module, "\"%s\": Bad mode", mode);
133  break;
134  }
135  return (m);
136 }
137 
138 TIFF*
140  const char* name, const char* mode,
141  thandle_t clientdata,
142  TIFFReadWriteProc readproc,
143  TIFFReadWriteProc writeproc,
144  TIFFSeekProc seekproc,
145  TIFFCloseProc closeproc,
146  TIFFSizeProc sizeproc,
147  TIFFMapFileProc mapproc,
148  TIFFUnmapFileProc unmapproc
149 )
150 {
151  static const char module[] = "TIFFClientOpen";
152  TIFF *tif;
153  int m, bigendian;
154  const char* cp;
155 
156  m = _TIFFgetMode(mode, module);
157  if (m == -1)
158  goto bad2;
159  tif = (TIFF *)_TIFFmalloc(sizeof (TIFF) + strlen(name) + 1);
160  if (tif == NULL) {
161  TIFFErrorExt(clientdata, module, "%s: Out of memory (TIFF structure)", name);
162  goto bad2;
163  }
164  _TIFFmemset(tif, 0, sizeof (*tif));
165  tif->tif_name = (char *)tif + sizeof (TIFF);
166  strcpy(tif->tif_name, name);
167  tif->tif_mode = m &~ (O_CREAT|O_TRUNC);
168  tif->tif_curdir = (tdir_t) -1; /* non-existent directory */
169  tif->tif_curoff = 0;
170  tif->tif_curstrip = (tstrip_t) -1; /* invalid strip */
171  tif->tif_row = (uint32) -1; /* read/write pre-increment */
172  tif->tif_clientdata = clientdata;
173  if (!readproc || !writeproc || !seekproc || !closeproc || !sizeproc) {
174  TIFFErrorExt(clientdata, module,
175  "One of the client procedures is NULL pointer.");
176  goto bad2;
177  }
178  tif->tif_readproc = readproc;
179  tif->tif_writeproc = writeproc;
180  tif->tif_seekproc = seekproc;
181  tif->tif_closeproc = closeproc;
182  tif->tif_sizeproc = sizeproc;
183  if (mapproc)
184  tif->tif_mapproc = mapproc;
185  else
186  tif->tif_mapproc = _tiffDummyMapProc;
187  if (unmapproc)
188  tif->tif_unmapproc = unmapproc;
189  else
190  tif->tif_unmapproc = _tiffDummyUnmapProc;
191  _TIFFSetDefaultCompressionState(tif); /* setup default state */
192  /*
193  * Default is to return data MSB2LSB and enable the
194  * use of memory-mapped files and strip chopping when
195  * a file is opened read-only.
196  */
198  if (m == O_RDONLY )
199  tif->tif_flags |= TIFF_MAPPED;
200 
201 #ifdef STRIPCHOP_DEFAULT
202  if (m == O_RDONLY || m == O_RDWR)
204 #endif
205 
206  { union { int32 i; char c[4]; } u; u.i = 1; bigendian = u.c[0] == 0; }
207  /*
208  * Process library-specific flags in the open mode string.
209  * The following flags may be used to control intrinsic library
210  * behaviour that may or may not be desirable (usually for
211  * compatibility with some application that claims to support
212  * TIFF but only supports some braindead idea of what the
213  * vendor thinks TIFF is):
214  *
215  * 'l' use little-endian byte order for creating a file
216  * 'b' use big-endian byte order for creating a file
217  * 'L' read/write information using LSB2MSB bit order
218  * 'B' read/write information using MSB2LSB bit order
219  * 'H' read/write information using host bit order
220  * 'M' enable use of memory-mapped files when supported
221  * 'm' disable use of memory-mapped files
222  * 'C' enable strip chopping support when reading
223  * 'c' disable strip chopping support
224  * 'h' read TIFF header only, do not load the first IFD
225  *
226  * The use of the 'l' and 'b' flags is strongly discouraged.
227  * These flags are provided solely because numerous vendors,
228  * typically on the PC, do not correctly support TIFF; they
229  * only support the Intel little-endian byte order. This
230  * support is not configured by default because it supports
231  * the violation of the TIFF spec that says that readers *MUST*
232  * support both byte orders. It is strongly recommended that
233  * you not use this feature except to deal with busted apps
234  * that write invalid TIFF. And even in those cases you should
235  * bang on the vendors to fix their software.
236  *
237  * The 'L', 'B', and 'H' flags are intended for applications
238  * that can optimize operations on data by using a particular
239  * bit order. By default the library returns data in MSB2LSB
240  * bit order for compatibiltiy with older versions of this
241  * library. Returning data in the bit order of the native cpu
242  * makes the most sense but also requires applications to check
243  * the value of the FillOrder tag; something they probably do
244  * not do right now.
245  *
246  * The 'M' and 'm' flags are provided because some virtual memory
247  * systems exhibit poor behaviour when large images are mapped.
248  * These options permit clients to control the use of memory-mapped
249  * files on a per-file basis.
250  *
251  * The 'C' and 'c' flags are provided because the library support
252  * for chopping up large strips into multiple smaller strips is not
253  * application-transparent and as such can cause problems. The 'c'
254  * option permits applications that only want to look at the tags,
255  * for example, to get the unadulterated TIFF tag information.
256  */
257  for (cp = mode; *cp; cp++)
258  switch (*cp) {
259  case 'b':
260  if ((m&O_CREAT) && !bigendian)
261  tif->tif_flags |= TIFF_SWAB;
262  break;
263  case 'l':
264  if ((m&O_CREAT) && bigendian)
265  tif->tif_flags |= TIFF_SWAB;
266  break;
267  case 'B':
268  tif->tif_flags = (tif->tif_flags &~ TIFF_FILLORDER) |
270  break;
271  case 'L':
272  tif->tif_flags = (tif->tif_flags &~ TIFF_FILLORDER) |
274  break;
275  case 'H':
276  tif->tif_flags = (tif->tif_flags &~ TIFF_FILLORDER) |
278  break;
279  case 'M':
280  if (m == O_RDONLY)
281  tif->tif_flags |= TIFF_MAPPED;
282  break;
283  case 'm':
284  if (m == O_RDONLY)
285  tif->tif_flags &= ~TIFF_MAPPED;
286  break;
287  case 'C':
288  if (m == O_RDONLY)
289  tif->tif_flags |= TIFF_STRIPCHOP;
290  break;
291  case 'c':
292  if (m == O_RDONLY)
293  tif->tif_flags &= ~TIFF_STRIPCHOP;
294  break;
295  case 'h':
296  tif->tif_flags |= TIFF_HEADERONLY;
297  break;
298  }
299  /*
300  * Read in TIFF header.
301  */
302  if (tif->tif_mode & O_TRUNC ||
303  !ReadOK(tif, &tif->tif_header, sizeof (TIFFHeader))) {
304  if (tif->tif_mode == O_RDONLY) {
305  TIFFErrorExt(tif->tif_clientdata, name,
306  "Cannot read TIFF header");
307  goto bad;
308  }
309  /*
310  * Setup header and write.
311  */
313  ? (bigendian ? TIFF_LITTLEENDIAN : TIFF_BIGENDIAN)
314  : (bigendian ? TIFF_BIGENDIAN : TIFF_LITTLEENDIAN);
316  if (tif->tif_flags & TIFF_SWAB)
318  tif->tif_header.tiff_diroff = 0; /* filled in later */
319 
320 
321  /*
322  * The doc for "fopen" for some STD_C_LIBs says that if you
323  * open a file for modify ("+"), then you must fseek (or
324  * fflush?) between any freads and fwrites. This is not
325  * necessary on most systems, but has been shown to be needed
326  * on Solaris.
327  */
328  TIFFSeekFile( tif, 0, SEEK_SET );
329 
330  if (!WriteOK(tif, &tif->tif_header, sizeof (TIFFHeader))) {
331  TIFFErrorExt(tif->tif_clientdata, name,
332  "Error writing TIFF header");
333  goto bad;
334  }
335  /*
336  * Setup the byte order handling.
337  */
338  TIFFInitOrder(tif, tif->tif_header.tiff_magic, bigendian);
339  /*
340  * Setup default directory.
341  */
342  if (!TIFFDefaultDirectory(tif))
343  goto bad;
344  tif->tif_diroff = 0;
345  tif->tif_dirlist = NULL;
346  tif->tif_dirlistsize = 0;
347  tif->tif_dirnumber = 0;
348  return (tif);
349  }
350  /*
351  * Setup the byte order handling.
352  */
353  if (tif->tif_header.tiff_magic != TIFF_BIGENDIAN &&
355 #if MDI_SUPPORT
356  &&
357 #if HOST_BIGENDIAN
359 #else
361 #endif
362  ) {
363  TIFFErrorExt(tif->tif_clientdata, name,
364  "Not a TIFF or MDI file, bad magic number %d (0x%x)",
365 #else
366  ) {
367  TIFFErrorExt(tif->tif_clientdata, name,
368  "Not a TIFF file, bad magic number %d (0x%x)",
369 #endif
370  tif->tif_header.tiff_magic,
371  tif->tif_header.tiff_magic);
372  goto bad;
373  }
374  TIFFInitOrder(tif, tif->tif_header.tiff_magic, bigendian);
375  /*
376  * Swap header if required.
377  */
378  if (tif->tif_flags & TIFF_SWAB) {
381  }
382  /*
383  * Now check version (if needed, it's been byte-swapped).
384  * Note that this isn't actually a version number, it's a
385  * magic number that doesn't change (stupid).
386  */
388  TIFFErrorExt(tif->tif_clientdata, name,
389  "This is a BigTIFF file. This format not supported\n"
390  "by this version of libtiff." );
391  goto bad;
392  }
393  if (tif->tif_header.tiff_version != TIFF_VERSION) {
394  TIFFErrorExt(tif->tif_clientdata, name,
395  "Not a TIFF file, bad version number %d (0x%x)",
397  tif->tif_header.tiff_version);
398  goto bad;
399  }
400  tif->tif_flags |= TIFF_MYBUFFER;
401  tif->tif_rawcp = tif->tif_rawdata = 0;
402  tif->tif_rawdatasize = 0;
403 
404  /*
405  * Sometimes we do not want to read the first directory (for example,
406  * it may be broken) and want to proceed to other directories. I this
407  * case we use the TIFF_HEADERONLY flag to open file and return
408  * immediately after reading TIFF header.
409  */
410  if (tif->tif_flags & TIFF_HEADERONLY)
411  return (tif);
412 
413  /*
414  * Setup initial directory.
415  */
416  switch (mode[0]) {
417  case 'r':
419  /*
420  * Try to use a memory-mapped file if the client
421  * has not explicitly suppressed usage with the
422  * 'm' flag in the open mode (see above).
423  */
424  if ((tif->tif_flags & TIFF_MAPPED) &&
425  !TIFFMapFileContents(tif, (tdata_t*) &tif->tif_base, &tif->tif_size))
426  tif->tif_flags &= ~TIFF_MAPPED;
427  if (TIFFReadDirectory(tif)) {
428  tif->tif_rawcc = -1;
429  tif->tif_flags |= TIFF_BUFFERSETUP;
430  return (tif);
431  }
432  break;
433  case 'a':
434  /*
435  * New directories are automatically append
436  * to the end of the directory chain when they
437  * are written out (see TIFFWriteDirectory).
438  */
439  if (!TIFFDefaultDirectory(tif))
440  goto bad;
441  return (tif);
442  }
443 bad:
444  tif->tif_mode = O_RDONLY; /* XXX avoid flush */
445  TIFFCleanup(tif);
446 bad2:
447  return ((TIFF*)0);
448 }
449 
450 /*
451  * Query functions to access private data.
452  */
453 
454 /*
455  * Return open file's name.
456  */
457 const char *
459 {
460  return (tif->tif_name);
461 }
462 
463 /*
464  * Set the file name.
465  */
466 const char *
467 TIFFSetFileName(TIFF* tif, const char *name)
468 {
469  const char* old_name = tif->tif_name;
470  tif->tif_name = (char *)name;
471  return (old_name);
472 }
473 
474 /*
475  * Return open file's I/O descriptor.
476  */
477 int
479 {
480  return (tif->tif_fd);
481 }
482 
483 /*
484  * Set open file's I/O descriptor, and return previous value.
485  */
486 int
487 TIFFSetFileno(TIFF* tif, int fd)
488 {
489  int old_fd = tif->tif_fd;
490  tif->tif_fd = fd;
491  return old_fd;
492 }
493 
494 /*
495  * Return open file's clientdata.
496  */
497 thandle_t
499 {
500  return (tif->tif_clientdata);
501 }
502 
503 /*
504  * Set open file's clientdata, and return previous value.
505  */
506 thandle_t
508 {
509  thandle_t m = tif->tif_clientdata;
510  tif->tif_clientdata = newvalue;
511  return m;
512 }
513 
514 /*
515  * Return read/write mode.
516  */
517 int
519 {
520  return (tif->tif_mode);
521 }
522 
523 /*
524  * Return read/write mode.
525  */
526 int
527 TIFFSetMode(TIFF* tif, int mode)
528 {
529  int old_mode = tif->tif_mode;
530  tif->tif_mode = mode;
531  return (old_mode);
532 }
533 
534 /*
535  * Return nonzero if file is organized in
536  * tiles; zero if organized as strips.
537  */
538 int
540 {
541  return (isTiled(tif));
542 }
543 
544 /*
545  * Return current row being read/written.
546  */
547 uint32
549 {
550  return (tif->tif_row);
551 }
552 
553 /*
554  * Return index of the current directory.
555  */
556 tdir_t
558 {
559  return (tif->tif_curdir);
560 }
561 
562 /*
563  * Return current strip.
564  */
565 tstrip_t
567 {
568  return (tif->tif_curstrip);
569 }
570 
571 /*
572  * Return current tile.
573  */
574 ttile_t
576 {
577  return (tif->tif_curtile);
578 }
579 
580 /*
581  * Return nonzero if the file has byte-swapped data.
582  */
583 int
585 {
586  return ((tif->tif_flags & TIFF_SWAB) != 0);
587 }
588 
589 /*
590  * Return nonzero if the data is returned up-sampled.
591  */
592 int
594 {
595  return (isUpSampled(tif));
596 }
597 
598 /*
599  * Return nonzero if the data is returned in MSB-to-LSB bit order.
600  */
601 int
603 {
604  return (isFillOrder(tif, FILLORDER_MSB2LSB));
605 }
606 
607 /*
608  * Return nonzero if given file was written in big-endian order.
609  */
610 int
612 {
613  return (tif->tif_header.tiff_magic == TIFF_BIGENDIAN);
614 }
615 
616 /*
617  * Return pointer to file read method.
618  */
621 {
622  return (tif->tif_readproc);
623 }
624 
625 /*
626  * Return pointer to file write method.
627  */
630 {
631  return (tif->tif_writeproc);
632 }
633 
634 /*
635  * Return pointer to file seek method.
636  */
639 {
640  return (tif->tif_seekproc);
641 }
642 
643 /*
644  * Return pointer to file close method.
645  */
648 {
649  return (tif->tif_closeproc);
650 }
651 
652 /*
653  * Return pointer to file size requesting method.
654  */
657 {
658  return (tif->tif_sizeproc);
659 }
660 
661 /*
662  * Return pointer to memory mapping method.
663  */
666 {
667  return (tif->tif_mapproc);
668 }
669 
670 /*
671  * Return pointer to memory unmapping method.
672  */
675 {
676  return (tif->tif_unmapproc);
677 }
678 
679 /* vim: set ts=8 sts=8 sw=8 noet: */
680 /*
681  * Local Variables:
682  * mode: c
683  * c-basic-offset: 8
684  * fill-column: 78
685  * End:
686  */
TIFFSeekProc tif_seekproc
Definition: tiffiop.h:188
int TIFFSetMode(TIFF *tif, int mode)
Definition: tif_open.c:527
void * tdata_t
Definition: tiffio.h:68
#define MDI_SUPPORT
Definition: tif_config.h:176
int(* TIFFCloseProc)(thandle_t)
Definition: tiffio.h:265
int TIFFReadDirectory(TIFF *tif)
Definition: tif_dirread.c:74
tstrip_t tif_curstrip
Definition: tiffiop.h:141
thandle_t TIFFSetClientdata(TIFF *tif, thandle_t newvalue)
Definition: tif_open.c:507
tstrip_t TIFFCurrentStrip(TIFF *tif)
Definition: tif_open.c:566
TIFFCloseProc TIFFGetCloseProc(TIFF *tif)
Definition: tif_open.c:647
#define TIFF_STRIPCHOP
Definition: tiffiop.h:121
TIFFUnmapFileProc tif_unmapproc
Definition: tiffiop.h:183
const char * TIFFSetFileName(TIFF *tif, const char *name)
Definition: tif_open.c:467
#define WriteOK(tif, buf, size)
Definition: tiffiop.h:234
#define TIFFSeekFile(tif, off, whence)
Definition: tiffiop.h:211
#define HOST_BIGENDIAN
Definition: port.h:15
#define FILLORDER_LSB2MSB
Definition: tiff.h:220
tidata_t tif_rawdata
Definition: tiffiop.h:174
int TIFFIsMSB2LSB(TIFF *tif)
Definition: tif_open.c:602
toff_t tif_curoff
Definition: tiffiop.h:142
tstrile_t tstrip_t
Definition: tiffio.h:65
thandle_t tif_clientdata
Definition: tiffiop.h:185
#define isUpSampled(tif)
Definition: tiffiop.h:206
char * tif_name
Definition: tiffiop.h:103
Definition: tiffiop.h:102
void TIFFCleanup(TIFF *tif)
Definition: tif_close.c:46
#define TIFF_HEADERONLY
Definition: tiffiop.h:122
int tif_fd
Definition: tiffiop.h:104
uint32 TIFFCurrentRow(TIFF *tif)
Definition: tif_open.c:548
#define TIFF_SWAB
Definition: tiffiop.h:113
int TIFFIsBigEndian(TIFF *tif)
Definition: tif_open.c:611
toff_t tif_size
Definition: tiffiop.h:180
TIFFReadWriteProc TIFFGetWriteProc(TIFF *tif)
Definition: tif_open.c:629
toff_t(* TIFFSeekProc)(thandle_t, toff_t, int)
Definition: tiffio.h:264
void(* TIFFUnmapFileProc)(thandle_t, tdata_t, toff_t)
Definition: tiffio.h:268
toff_t(* TIFFSizeProc)(thandle_t)
Definition: tiffio.h:266
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)
Definition: tif_open.c:139
tidata_t tif_rawcp
Definition: tiffiop.h:176
int tif_mode
Definition: tiffiop.h:105
uint32 tif_flags
Definition: tiffiop.h:106
tidata_t tif_base
Definition: tiffiop.h:179
TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF *tif)
Definition: tif_open.c:674
uint16 tiff_version
Definition: tiff.h:98
TIFFSizeProc TIFFGetSizeProc(TIFF *tif)
Definition: tif_open.c:656
#define TIFFMapFileContents(tif, paddr, psize)
Definition: tiffiop.h:217
TIFFMapFileProc tif_mapproc
Definition: tiffiop.h:182
#define MDI_BIGENDIAN
Definition: tiff.h:54
#define SEEK_SET
Definition: jmemansi.c:26
tstrile_t ttile_t
Definition: tiffio.h:66
#define TIFF_FILLORDER
Definition: tiffiop.h:107
tdir_t tif_curdir
Definition: tiffiop.h:140
void TIFFSwabShort(uint16 *wp)
Definition: tif_swab.c:36
#define TIFF_BIGENDIAN
Definition: tiff.h:51
tsize_t(* TIFFReadWriteProc)(thandle_t, tdata_t, tsize_t)
Definition: tiffio.h:263
ttile_t TIFFCurrentTile(TIFF *tif)
Definition: tif_open.c:575
TIFFSeekProc TIFFGetSeekProc(TIFF *tif)
Definition: tif_open.c:638
uint16 tiff_magic
Definition: tiff.h:96
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
Definition: tif_error.c:63
tsize_t tif_rawdatasize
Definition: tiffiop.h:175
int(* TIFFMapFileProc)(thandle_t, tdata_t *, toff_t *)
Definition: tiffio.h:267
#define TIFF_VERSION
Definition: tiff.h:48
tsize_t tif_rawcc
Definition: tiffiop.h:177
uint16 tif_dirnumber
Definition: tiffiop.h:132
TIFFReadWriteProc TIFFGetReadProc(TIFF *tif)
Definition: tif_open.c:620
TIFFHeader tif_header
Definition: tiffiop.h:136
toff_t * tif_dirlist
Definition: tiffiop.h:129
TIFFReadWriteProc tif_readproc
Definition: tiffiop.h:186
#define TIFF_BIGTIFF_VERSION
Definition: tiff.h:49
TIFFSizeProc tif_sizeproc
Definition: tiffiop.h:190
void _TIFFmemset(tdata_t p, int v, tsize_t c)
Definition: tif_acorn.c:479
void _TIFFSetDefaultCompressionState(TIFF *tif)
Definition: tif_compress.c:129
#define isTiled(tif)
Definition: tiffiop.h:203
TIFFCloseProc tif_closeproc
Definition: tiffiop.h:189
#define TIFF_BUFFERSETUP
Definition: tiffiop.h:110
TIFFMapFileProc TIFFGetMapFileProc(TIFF *tif)
Definition: tif_open.c:665
int TIFFGetMode(TIFF *tif)
Definition: tif_open.c:518
TIFFReadWriteProc tif_writeproc
Definition: tiffiop.h:187
#define TIFF_MAPPED
Definition: tiffiop.h:117
uint32 tif_row
Definition: tiffiop.h:139
int TIFFIsByteSwapped(TIFF *tif)
Definition: tif_open.c:584
void TIFFSwabLong(uint32 *lp)
Definition: tif_swab.c:47
#define TIFF_LITTLEENDIAN
Definition: tiff.h:52
int _TIFFgetMode(const char *mode, const char *module)
Definition: tif_open.c:115
ttile_t tif_curtile
Definition: tiffiop.h:149
uint32 toff_t
Definition: tiffio.h:69
tsize_t tif_dirlistsize
Definition: tiffiop.h:131
#define isFillOrder(tif, o)
Definition: tiffiop.h:205
const char * TIFFFileName(TIFF *tif)
Definition: tif_open.c:458
uint16 tdir_t
Definition: tiffio.h:62
#define HOST_FILLORDER
Definition: port.h:14
void * _TIFFmalloc(tsize_t s)
Definition: tif_acorn.c:461
const long * tif_typemask
Definition: tiffiop.h:138
int TIFFDefaultDirectory(TIFF *tif)
Definition: tif_dir.c:1056
toff_t tif_nextdiroff
Definition: tiffiop.h:128
#define ReadOK(tif, buf, size)
Definition: tiffiop.h:226
int TIFFIsTiled(TIFF *tif)
Definition: tif_open.c:539
int TIFFSetFileno(TIFF *tif, int fd)
Definition: tif_open.c:487
tdir_t TIFFCurrentDirectory(TIFF *tif)
Definition: tif_open.c:557
#define MDI_LITTLEENDIAN
Definition: tiff.h:53
#define STRIPCHOP_DEFAULT
Definition: tif_config.h:241
thandle_t TIFFClientdata(TIFF *tif)
Definition: tif_open.c:498
const int * tif_typeshift
Definition: tiffiop.h:137
int TIFFIsUpSampled(TIFF *tif)
Definition: tif_open.c:593
#define FILLORDER_MSB2LSB
Definition: tiff.h:219
void * thandle_t
Definition: tiffio.h:97
#define TIFF_MYBUFFER
Definition: tiffiop.h:115
int TIFFFileno(TIFF *tif)
Definition: tif_open.c:478
uint32 tiff_diroff
Definition: tiff.h:100
toff_t tif_diroff
Definition: tiffiop.h:127