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

Side by Side Diff: third_party/libtiff/tif_print.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_predict.c ('k') | third_party/libtiff/tif_read.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_print.c,v 1.60 2012-08-19 16:56:35 bfriesen Exp $ */ 1 /* $Id: tif_print.c,v 1.62 2015-08-19 02:31:04 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 16 matching lines...) Expand all
28 * TIFF Library. 28 * TIFF Library.
29 * 29 *
30 * Directory Printing Support 30 * Directory Printing Support
31 */ 31 */
32 #include "tiffiop.h" 32 #include "tiffiop.h"
33 #include <stdio.h> 33 #include <stdio.h>
34 34
35 #include <ctype.h> 35 #include <ctype.h>
36 36
37 static void 37 static void
38 _TIFFprintAsciiBounded(FILE* fd, const char* cp, int max_chars); 38 _TIFFprintAsciiBounded(FILE* fd, const char* cp, size_t max_chars);
39 39
40 static const char *photoNames[] = { 40 static const char *photoNames[] = {
41 "min-is-white", /* PHOTOMETRIC_MINISWHITE */ 41 "min-is-white", /* PHOTOMETRIC_MINISWHITE */
42 "min-is-black", /* PHOTOMETRIC_MINISBLACK */ 42 "min-is-black", /* PHOTOMETRIC_MINISBLACK */
43 "RGB color", /* PHOTOMETRIC_RGB */ 43 "RGB color", /* PHOTOMETRIC_RGB */
44 "palette color (RGB from colormap)", /* PHOTOMETRIC_PALETTE */ 44 "palette color (RGB from colormap)", /* PHOTOMETRIC_PALETTE */
45 "transparency mask", /* PHOTOMETRIC_MASK */ 45 "transparency mask", /* PHOTOMETRIC_MASK */
46 "separated", /* PHOTOMETRIC_SEPARATED */ 46 "separated", /* PHOTOMETRIC_SEPARATED */
47 "YCbCr", /* PHOTOMETRIC_YCBCR */ 47 "YCbCr", /* PHOTOMETRIC_YCBCR */
48 "7 (0x7)", 48 "7 (0x7)",
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 fprintf(fd, ">\n"); 388 fprintf(fd, ">\n");
389 } 389 }
390 if (TIFFFieldSet(tif,FIELD_INKNAMES)) { 390 if (TIFFFieldSet(tif,FIELD_INKNAMES)) {
391 char* cp; 391 char* cp;
392 fprintf(fd, " Ink Names: "); 392 fprintf(fd, " Ink Names: ");
393 i = td->td_samplesperpixel; 393 i = td->td_samplesperpixel;
394 sep = ""; 394 sep = "";
395 for (cp = td->td_inknames; 395 for (cp = td->td_inknames;
396 i > 0 && cp < td->td_inknames + td->td_inknameslen; 396 i > 0 && cp < td->td_inknames + td->td_inknameslen;
397 cp = strchr(cp,'\0')+1, i--) { 397 cp = strchr(cp,'\0')+1, i--) {
398 » » » int max_chars = 398 » » » size_t max_chars =
399 » » » » (int)(td->td_inknameslen - (cp - td->td_inknames )); 399 » » » » td->td_inknameslen - (cp - td->td_inknames);
400 fputs(sep, fd); 400 fputs(sep, fd);
401 _TIFFprintAsciiBounded(fd, cp, max_chars); 401 _TIFFprintAsciiBounded(fd, cp, max_chars);
402 sep = ", "; 402 sep = ", ";
403 } 403 }
404 fputs("\n", fd); 404 fputs("\n", fd);
405 } 405 }
406 if (TIFFFieldSet(tif,FIELD_THRESHHOLDING)) { 406 if (TIFFFieldSet(tif,FIELD_THRESHHOLDING)) {
407 fprintf(fd, " Thresholding: "); 407 fprintf(fd, " Thresholding: ");
408 switch (td->td_threshholding) { 408 switch (td->td_threshholding) {
409 case THRESHHOLD_BILEVEL: 409 case THRESHHOLD_BILEVEL:
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 const TIFFField *fip; 575 const TIFFField *fip;
576 uint32 value_count; 576 uint32 value_count;
577 int mem_alloc = 0; 577 int mem_alloc = 0;
578 void *raw_data; 578 void *raw_data;
579 579
580 fip = TIFFFieldWithTag(tif, tag); 580 fip = TIFFFieldWithTag(tif, tag);
581 if(fip == NULL) 581 if(fip == NULL)
582 continue; 582 continue;
583 583
584 if(fip->field_passcount) { 584 if(fip->field_passcount) {
585 » » » » if (fip->field_readcount == TIFF_VARIABLE ) { 585 » » » » if (fip->field_readcount == TIFF_VARIABLE2 ) {
586 if(TIFFGetField(tif, tag, &value_count, &raw_data) != 1) 586 if(TIFFGetField(tif, tag, &value_count, &raw_data) != 1)
587 continue; 587 continue;
588 » » » » } else if (fip->field_readcount == TIFF_VARIABLE 2 ) { 588 » » » » } else if (fip->field_readcount == TIFF_VARIABLE ) {
589 uint16 small_value_count; 589 uint16 small_value_count;
590 if(TIFFGetField(tif, tag, &small_value_c ount, &raw_data) != 1) 590 if(TIFFGetField(tif, tag, &small_value_c ount, &raw_data) != 1)
591 continue; 591 continue;
592 value_count = small_value_count; 592 value_count = small_value_count;
593 } else { 593 } else {
594 assert (fip->field_readcount == TIFF_VAR IABLE 594 assert (fip->field_readcount == TIFF_VAR IABLE
595 || fip->field_readcount == TIFF_ VARIABLE2); 595 || fip->field_readcount == TIFF_ VARIABLE2);
596 continue; 596 continue;
597 } 597 }
598 } else { 598 } else {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 (unsigned long) s, 668 (unsigned long) s,
669 (unsigned long long) td->td_stripoffset[s], 669 (unsigned long long) td->td_stripoffset[s],
670 (unsigned long long) td->td_stripbytecount[s]); 670 (unsigned long long) td->td_stripbytecount[s]);
671 #endif 671 #endif
672 } 672 }
673 } 673 }
674 674
675 void 675 void
676 _TIFFprintAscii(FILE* fd, const char* cp) 676 _TIFFprintAscii(FILE* fd, const char* cp)
677 { 677 {
678 » _TIFFprintAsciiBounded( fd, cp, (int)strlen(cp)); 678 » _TIFFprintAsciiBounded( fd, cp, strlen(cp));
679 } 679 }
680 680
681 static void 681 static void
682 _TIFFprintAsciiBounded(FILE* fd, const char* cp, int max_chars) 682 _TIFFprintAsciiBounded(FILE* fd, const char* cp, size_t max_chars)
683 { 683 {
684 for (; max_chars > 0 && *cp != '\0'; cp++, max_chars--) { 684 for (; max_chars > 0 && *cp != '\0'; cp++, max_chars--) {
685 const char* tp; 685 const char* tp;
686 686
687 if (isprint((int)*cp)) { 687 if (isprint((int)*cp)) {
688 fputc(*cp, fd); 688 fputc(*cp, fd);
689 continue; 689 continue;
690 } 690 }
691 for (tp = "\tt\bb\rr\nn\vv"; *tp; tp++) 691 for (tp = "\tt\bb\rr\nn\vv"; *tp; tp++)
692 if (*tp++ == *cp) 692 if (*tp++ == *cp)
(...skipping 14 matching lines...) Expand all
707 } 707 }
708 708
709 /* vim: set ts=8 sts=8 sw=8 noet: */ 709 /* vim: set ts=8 sts=8 sw=8 noet: */
710 /* 710 /*
711 * Local Variables: 711 * Local Variables:
712 * mode: c 712 * mode: c
713 * c-basic-offset: 8 713 * c-basic-offset: 8
714 * fill-column: 78 714 * fill-column: 78
715 * End: 715 * End:
716 */ 716 */
717
OLDNEW
« no previous file with comments | « third_party/libtiff/tif_predict.c ('k') | third_party/libtiff/tif_read.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698