Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: third_party/libtiff/tif_read.c

Issue 1563103002: XFA: Upgrade to libtiff 4.0.6. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: rename to libtiff Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/libtiff/tif_print.c ('k') | third_party/libtiff/tif_strip.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* $Id: tif_read.c,v 1.41 2012-07-06 19:22:58 bfriesen Exp $ */ 1 /* $Id: tif_read.c,v 1.45 2015-06-07 22:35:40 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 28 matching lines...) Expand all
40 TIFFReadRawStrip1(TIFF* tif, uint32 strip, void* buf, tmsize_t size,const char* module); 40 TIFFReadRawStrip1(TIFF* tif, uint32 strip, void* buf, tmsize_t size,const char* module);
41 41
42 #define NOSTRIP ((uint32)(-1)) /* undefined state */ 42 #define NOSTRIP ((uint32)(-1)) /* undefined state */
43 #define NOTILE ((uint32)(-1)) /* undefined state */ 43 #define NOTILE ((uint32)(-1)) /* undefined state */
44 44
45 static int 45 static int
46 TIFFFillStripPartial( TIFF *tif, int strip, tmsize_t read_ahead, int restart ) 46 TIFFFillStripPartial( TIFF *tif, int strip, tmsize_t read_ahead, int restart )
47 { 47 {
48 static const char module[] = "TIFFFillStripPartial"; 48 static const char module[] = "TIFFFillStripPartial";
49 register TIFFDirectory *td = &tif->tif_dir; 49 register TIFFDirectory *td = &tif->tif_dir;
50 uint64 unused_data; 50 tmsize_t unused_data;
51 uint64 read_offset; 51 uint64 read_offset;
52 tmsize_t cc, to_read; 52 tmsize_t cc, to_read;
53 /* tmsize_t bytecountm; */ 53 /* tmsize_t bytecountm; */
54 54
55 if (!_TIFFFillStriles( tif ) || !tif->tif_dir.td_stripbytecount) 55 if (!_TIFFFillStriles( tif ) || !tif->tif_dir.td_stripbytecount)
56 return 0; 56 return 0;
57 57
58 /* 58 /*
59 * Expand raw data buffer, if needed, to hold data 59 * Expand raw data buffer, if needed, to hold data
60 * strip coming from file (perhaps should set upper 60 * strip coming from file (perhaps should set upper
(...skipping 26 matching lines...) Expand all
87 ** start of the buffer. 87 ** start of the buffer.
88 */ 88 */
89 if( tif->tif_rawdataloaded > 0 ) 89 if( tif->tif_rawdataloaded > 0 )
90 unused_data = tif->tif_rawdataloaded - (tif->tif_rawcp - tif->ti f_rawdata); 90 unused_data = tif->tif_rawdataloaded - (tif->tif_rawcp - tif->ti f_rawdata);
91 else 91 else
92 unused_data = 0; 92 unused_data = 0;
93 93
94 if( unused_data > 0 ) 94 if( unused_data > 0 )
95 { 95 {
96 assert((tif->tif_flags&TIFF_BUFFERMMAP)==0); 96 assert((tif->tif_flags&TIFF_BUFFERMMAP)==0);
97 memmove( tif->tif_rawdata, tif->tif_rawcp, (size_t)unused_data ) ; 97 memmove( tif->tif_rawdata, tif->tif_rawcp, unused_data );
98 } 98 }
99 99
100 /* 100 /*
101 ** Seek to the point in the file where more data should be read. 101 ** Seek to the point in the file where more data should be read.
102 */ 102 */
103 read_offset = td->td_stripoffset[strip] 103 read_offset = td->td_stripoffset[strip]
104 + tif->tif_rawdataoff + tif->tif_rawdataloaded; 104 + tif->tif_rawdataoff + tif->tif_rawdataloaded;
105 105
106 if (!SeekOK(tif, read_offset)) { 106 if (!SeekOK(tif, read_offset)) {
107 TIFFErrorExt(tif->tif_clientdata, module, 107 TIFFErrorExt(tif->tif_clientdata, module,
108 "Seek error at scanline %lu, strip %lu", 108 "Seek error at scanline %lu, strip %lu",
109 (unsigned long) tif->tif_row, (unsigned long) strip ); 109 (unsigned long) tif->tif_row, (unsigned long) strip );
110 return 0; 110 return 0;
111 } 111 }
112 112
113 /* 113 /*
114 ** How much do we want to read? 114 ** How much do we want to read?
115 */ 115 */
116 to_read = (tmsize_t)(tif->tif_rawdatasize - unused_data); 116 to_read = tif->tif_rawdatasize - unused_data;
117 if( (uint64) to_read > td->td_stripbytecount[strip] 117 if( (uint64) to_read > td->td_stripbytecount[strip]
118 - tif->tif_rawdataoff - tif->tif_rawdataloaded ) 118 - tif->tif_rawdataoff - tif->tif_rawdataloaded )
119 { 119 {
120 to_read = (tmsize_t)(td->td_stripbytecount[strip] 120 to_read = (tmsize_t) td->td_stripbytecount[strip]
121 - tif->tif_rawdataoff - tif->tif_rawdataloaded); 121 - tif->tif_rawdataoff - tif->tif_rawdataloaded;
122 } 122 }
123 123
124 assert((tif->tif_flags&TIFF_BUFFERMMAP)==0); 124 assert((tif->tif_flags&TIFF_BUFFERMMAP)==0);
125 cc = TIFFReadFile(tif, tif->tif_rawdata + unused_data, to_read); 125 cc = TIFFReadFile(tif, tif->tif_rawdata + unused_data, to_read);
126 126
127 if (cc != to_read) { 127 if (cc != to_read) {
128 #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__)) 128 #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
129 TIFFErrorExt(tif->tif_clientdata, module, 129 TIFFErrorExt(tif->tif_clientdata, module,
130 "Read error at scanline %lu; got %I64u bytes, expec ted %I64u", 130 "Read error at scanline %lu; got %I64u bytes, expec ted %I64u",
131 (unsigned long) tif->tif_row, 131 (unsigned long) tif->tif_row,
132 (unsigned __int64) cc, 132 (unsigned __int64) cc,
133 (unsigned __int64) to_read); 133 (unsigned __int64) to_read);
134 #else 134 #else
135 TIFFErrorExt(tif->tif_clientdata, module, 135 TIFFErrorExt(tif->tif_clientdata, module,
136 "Read error at scanline %lu; got %llu bytes, expect ed %llu", 136 "Read error at scanline %lu; got %llu bytes, expect ed %llu",
137 (unsigned long) tif->tif_row, 137 (unsigned long) tif->tif_row,
138 (unsigned long long) cc, 138 (unsigned long long) cc,
139 (unsigned long long) to_read); 139 (unsigned long long) to_read);
140 #endif 140 #endif
141 return 0; 141 return 0;
142 } 142 }
143 143
144 tif->tif_rawdataoff = (tmsize_t)(tif->tif_rawdataoff + tif->tif_rawdatal oaded - unused_data) ; 144 tif->tif_rawdataoff = tif->tif_rawdataoff + tif->tif_rawdataloaded - unu sed_data ;
145 tif->tif_rawdataloaded = (tmsize_t)unused_data + to_read; 145 tif->tif_rawdataloaded = unused_data + to_read;
146 146
147 tif->tif_rawcp = tif->tif_rawdata; 147 tif->tif_rawcp = tif->tif_rawdata;
148 148
149 if (!isFillOrder(tif, td->td_fillorder) && 149 if (!isFillOrder(tif, td->td_fillorder) &&
150 (tif->tif_flags & TIFF_NOBITREV) == 0) { 150 (tif->tif_flags & TIFF_NOBITREV) == 0) {
151 assert((tif->tif_flags&TIFF_BUFFERMMAP)==0); 151 assert((tif->tif_flags&TIFF_BUFFERMMAP)==0);
152 TIFFReverseBits(tif->tif_rawdata + unused_data, to_read ); 152 TIFFReverseBits(tif->tif_rawdata + unused_data, to_read );
153 } 153 }
154 154
155 /* 155 /*
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 * amount into the user-supplied buffer. 314 * amount into the user-supplied buffer.
315 */ 315 */
316 tmsize_t 316 tmsize_t
317 TIFFReadEncodedStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size) 317 TIFFReadEncodedStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size)
318 { 318 {
319 static const char module[] = "TIFFReadEncodedStrip"; 319 static const char module[] = "TIFFReadEncodedStrip";
320 TIFFDirectory *td = &tif->tif_dir; 320 TIFFDirectory *td = &tif->tif_dir;
321 uint32 rowsperstrip; 321 uint32 rowsperstrip;
322 uint32 stripsperplane; 322 uint32 stripsperplane;
323 uint32 stripinplane; 323 uint32 stripinplane;
324 » uint16 plane, comp; 324 » uint16 plane;
325 uint32 rows; 325 uint32 rows;
326 tmsize_t stripsize; 326 tmsize_t stripsize;
327 if (!TIFFCheckRead(tif,0)) 327 if (!TIFFCheckRead(tif,0))
328 return((tmsize_t)(-1)); 328 return((tmsize_t)(-1));
329 if (strip>=td->td_nstrips) 329 if (strip>=td->td_nstrips)
330 { 330 {
331 TIFFErrorExt(tif->tif_clientdata,module, 331 TIFFErrorExt(tif->tif_clientdata,module,
332 "%lu: Strip out of range, max %lu",(unsigned long)strip, 332 "%lu: Strip out of range, max %lu",(unsigned long)strip,
333 (unsigned long)td->td_nstrips); 333 (unsigned long)td->td_nstrips);
334 return((tmsize_t)(-1)); 334 return((tmsize_t)(-1));
(...skipping 10 matching lines...) Expand all
345 stripinplane=(strip%stripsperplane); 345 stripinplane=(strip%stripsperplane);
346 plane=(strip/stripsperplane); 346 plane=(strip/stripsperplane);
347 rows=td->td_imagelength-stripinplane*rowsperstrip; 347 rows=td->td_imagelength-stripinplane*rowsperstrip;
348 if (rows>rowsperstrip) 348 if (rows>rowsperstrip)
349 rows=rowsperstrip; 349 rows=rowsperstrip;
350 stripsize=TIFFVStripSize(tif,rows); 350 stripsize=TIFFVStripSize(tif,rows);
351 if (stripsize==0) 351 if (stripsize==0)
352 return((tmsize_t)(-1)); 352 return((tmsize_t)(-1));
353 if ((size!=(tmsize_t)(-1))&&(size<stripsize)) 353 if ((size!=(tmsize_t)(-1))&&(size<stripsize))
354 stripsize=size; 354 stripsize=size;
355 355 » if (!TIFFFillStrip(tif,strip))
356 » /*
357 » * discard those.
358 » * keep code modified by Changjin Gao.
359 » * Xiaochuan Liu 20100828.
360 » */
361 » /*if (!TIFFFillStrip(tif,strip))
362 return((tmsize_t)(-1)); 356 return((tmsize_t)(-1));
363 if ((*tif->tif_decodestrip)(tif,buf,stripsize,plane)<=0) 357 if ((*tif->tif_decodestrip)(tif,buf,stripsize,plane)<=0)
364 return((tmsize_t)(-1)); 358 return((tmsize_t)(-1));
365 (*tif->tif_postdecode)(tif,buf,stripsize); 359 (*tif->tif_postdecode)(tif,buf,stripsize);
366 » return(stripsize);*/ 360 » return(stripsize);
367 »
368 » /*
369 » * Changjin Gao 20110726 fixed decode error issue.
370 » * Test file: mantis #27308 020511-1158450.tiff.
371 » */
372 » comp = COMPRESSION_NONE;
373 StripDecode:
374 » if (TIFFFillStrip(tif, strip) && (*tif->tif_decodestrip)(tif, buf, strip size, plane) > 0)
375 » {
376 » » (*tif->tif_postdecode)(tif, buf, stripsize);
377 » » return (stripsize);
378 » }
379 » else
380 » {
381 » » if (comp < 9)
382 » » {
383 » » » TIFFSetField(tif, TIFFTAG_COMPRESSION, comp);
384 » » » TIFFSetField(tif, TIFFTAG_FAXMODE,FAXMODE_CLASSIC);
385 » » » comp++;
386 » » » goto StripDecode;
387 » » }
388
389 » » return ((tsize_t) -1);
390 » }
391 } 361 }
392 362
393 static tmsize_t 363 static tmsize_t
394 TIFFReadRawStrip1(TIFF* tif, uint32 strip, void* buf, tmsize_t size, 364 TIFFReadRawStrip1(TIFF* tif, uint32 strip, void* buf, tmsize_t size,
395 const char* module) 365 const char* module)
396 { 366 {
397 TIFFDirectory *td = &tif->tif_dir; 367 TIFFDirectory *td = &tif->tif_dir;
398 368
399 if (!_TIFFFillStriles( tif )) 369 if (!_TIFFFillStriles( tif ))
400 return ((tmsize_t)(-1)); 370 return ((tmsize_t)(-1));
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 (unsigned long) td->td_nstrips); 451 (unsigned long) td->td_nstrips);
482 return ((tmsize_t)(-1)); 452 return ((tmsize_t)(-1));
483 } 453 }
484 if (tif->tif_flags&TIFF_NOREADRAW) 454 if (tif->tif_flags&TIFF_NOREADRAW)
485 { 455 {
486 TIFFErrorExt(tif->tif_clientdata, module, 456 TIFFErrorExt(tif->tif_clientdata, module,
487 "Compression scheme does not support access to raw uncompres sed data"); 457 "Compression scheme does not support access to raw uncompres sed data");
488 return ((tmsize_t)(-1)); 458 return ((tmsize_t)(-1));
489 } 459 }
490 bytecount = td->td_stripbytecount[strip]; 460 bytecount = td->td_stripbytecount[strip];
491 » if (bytecount <= 0) { 461 » if ((int64)bytecount <= 0) {
492 #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__)) 462 #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
493 TIFFErrorExt(tif->tif_clientdata, module, 463 TIFFErrorExt(tif->tif_clientdata, module,
494 "%I64u: Invalid strip byte count, strip %lu", 464 "%I64u: Invalid strip byte count, strip %lu",
495 (unsigned __int64) bytecount, 465 (unsigned __int64) bytecount,
496 (unsigned long) strip); 466 (unsigned long) strip);
497 #else 467 #else
498 TIFFErrorExt(tif->tif_clientdata, module, 468 TIFFErrorExt(tif->tif_clientdata, module,
499 "%llu: Invalid strip byte count, strip %lu", 469 "%llu: Invalid strip byte count, strip %lu",
500 (unsigned long long) bytecount, 470 (unsigned long long) bytecount,
501 (unsigned long) strip); 471 (unsigned long) strip);
(...skipping 19 matching lines...) Expand all
521 { 491 {
522 static const char module[] = "TIFFFillStrip"; 492 static const char module[] = "TIFFFillStrip";
523 TIFFDirectory *td = &tif->tif_dir; 493 TIFFDirectory *td = &tif->tif_dir;
524 494
525 if (!_TIFFFillStriles( tif ) || !tif->tif_dir.td_stripbytecount) 495 if (!_TIFFFillStriles( tif ) || !tif->tif_dir.td_stripbytecount)
526 return 0; 496 return 0;
527 497
528 if ((tif->tif_flags&TIFF_NOREADRAW)==0) 498 if ((tif->tif_flags&TIFF_NOREADRAW)==0)
529 { 499 {
530 uint64 bytecount = td->td_stripbytecount[strip]; 500 uint64 bytecount = td->td_stripbytecount[strip];
531 » » if (bytecount <= 0) { 501 » » if ((int64)bytecount <= 0) {
532 #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__)) 502 #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
533 TIFFErrorExt(tif->tif_clientdata, module, 503 TIFFErrorExt(tif->tif_clientdata, module,
534 "Invalid strip byte count %I64u, strip %lu", 504 "Invalid strip byte count %I64u, strip %lu",
535 (unsigned __int64) bytecount, 505 (unsigned __int64) bytecount,
536 (unsigned long) strip); 506 (unsigned long) strip);
537 #else 507 #else
538 TIFFErrorExt(tif->tif_clientdata, module, 508 TIFFErrorExt(tif->tif_clientdata, module,
539 "Invalid strip byte count %llu, strip %lu", 509 "Invalid strip byte count %llu, strip %lu",
540 (unsigned long long) bytecount, 510 (unsigned long long) bytecount,
541 (unsigned long) strip); 511 (unsigned long) strip);
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 { 794 {
825 static const char module[] = "TIFFFillTile"; 795 static const char module[] = "TIFFFillTile";
826 TIFFDirectory *td = &tif->tif_dir; 796 TIFFDirectory *td = &tif->tif_dir;
827 797
828 if (!_TIFFFillStriles( tif ) || !tif->tif_dir.td_stripbytecount) 798 if (!_TIFFFillStriles( tif ) || !tif->tif_dir.td_stripbytecount)
829 return 0; 799 return 0;
830 800
831 if ((tif->tif_flags&TIFF_NOREADRAW)==0) 801 if ((tif->tif_flags&TIFF_NOREADRAW)==0)
832 { 802 {
833 uint64 bytecount = td->td_stripbytecount[tile]; 803 uint64 bytecount = td->td_stripbytecount[tile];
834 » » if (bytecount <= 0) { 804 » » if ((int64)bytecount <= 0) {
835 #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__)) 805 #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
836 TIFFErrorExt(tif->tif_clientdata, module, 806 TIFFErrorExt(tif->tif_clientdata, module,
837 "%I64u: Invalid tile byte count, tile %lu", 807 "%I64u: Invalid tile byte count, tile %lu",
838 (unsigned __int64) bytecount, 808 (unsigned __int64) bytecount,
839 (unsigned long) tile); 809 (unsigned long) tile);
840 #else 810 #else
841 TIFFErrorExt(tif->tif_clientdata, module, 811 TIFFErrorExt(tif->tif_clientdata, module,
842 "%llu: Invalid tile byte count, tile %lu", 812 "%llu: Invalid tile byte count, tile %lu",
843 (unsigned long long) bytecount, 813 (unsigned long long) bytecount,
844 (unsigned long) tile); 814 (unsigned long) tile);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 _TIFFfree(tif->tif_rawdata); 923 _TIFFfree(tif->tif_rawdata);
954 tif->tif_rawdata = NULL; 924 tif->tif_rawdata = NULL;
955 tif->tif_rawdatasize = 0; 925 tif->tif_rawdatasize = 0;
956 } 926 }
957 if (bp) { 927 if (bp) {
958 tif->tif_rawdatasize = size; 928 tif->tif_rawdatasize = size;
959 tif->tif_rawdata = (uint8*) bp; 929 tif->tif_rawdata = (uint8*) bp;
960 tif->tif_flags &= ~TIFF_MYBUFFER; 930 tif->tif_flags &= ~TIFF_MYBUFFER;
961 } else { 931 } else {
962 tif->tif_rawdatasize = (tmsize_t)TIFFroundup_64((uint64)size, 10 24); 932 tif->tif_rawdatasize = (tmsize_t)TIFFroundup_64((uint64)size, 10 24);
963 » » if (tif->tif_rawdatasize==0) 933 » » if (tif->tif_rawdatasize==0) {
964 » » » tif->tif_rawdatasize=(tmsize_t)(-1); 934 » » TIFFErrorExt(tif->tif_clientdata, module,
935 » » » » "Invalid buffer size");
936 » » return (0);
937 » » }
965 tif->tif_rawdata = (uint8*) _TIFFmalloc(tif->tif_rawdatasize); 938 tif->tif_rawdata = (uint8*) _TIFFmalloc(tif->tif_rawdatasize);
966 tif->tif_flags |= TIFF_MYBUFFER; 939 tif->tif_flags |= TIFF_MYBUFFER;
967 } 940 }
968 if (tif->tif_rawdata == NULL) { 941 if (tif->tif_rawdata == NULL) {
969 TIFFErrorExt(tif->tif_clientdata, module, 942 TIFFErrorExt(tif->tif_clientdata, module,
970 "No space for data buffer at scanline %lu", 943 "No space for data buffer at scanline %lu",
971 (unsigned long) tif->tif_row); 944 (unsigned long) tif->tif_row);
972 tif->tif_rawdatasize = 0; 945 tif->tif_rawdatasize = 0;
973 return (0); 946 return (0);
974 } 947 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 (uint16)(strip / td->td_stripsperimage))); 983 (uint16)(strip / td->td_stripsperimage)));
1011 } 984 }
1012 985
1013 /* 986 /*
1014 * Set state to appear as if a 987 * Set state to appear as if a
1015 * tile has just been read in. 988 * tile has just been read in.
1016 */ 989 */
1017 static int 990 static int
1018 TIFFStartTile(TIFF* tif, uint32 tile) 991 TIFFStartTile(TIFF* tif, uint32 tile)
1019 { 992 {
993 static const char module[] = "TIFFStartTile";
1020 TIFFDirectory *td = &tif->tif_dir; 994 TIFFDirectory *td = &tif->tif_dir;
995 uint32 howmany32;
1021 996
1022 if (!_TIFFFillStriles( tif ) || !tif->tif_dir.td_stripbytecount) 997 if (!_TIFFFillStriles( tif ) || !tif->tif_dir.td_stripbytecount)
1023 return 0; 998 return 0;
1024 999
1025 if ((tif->tif_flags & TIFF_CODERSETUP) == 0) { 1000 if ((tif->tif_flags & TIFF_CODERSETUP) == 0) {
1026 if (!(*tif->tif_setupdecode)(tif)) 1001 if (!(*tif->tif_setupdecode)(tif))
1027 return (0); 1002 return (0);
1028 tif->tif_flags |= TIFF_CODERSETUP; 1003 tif->tif_flags |= TIFF_CODERSETUP;
1029 } 1004 }
1030 tif->tif_curtile = tile; 1005 tif->tif_curtile = tile;
1031 » tif->tif_row = 1006 howmany32=TIFFhowmany_32(td->td_imagewidth, td->td_tilewidth);
1032 » (tile % TIFFhowmany_32(td->td_imagewidth, td->td_tilewidth)) * 1007 if (howmany32 == 0) {
1033 » » td->td_tilelength; 1008 TIFFErrorExt(tif->tif_clientdata,module,"Zero tiles");
1034 » tif->tif_col = 1009 return 0;
1035 » (tile % TIFFhowmany_32(td->td_imagelength, td->td_tilelength)) * 1010 }
1036 » » td->td_tilewidth; 1011 » tif->tif_row = (tile % howmany32) * td->td_tilelength;
1012 howmany32=TIFFhowmany_32(td->td_imagelength, td->td_tilelength);
1013 if (howmany32 == 0) {
1014 TIFFErrorExt(tif->tif_clientdata,module,"Zero tiles");
1015 return 0;
1016 }
1017 » tif->tif_col = (tile % howmany32) * td->td_tilewidth;
1037 tif->tif_flags &= ~TIFF_BUF4WRITE; 1018 tif->tif_flags &= ~TIFF_BUF4WRITE;
1038 if (tif->tif_flags&TIFF_NOREADRAW) 1019 if (tif->tif_flags&TIFF_NOREADRAW)
1039 { 1020 {
1040 tif->tif_rawcp = NULL; 1021 tif->tif_rawcp = NULL;
1041 tif->tif_rawcc = 0; 1022 tif->tif_rawcc = 0;
1042 } 1023 }
1043 else 1024 else
1044 { 1025 {
1045 tif->tif_rawcp = tif->tif_rawdata; 1026 tif->tif_rawcp = tif->tif_rawdata;
1046 tif->tif_rawcc = (tmsize_t)td->td_stripbytecount[tile]; 1027 tif->tif_rawcc = (tmsize_t)td->td_stripbytecount[tile];
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 } 1085 }
1105 1086
1106 /* vim: set ts=8 sts=8 sw=8 noet: */ 1087 /* vim: set ts=8 sts=8 sw=8 noet: */
1107 /* 1088 /*
1108 * Local Variables: 1089 * Local Variables:
1109 * mode: c 1090 * mode: c
1110 * c-basic-offset: 8 1091 * c-basic-offset: 8
1111 * fill-column: 78 1092 * fill-column: 78
1112 * End: 1093 * End:
1113 */ 1094 */
1114
OLDNEW
« no previous file with comments | « third_party/libtiff/tif_print.c ('k') | third_party/libtiff/tif_strip.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698