|
|
7c98bb |
diff -Naur tiff-3.9.4.orig/contrib/dbs/xtiff/xtiff.c tiff-3.9.4/contrib/dbs/xtiff/xtiff.c
|
|
|
7c98bb |
--- tiff-3.9.4.orig/contrib/dbs/xtiff/xtiff.c 2010-06-08 14:50:40.000000000 -0400
|
|
|
7c98bb |
+++ tiff-3.9.4/contrib/dbs/xtiff/xtiff.c 2013-04-16 12:52:23.876253257 -0400
|
|
|
7c98bb |
@@ -512,9 +512,9 @@
|
|
|
7c98bb |
Arg args[1];
|
|
|
7c98bb |
|
|
|
7c98bb |
if (tfMultiPage)
|
|
|
7c98bb |
- sprintf(buffer, "%s - page %d", fileName, tfDirectory);
|
|
|
7c98bb |
+ snprintf(buffer, sizeof(buffer), "%s - page %d", fileName, tfDirectory);
|
|
|
7c98bb |
else
|
|
|
7c98bb |
- strcpy(buffer, fileName);
|
|
|
7c98bb |
+ snprintf(buffer, sizeof(buffer), "%s", fileName);
|
|
|
7c98bb |
XtSetArg(args[0], XtNlabel, buffer);
|
|
|
7c98bb |
XtSetValues(labelWidget, args, 1);
|
|
|
7c98bb |
}
|
|
|
7c98bb |
diff -Naur tiff-3.9.4.orig/libtiff/tif_codec.c tiff-3.9.4/libtiff/tif_codec.c
|
|
|
7c98bb |
--- tiff-3.9.4.orig/libtiff/tif_codec.c 2010-06-08 14:50:41.000000000 -0400
|
|
|
7c98bb |
+++ tiff-3.9.4/libtiff/tif_codec.c 2013-04-16 12:52:23.876253257 -0400
|
|
|
7c98bb |
@@ -104,7 +104,8 @@
|
|
|
7c98bb |
const TIFFCodec* c = TIFFFindCODEC(tif->tif_dir.td_compression);
|
|
|
7c98bb |
char compression_code[20];
|
|
|
7c98bb |
|
|
|
7c98bb |
- sprintf( compression_code, "%d", tif->tif_dir.td_compression );
|
|
|
7c98bb |
+ snprintf(compression_code, sizeof(compression_code), "%d",
|
|
|
7c98bb |
+ tif->tif_dir.td_compression );
|
|
|
7c98bb |
TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
|
|
|
7c98bb |
"%s compression support is not configured",
|
|
|
7c98bb |
c ? c->name : compression_code );
|
|
|
7c98bb |
diff -Naur tiff-3.9.4.orig/libtiff/tif_dirinfo.c tiff-3.9.4/libtiff/tif_dirinfo.c
|
|
|
7c98bb |
--- tiff-3.9.4.orig/libtiff/tif_dirinfo.c 2010-06-09 17:15:27.000000000 -0400
|
|
|
7c98bb |
+++ tiff-3.9.4/libtiff/tif_dirinfo.c 2013-04-16 12:52:23.877253102 -0400
|
|
|
7c98bb |
@@ -873,7 +873,7 @@
|
|
|
7c98bb |
* note that this name is a special sign to TIFFClose() and
|
|
|
7c98bb |
* _TIFFSetupFieldInfo() to free the field
|
|
|
7c98bb |
*/
|
|
|
7c98bb |
- sprintf(fld->field_name, "Tag %d", (int) tag);
|
|
|
7c98bb |
+ snprintf(fld->field_name, 32, "Tag %d", (int) tag);
|
|
|
7c98bb |
|
|
|
7c98bb |
return fld;
|
|
|
7c98bb |
}
|
|
|
7c98bb |
diff -Naur tiff-3.9.4.orig/tools/rgb2ycbcr.c tiff-3.9.4/tools/rgb2ycbcr.c
|
|
|
7c98bb |
--- tiff-3.9.4.orig/tools/rgb2ycbcr.c 2010-06-08 14:50:44.000000000 -0400
|
|
|
7c98bb |
+++ tiff-3.9.4/tools/rgb2ycbcr.c 2013-04-16 12:52:23.878252947 -0400
|
|
|
7c98bb |
@@ -326,7 +326,8 @@
|
|
|
7c98bb |
TIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
|
|
|
7c98bb |
{ char buf[2048];
|
|
|
7c98bb |
char *cp = strrchr(TIFFFileName(in), '/');
|
|
|
7c98bb |
- sprintf(buf, "YCbCr conversion of %s", cp ? cp+1 : TIFFFileName(in));
|
|
|
7c98bb |
+ snprintf(buf, sizeof(buf), "YCbCr conversion of %s",
|
|
|
7c98bb |
+ cp ? cp+1 : TIFFFileName(in));
|
|
|
7c98bb |
TIFFSetField(out, TIFFTAG_IMAGEDESCRIPTION, buf);
|
|
|
7c98bb |
}
|
|
|
7c98bb |
TIFFSetField(out, TIFFTAG_SOFTWARE, TIFFGetVersion());
|
|
|
7c98bb |
diff -Naur tiff-3.9.4.orig/tools/tiff2bw.c tiff-3.9.4/tools/tiff2bw.c
|
|
|
7c98bb |
--- tiff-3.9.4.orig/tools/tiff2bw.c 2010-06-08 14:50:44.000000000 -0400
|
|
|
7c98bb |
+++ tiff-3.9.4/tools/tiff2bw.c 2013-04-16 12:52:23.879252793 -0400
|
|
|
7c98bb |
@@ -201,7 +201,7 @@
|
|
|
7c98bb |
}
|
|
|
7c98bb |
}
|
|
|
7c98bb |
TIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
|
|
|
7c98bb |
- sprintf(thing, "B&W version of %s", argv[optind]);
|
|
|
7c98bb |
+ snprintf(thing, sizeof(thing), "B&W version of %s", argv[optind]);
|
|
|
7c98bb |
TIFFSetField(out, TIFFTAG_IMAGEDESCRIPTION, thing);
|
|
|
7c98bb |
TIFFSetField(out, TIFFTAG_SOFTWARE, "tiff2bw");
|
|
|
7c98bb |
outbuf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(out));
|
|
|
7c98bb |
diff -Naur tiff-3.9.4.orig/tools/tiff2pdf.c tiff-3.9.4/tools/tiff2pdf.c
|
|
|
7c98bb |
--- tiff-3.9.4.orig/tools/tiff2pdf.c 2013-04-16 12:51:14.647783499 -0400
|
|
|
7c98bb |
+++ tiff-3.9.4/tools/tiff2pdf.c 2013-04-16 12:56:34.501865141 -0400
|
|
|
7c98bb |
@@ -3662,7 +3662,9 @@
|
|
|
7c98bb |
char buffer[16];
|
|
|
7c98bb |
int buflen=0;
|
|
|
7c98bb |
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%%PDF-%u.%u ", t2p->pdf_majorversion&0xff, t2p->pdf_minorversion&0xff);
|
|
|
7c98bb |
+ buflen = snprintf(buffer, sizeof(buffer), "%%PDF-%u.%u ",
|
|
|
7c98bb |
+ t2p->pdf_majorversion&0xff,
|
|
|
7c98bb |
+ t2p->pdf_minorversion&0xff);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t)"\n%\342\343\317\323\n", 7);
|
|
|
7c98bb |
|
|
|
7c98bb |
@@ -3676,10 +3678,10 @@
|
|
|
7c98bb |
tsize_t t2p_write_pdf_obj_start(uint32 number, TIFF* output){
|
|
|
7c98bb |
|
|
|
7c98bb |
tsize_t written=0;
|
|
|
7c98bb |
- char buffer[16];
|
|
|
7c98bb |
+ char buffer[32];
|
|
|
7c98bb |
int buflen=0;
|
|
|
7c98bb |
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%lu", (unsigned long)number);
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)number);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen );
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " 0 obj\n", 7);
|
|
|
7c98bb |
|
|
|
7c98bb |
@@ -3718,13 +3720,13 @@
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "/", 1);
|
|
|
7c98bb |
for (i=0;i
|
|
|
7c98bb |
if ( ((unsigned char)name[i]) < 0x21){
|
|
|
7c98bb |
- sprintf(buffer, "#%.2X", name[i]);
|
|
|
7c98bb |
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
|
|
|
7c98bb |
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
7c98bb |
nextchar=1;
|
|
|
7c98bb |
}
|
|
|
7c98bb |
if ( ((unsigned char)name[i]) > 0x7E){
|
|
|
7c98bb |
- sprintf(buffer, "#%.2X", name[i]);
|
|
|
7c98bb |
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
|
|
|
7c98bb |
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
7c98bb |
nextchar=1;
|
|
|
7c98bb |
@@ -3732,57 +3734,57 @@
|
|
|
7c98bb |
if (nextchar==0){
|
|
|
7c98bb |
switch (name[i]){
|
|
|
7c98bb |
case 0x23:
|
|
|
7c98bb |
- sprintf(buffer, "#%.2X", name[i]);
|
|
|
7c98bb |
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
|
|
|
7c98bb |
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
7c98bb |
break;
|
|
|
7c98bb |
case 0x25:
|
|
|
7c98bb |
- sprintf(buffer, "#%.2X", name[i]);
|
|
|
7c98bb |
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
|
|
|
7c98bb |
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
7c98bb |
break;
|
|
|
7c98bb |
case 0x28:
|
|
|
7c98bb |
- sprintf(buffer, "#%.2X", name[i]);
|
|
|
7c98bb |
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
|
|
|
7c98bb |
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
7c98bb |
break;
|
|
|
7c98bb |
case 0x29:
|
|
|
7c98bb |
- sprintf(buffer, "#%.2X", name[i]);
|
|
|
7c98bb |
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
|
|
|
7c98bb |
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
7c98bb |
break;
|
|
|
7c98bb |
case 0x2F:
|
|
|
7c98bb |
- sprintf(buffer, "#%.2X", name[i]);
|
|
|
7c98bb |
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
|
|
|
7c98bb |
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
7c98bb |
break;
|
|
|
7c98bb |
case 0x3C:
|
|
|
7c98bb |
- sprintf(buffer, "#%.2X", name[i]);
|
|
|
7c98bb |
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
|
|
|
7c98bb |
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
7c98bb |
break;
|
|
|
7c98bb |
case 0x3E:
|
|
|
7c98bb |
- sprintf(buffer, "#%.2X", name[i]);
|
|
|
7c98bb |
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
|
|
|
7c98bb |
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
7c98bb |
break;
|
|
|
7c98bb |
case 0x5B:
|
|
|
7c98bb |
- sprintf(buffer, "#%.2X", name[i]);
|
|
|
7c98bb |
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
|
|
|
7c98bb |
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
7c98bb |
break;
|
|
|
7c98bb |
case 0x5D:
|
|
|
7c98bb |
- sprintf(buffer, "#%.2X", name[i]);
|
|
|
7c98bb |
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
|
|
|
7c98bb |
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
7c98bb |
break;
|
|
|
7c98bb |
case 0x7B:
|
|
|
7c98bb |
- sprintf(buffer, "#%.2X", name[i]);
|
|
|
7c98bb |
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
|
|
|
7c98bb |
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
7c98bb |
break;
|
|
|
7c98bb |
case 0x7D:
|
|
|
7c98bb |
- sprintf(buffer, "#%.2X", name[i]);
|
|
|
7c98bb |
+ snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
|
|
|
7c98bb |
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
7c98bb |
break;
|
|
|
7c98bb |
@@ -3812,7 +3814,7 @@
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "(", 1);
|
|
|
7c98bb |
for (i=0; i
|
|
|
7c98bb |
if((pdfstr[i]&0x80) || (pdfstr[i]==127) || (pdfstr[i]<32)){
|
|
|
7c98bb |
- sprintf(buffer, "\\%.3hho", pdfstr[i]);
|
|
|
7c98bb |
+ snprintf(buffer, sizeof(buffer), "\\%.3hho", pdfstr[i]);
|
|
|
7c98bb |
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, 4);
|
|
|
7c98bb |
} else {
|
|
|
7c98bb |
@@ -3898,14 +3900,14 @@
|
|
|
7c98bb |
tsize_t t2p_write_pdf_stream_dict(tsize_t len, uint32 number, TIFF* output){
|
|
|
7c98bb |
|
|
|
7c98bb |
tsize_t written=0;
|
|
|
7c98bb |
- char buffer[16];
|
|
|
7c98bb |
+ char buffer[32];
|
|
|
7c98bb |
int buflen=0;
|
|
|
7c98bb |
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "/Length ", 8);
|
|
|
7c98bb |
if(len!=0){
|
|
|
7c98bb |
written += t2p_write_pdf_stream_length(len, output);
|
|
|
7c98bb |
} else {
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%lu", (unsigned long)number);
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)number);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " 0 R \n", 6);
|
|
|
7c98bb |
}
|
|
|
7c98bb |
@@ -3946,10 +3948,10 @@
|
|
|
7c98bb |
tsize_t t2p_write_pdf_stream_length(tsize_t len, TIFF* output){
|
|
|
7c98bb |
|
|
|
7c98bb |
tsize_t written=0;
|
|
|
7c98bb |
- char buffer[16];
|
|
|
7c98bb |
+ char buffer[32];
|
|
|
7c98bb |
int buflen=0;
|
|
|
7c98bb |
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%lu", (unsigned long)len);
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)len);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "\n", 1);
|
|
|
7c98bb |
|
|
|
7c98bb |
@@ -3963,13 +3965,13 @@
|
|
|
7c98bb |
tsize_t t2p_write_pdf_catalog(T2P* t2p, TIFF* output){
|
|
|
7c98bb |
|
|
|
7c98bb |
tsize_t written=0;
|
|
|
7c98bb |
- char buffer[16];
|
|
|
7c98bb |
+ char buffer[32];
|
|
|
7c98bb |
int buflen=0;
|
|
|
7c98bb |
|
|
|
7c98bb |
written += t2pWriteFile(output,
|
|
|
7c98bb |
(tdata_t)"<< \n/Type /Catalog \n/Pages ",
|
|
|
7c98bb |
27);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_pages);
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_pages);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen );
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " 0 R \n", 6);
|
|
|
7c98bb |
if(t2p->pdf_fitwindow){
|
|
|
7c98bb |
@@ -4003,8 +4005,7 @@
|
|
|
7c98bb |
written += t2p_write_pdf_string(t2p->pdf_datetime, output);
|
|
|
7c98bb |
}
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "\n/Producer ", 11);
|
|
|
7c98bb |
- _TIFFmemset((tdata_t)buffer, 0x00, sizeof(buffer));
|
|
|
7c98bb |
- buflen = sprintf(buffer, "libtiff / tiff2pdf - %d", TIFFLIB_VERSION);
|
|
|
7c98bb |
+ buflen = snprintf(buffer, sizeof(buffer), "libtiff / tiff2pdf - %d", TIFFLIB_VERSION);
|
|
|
7c98bb |
written += t2p_write_pdf_string((unsigned char*)buffer, output);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "\n", 1);
|
|
|
7c98bb |
if(t2p->pdf_creator != NULL){
|
|
|
7c98bb |
@@ -4179,7 +4180,7 @@
|
|
|
7c98bb |
{
|
|
|
7c98bb |
tsize_t written=0;
|
|
|
7c98bb |
tdir_t i=0;
|
|
|
7c98bb |
- char buffer[16];
|
|
|
7c98bb |
+ char buffer[32];
|
|
|
7c98bb |
int buflen=0;
|
|
|
7c98bb |
|
|
|
7c98bb |
int page=0;
|
|
|
7c98bb |
@@ -4187,7 +4188,7 @@
|
|
|
7c98bb |
(tdata_t) "<< \n/Type /Pages \n/Kids [ ", 26);
|
|
|
7c98bb |
page = t2p->pdf_pages+1;
|
|
|
7c98bb |
for (i=0;i<t2p->tiff_pagecount;i++){
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%d", page);
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%d", page);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
|
|
|
7c98bb |
if ( ((i+1)%8)==0 ) {
|
|
|
7c98bb |
@@ -4202,8 +4203,7 @@
|
|
|
7c98bb |
}
|
|
|
7c98bb |
}
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "] \n/Count ", 10);
|
|
|
7c98bb |
- _TIFFmemset(buffer, 0x00, 16);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%d", t2p->tiff_pagecount);
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%d", t2p->tiff_pagecount);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " \n>> \n", 6);
|
|
|
7c98bb |
|
|
|
7c98bb |
@@ -4218,28 +4218,28 @@
|
|
|
7c98bb |
|
|
|
7c98bb |
unsigned int i=0;
|
|
|
7c98bb |
tsize_t written=0;
|
|
|
7c98bb |
- char buffer[16];
|
|
|
7c98bb |
+ char buffer[256];
|
|
|
7c98bb |
int buflen=0;
|
|
|
7c98bb |
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "<<\n/Type /Page \n/Parent ", 24);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_pages);
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_pages);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " 0 R \n", 6);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "/MediaBox [", 11);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%.4f",t2p->pdf_mediabox.x1);
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%.4f",t2p->pdf_mediabox.x1);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " ", 1);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%.4f",t2p->pdf_mediabox.y1);
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%.4f",t2p->pdf_mediabox.y1);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " ", 1);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%.4f",t2p->pdf_mediabox.x2);
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%.4f",t2p->pdf_mediabox.x2);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " ", 1);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%.4f",t2p->pdf_mediabox.y2);
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%.4f",t2p->pdf_mediabox.y2);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "] \n", 3);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "/Contents ", 10);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%lu", (unsigned long)(object + 1));
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)(object + 1));
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " 0 R \n", 6);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "/Resources << \n", 15);
|
|
|
7c98bb |
@@ -4247,15 +4247,13 @@
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "/XObject <<\n", 12);
|
|
|
7c98bb |
for(i=0;i<t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount;i++){
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "/Im", 3);
|
|
|
7c98bb |
- buflen = sprintf(buffer, "%u", t2p->pdf_page+1);
|
|
|
7c98bb |
+ buflen = snprintf(buffer, sizeof(buffer), "%u", t2p->pdf_page+1);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "_", 1);
|
|
|
7c98bb |
- buflen = sprintf(buffer, "%u", i+1);
|
|
|
7c98bb |
+ buflen = snprintf(buffer, sizeof(buffer), "%u", i+1);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " ", 1);
|
|
|
7c98bb |
- buflen = sprintf(
|
|
|
7c98bb |
- buffer,
|
|
|
7c98bb |
- "%lu",
|
|
|
7c98bb |
+ buflen = snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
7c98bb |
(unsigned long)(object+3+(2*i)+t2p->tiff_pages[t2p->pdf_page].page_extra));
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
|
|
|
7c98bb |
@@ -4267,12 +4265,10 @@
|
|
|
7c98bb |
} else {
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "/XObject <<\n", 12);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "/Im", 3);
|
|
|
7c98bb |
- buflen = sprintf(buffer, "%u", t2p->pdf_page+1);
|
|
|
7c98bb |
+ buflen = snprintf(buffer, sizeof(buffer), "%u", t2p->pdf_page+1);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " ", 1);
|
|
|
7c98bb |
- buflen = sprintf(
|
|
|
7c98bb |
- buffer,
|
|
|
7c98bb |
- "%lu",
|
|
|
7c98bb |
+ buflen = snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
7c98bb |
(unsigned long)(object+3+(2*i)+t2p->tiff_pages[t2p->pdf_page].page_extra));
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
|
|
|
7c98bb |
@@ -4281,9 +4277,7 @@
|
|
|
7c98bb |
if(t2p->tiff_transferfunctioncount != 0) {
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "/ExtGState <<", 13);
|
|
|
7c98bb |
t2pWriteFile(output, (tdata_t) "/GS1 ", 5);
|
|
|
7c98bb |
- buflen = sprintf(
|
|
|
7c98bb |
- buffer,
|
|
|
7c98bb |
- "%lu",
|
|
|
7c98bb |
+ buflen = snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
7c98bb |
(unsigned long)(object + 3));
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
|
|
|
7c98bb |
@@ -4644,7 +4638,7 @@
|
|
|
7c98bb |
if(t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount>0){
|
|
|
7c98bb |
for(i=0;i<t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount; i++){
|
|
|
7c98bb |
box=t2p->tiff_tiles[t2p->pdf_page].tiles_tiles[i].tile_box;
|
|
|
7c98bb |
- buflen=sprintf(buffer,
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer),
|
|
|
7c98bb |
"q %s %.4f %.4f %.4f %.4f %.4f %.4f cm /Im%d_%ld Do Q\n",
|
|
|
7c98bb |
t2p->tiff_transferfunctioncount?"/GS1 gs ":"",
|
|
|
7c98bb |
box.mat[0],
|
|
|
7c98bb |
@@ -4659,7 +4653,7 @@
|
|
|
7c98bb |
}
|
|
|
7c98bb |
} else {
|
|
|
7c98bb |
box=t2p->pdf_imagebox;
|
|
|
7c98bb |
- buflen=sprintf(buffer,
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer),
|
|
|
7c98bb |
"q %s %.4f %.4f %.4f %.4f %.4f %.4f cm /Im%d Do Q\n",
|
|
|
7c98bb |
t2p->tiff_transferfunctioncount?"/GS1 gs ":"",
|
|
|
7c98bb |
box.mat[0],
|
|
|
7c98bb |
@@ -4684,59 +4678,48 @@
|
|
|
7c98bb |
TIFF* output){
|
|
|
7c98bb |
|
|
|
7c98bb |
tsize_t written=0;
|
|
|
7c98bb |
- char buffer[16];
|
|
|
7c98bb |
+ char buffer[32];
|
|
|
7c98bb |
int buflen=0;
|
|
|
7c98bb |
|
|
|
7c98bb |
written += t2p_write_pdf_stream_dict(0, t2p->pdf_xrefcount+1, output);
|
|
|
7c98bb |
written += t2pWriteFile(output,
|
|
|
7c98bb |
(tdata_t) "/Type /XObject \n/Subtype /Image \n/Name /Im",
|
|
|
7c98bb |
42);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%u", t2p->pdf_page+1);
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%u", t2p->pdf_page+1);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
if(tile != 0){
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "_", 1);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%lu", (unsigned long)tile);
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)tile);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
}
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "\n/Width ", 8);
|
|
|
7c98bb |
- _TIFFmemset((tdata_t)buffer, 0x00, 16);
|
|
|
7c98bb |
if(tile==0){
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->tiff_width);
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->tiff_width);
|
|
|
7c98bb |
} else {
|
|
|
7c98bb |
if(t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)!=0){
|
|
|
7c98bb |
- buflen=sprintf(
|
|
|
7c98bb |
- buffer,
|
|
|
7c98bb |
- "%lu",
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
7c98bb |
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth);
|
|
|
7c98bb |
} else {
|
|
|
7c98bb |
- buflen=sprintf(
|
|
|
7c98bb |
- buffer,
|
|
|
7c98bb |
- "%lu",
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
7c98bb |
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth);
|
|
|
7c98bb |
}
|
|
|
7c98bb |
}
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "\n/Height ", 9);
|
|
|
7c98bb |
- _TIFFmemset((tdata_t)buffer, 0x00, 16);
|
|
|
7c98bb |
if(tile==0){
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->tiff_length);
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->tiff_length);
|
|
|
7c98bb |
} else {
|
|
|
7c98bb |
if(t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)!=0){
|
|
|
7c98bb |
- buflen=sprintf(
|
|
|
7c98bb |
- buffer,
|
|
|
7c98bb |
- "%lu",
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
7c98bb |
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilelength);
|
|
|
7c98bb |
} else {
|
|
|
7c98bb |
- buflen=sprintf(
|
|
|
7c98bb |
- buffer,
|
|
|
7c98bb |
- "%lu",
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
7c98bb |
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);
|
|
|
7c98bb |
}
|
|
|
7c98bb |
}
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "\n/BitsPerComponent ", 19);
|
|
|
7c98bb |
- _TIFFmemset((tdata_t)buffer, 0x00, 16);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%u", t2p->tiff_bitspersample);
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%u", t2p->tiff_bitspersample);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "\n/ColorSpace ", 13);
|
|
|
7c98bb |
written += t2p_write_pdf_xobject_cs(t2p, output);
|
|
|
7c98bb |
@@ -4764,7 +4747,7 @@
|
|
|
7c98bb |
tsize_t t2p_write_pdf_xobject_cs(T2P* t2p, TIFF* output){
|
|
|
7c98bb |
|
|
|
7c98bb |
tsize_t written=0;
|
|
|
7c98bb |
- char buffer[128];
|
|
|
7c98bb |
+ char buffer[256];
|
|
|
7c98bb |
int buflen=0;
|
|
|
7c98bb |
|
|
|
7c98bb |
float X_W=1.0;
|
|
|
7c98bb |
@@ -4780,11 +4763,10 @@
|
|
|
7c98bb |
t2p->pdf_colorspace ^= T2P_CS_PALETTE;
|
|
|
7c98bb |
written += t2p_write_pdf_xobject_cs(t2p, output);
|
|
|
7c98bb |
t2p->pdf_colorspace |= T2P_CS_PALETTE;
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%u", (0x0001 << t2p->tiff_bitspersample)-1 );
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%u", (0x0001 << t2p->tiff_bitspersample)-1 );
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " ", 1);
|
|
|
7c98bb |
- _TIFFmemset(buffer, 0x00, 16);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_palettecs );
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_palettecs );
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " 0 R ]\n", 7);
|
|
|
7c98bb |
return(written);
|
|
|
7c98bb |
@@ -4818,7 +4800,7 @@
|
|
|
7c98bb |
X_W /= Y_W;
|
|
|
7c98bb |
Z_W /= Y_W;
|
|
|
7c98bb |
Y_W = 1.0F;
|
|
|
7c98bb |
- buflen=sprintf(buffer, "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W);
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
X_W = 0.3457F; /* 0.3127F; */ /* D50, commented D65 */
|
|
|
7c98bb |
Y_W = 0.3585F; /* 0.3290F; */
|
|
|
7c98bb |
@@ -4826,10 +4808,10 @@
|
|
|
7c98bb |
X_W /= Y_W;
|
|
|
7c98bb |
Z_W /= Y_W;
|
|
|
7c98bb |
Y_W = 1.0F;
|
|
|
7c98bb |
- buflen=sprintf(buffer, "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W);
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "/Range ", 7);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "[%d %d %d %d] \n",
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "[%d %d %d %d] \n",
|
|
|
7c98bb |
t2p->pdf_labrange[0],
|
|
|
7c98bb |
t2p->pdf_labrange[1],
|
|
|
7c98bb |
t2p->pdf_labrange[2],
|
|
|
7c98bb |
@@ -4845,26 +4827,26 @@
|
|
|
7c98bb |
tsize_t t2p_write_pdf_transfer(T2P* t2p, TIFF* output){
|
|
|
7c98bb |
|
|
|
7c98bb |
tsize_t written=0;
|
|
|
7c98bb |
- char buffer[16];
|
|
|
7c98bb |
+ char buffer[32];
|
|
|
7c98bb |
int buflen=0;
|
|
|
7c98bb |
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "<< /Type /ExtGState \n/TR ", 25);
|
|
|
7c98bb |
if(t2p->tiff_transferfunctioncount == 1){
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%lu",
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
7c98bb |
(unsigned long)(t2p->pdf_xrefcount + 1));
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
|
|
|
7c98bb |
} else {
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "[ ", 2);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%lu",
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
7c98bb |
(unsigned long)(t2p->pdf_xrefcount + 1));
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%lu",
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
7c98bb |
(unsigned long)(t2p->pdf_xrefcount + 2));
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%lu",
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
7c98bb |
(unsigned long)(t2p->pdf_xrefcount + 3));
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
|
|
|
7c98bb |
@@ -4886,7 +4868,7 @@
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "/FunctionType 0 \n", 17);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "/Domain [0.0 1.0] \n", 19);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "/Range [0.0 1.0] \n", 18);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "/Size [%u] \n", (1<<t2p->tiff_bitspersample));
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "/Size [%u] \n", (1<<t2p->tiff_bitspersample));
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "/BitsPerSample 16 \n", 19);
|
|
|
7c98bb |
written += t2p_write_pdf_stream_dict(1<<(t2p->tiff_bitspersample+1), 0, output);
|
|
|
7c98bb |
@@ -4913,7 +4895,7 @@
|
|
|
7c98bb |
tsize_t t2p_write_pdf_xobject_calcs(T2P* t2p, TIFF* output){
|
|
|
7c98bb |
|
|
|
7c98bb |
tsize_t written=0;
|
|
|
7c98bb |
- char buffer[128];
|
|
|
7c98bb |
+ char buffer[256];
|
|
|
7c98bb |
int buflen=0;
|
|
|
7c98bb |
|
|
|
7c98bb |
float X_W=0.0;
|
|
|
7c98bb |
@@ -4981,16 +4963,16 @@
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "<< \n", 4);
|
|
|
7c98bb |
if(t2p->pdf_colorspace & T2P_CS_CALGRAY){
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "/WhitePoint ", 12);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W);
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "/Gamma 2.2 \n", 12);
|
|
|
7c98bb |
}
|
|
|
7c98bb |
if(t2p->pdf_colorspace & T2P_CS_CALRGB){
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "/WhitePoint ", 12);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W);
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "/Matrix ", 8);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "[%.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f] \n",
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "[%.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f] \n",
|
|
|
7c98bb |
X_R, Y_R, Z_R,
|
|
|
7c98bb |
X_G, Y_G, Z_G,
|
|
|
7c98bb |
X_B, Y_B, Z_B);
|
|
|
7c98bb |
@@ -5009,11 +4991,11 @@
|
|
|
7c98bb |
tsize_t t2p_write_pdf_xobject_icccs(T2P* t2p, TIFF* output){
|
|
|
7c98bb |
|
|
|
7c98bb |
tsize_t written=0;
|
|
|
7c98bb |
- char buffer[16];
|
|
|
7c98bb |
+ char buffer[32];
|
|
|
7c98bb |
int buflen=0;
|
|
|
7c98bb |
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "[/ICCBased ", 11);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_icccs);
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_icccs);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " 0 R] \n", 7);
|
|
|
7c98bb |
|
|
|
7c98bb |
@@ -5023,11 +5005,11 @@
|
|
|
7c98bb |
tsize_t t2p_write_pdf_xobject_icccs_dict(T2P* t2p, TIFF* output){
|
|
|
7c98bb |
|
|
|
7c98bb |
tsize_t written=0;
|
|
|
7c98bb |
- char buffer[16];
|
|
|
7c98bb |
+ char buffer[32];
|
|
|
7c98bb |
int buflen=0;
|
|
|
7c98bb |
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "/N ", 3);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%u \n", t2p->tiff_samplesperpixel);
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%u \n", t2p->tiff_samplesperpixel);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "/Alternate ", 11);
|
|
|
7c98bb |
t2p->pdf_colorspace ^= T2P_CS_ICCBASED;
|
|
|
7c98bb |
@@ -5092,7 +5074,7 @@
|
|
|
7c98bb |
tsize_t t2p_write_pdf_xobject_stream_filter(ttile_t tile, T2P* t2p, TIFF* output){
|
|
|
7c98bb |
|
|
|
7c98bb |
tsize_t written=0;
|
|
|
7c98bb |
- char buffer[16];
|
|
|
7c98bb |
+ char buffer[32];
|
|
|
7c98bb |
int buflen=0;
|
|
|
7c98bb |
|
|
|
7c98bb |
if(t2p->pdf_compression==T2P_COMPRESS_NONE){
|
|
|
7c98bb |
@@ -5107,41 +5089,33 @@
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "<< /K -1 ", 9);
|
|
|
7c98bb |
if(tile==0){
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "/Columns ", 9);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%lu",
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
7c98bb |
(unsigned long)t2p->tiff_width);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " /Rows ", 7);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%lu",
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
7c98bb |
(unsigned long)t2p->tiff_length);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
} else {
|
|
|
7c98bb |
if(t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)==0){
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "/Columns ", 9);
|
|
|
7c98bb |
- buflen=sprintf(
|
|
|
7c98bb |
- buffer,
|
|
|
7c98bb |
- "%lu",
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
7c98bb |
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
} else {
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "/Columns ", 9);
|
|
|
7c98bb |
- buflen=sprintf(
|
|
|
7c98bb |
- buffer,
|
|
|
7c98bb |
- "%lu",
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
7c98bb |
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
}
|
|
|
7c98bb |
if(t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)==0){
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " /Rows ", 7);
|
|
|
7c98bb |
- buflen=sprintf(
|
|
|
7c98bb |
- buffer,
|
|
|
7c98bb |
- "%lu",
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
7c98bb |
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
} else {
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " /Rows ", 7);
|
|
|
7c98bb |
- buflen=sprintf(
|
|
|
7c98bb |
- buffer,
|
|
|
7c98bb |
- "%lu",
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
7c98bb |
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilelength);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
}
|
|
|
7c98bb |
@@ -5168,21 +5142,17 @@
|
|
|
7c98bb |
if(t2p->pdf_compressionquality%100){
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "/DecodeParms ", 13);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "<< /Predictor ", 14);
|
|
|
7c98bb |
- _TIFFmemset(buffer, 0x00, 16);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%u", t2p->pdf_compressionquality%100);
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%u", t2p->pdf_compressionquality%100);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " /Columns ", 10);
|
|
|
7c98bb |
- _TIFFmemset(buffer, 0x00, 16);
|
|
|
7c98bb |
- buflen = sprintf(buffer, "%lu",
|
|
|
7c98bb |
+ buflen = snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
7c98bb |
(unsigned long)t2p->tiff_width);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " /Colors ", 9);
|
|
|
7c98bb |
- _TIFFmemset(buffer, 0x00, 16);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%u", t2p->tiff_samplesperpixel);
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%u", t2p->tiff_samplesperpixel);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " /BitsPerComponent ", 19);
|
|
|
7c98bb |
- _TIFFmemset(buffer, 0x00, 16);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%u", t2p->tiff_bitspersample);
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%u", t2p->tiff_bitspersample);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) ">>\n", 3);
|
|
|
7c98bb |
}
|
|
|
7c98bb |
@@ -5202,16 +5172,16 @@
|
|
|
7c98bb |
tsize_t t2p_write_pdf_xreftable(T2P* t2p, TIFF* output){
|
|
|
7c98bb |
|
|
|
7c98bb |
tsize_t written=0;
|
|
|
7c98bb |
- char buffer[21];
|
|
|
7c98bb |
+ char buffer[64];
|
|
|
7c98bb |
int buflen=0;
|
|
|
7c98bb |
uint32 i=0;
|
|
|
7c98bb |
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "xref\n0 ", 7);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%lu", (unsigned long)(t2p->pdf_xrefcount + 1));
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)(t2p->pdf_xrefcount + 1));
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " \n0000000000 65535 f \n", 22);
|
|
|
7c98bb |
for (i=0;i<t2p->pdf_xrefcount;i++){
|
|
|
7c98bb |
- sprintf(buffer, "%.10lu 00000 n \n",
|
|
|
7c98bb |
+ snprintf(buffer, sizeof(buffer), "%.10lu 00000 n \n",
|
|
|
7c98bb |
(unsigned long)t2p->pdf_xrefoffsets[i]);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, 20);
|
|
|
7c98bb |
}
|
|
|
7c98bb |
@@ -5251,25 +5221,21 @@
|
|
|
7c98bb |
"%.2hhX", fileidbuf[i]);
|
|
|
7c98bb |
}
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "trailer\n<<\n/Size ", 17);
|
|
|
7c98bb |
- buflen = sprintf(buffer, "%lu", (unsigned long)(t2p->pdf_xrefcount+1));
|
|
|
7c98bb |
+ buflen = snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)(t2p->pdf_xrefcount+1));
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
- _TIFFmemset(buffer, 0x00, 32);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "\n/Root ", 7);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_catalog);
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_catalog);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
- _TIFFmemset(buffer, 0x00, 32);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " 0 R \n/Info ", 12);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_info);
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_info);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
- _TIFFmemset(buffer, 0x00, 32);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) " 0 R \n/ID[<", 11);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) t2p->pdf_fileid, 32);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "><", 2);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) t2p->pdf_fileid, 32);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) ">]\n>>\nstartxref\n", 16);
|
|
|
7c98bb |
- buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_startxref);
|
|
|
7c98bb |
+ buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_startxref);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
7c98bb |
- _TIFFmemset(buffer, 0x00, 32);
|
|
|
7c98bb |
written += t2pWriteFile(output, (tdata_t) "\n%%EOF\n", 7);
|
|
|
7c98bb |
|
|
|
7c98bb |
return(written);
|
|
|
7c98bb |
diff -Naur tiff-3.9.4.orig/tools/tiff2ps.c tiff-3.9.4/tools/tiff2ps.c
|
|
|
7c98bb |
--- tiff-3.9.4.orig/tools/tiff2ps.c 2010-06-10 18:51:29.000000000 -0400
|
|
|
7c98bb |
+++ tiff-3.9.4/tools/tiff2ps.c 2013-04-16 12:52:23.884252045 -0400
|
|
|
7c98bb |
@@ -1079,8 +1079,8 @@
|
|
|
7c98bb |
imageOp = "imagemask";
|
|
|
7c98bb |
|
|
|
7c98bb |
(void)strcpy(im_x, "0");
|
|
|
7c98bb |
- (void)sprintf(im_y, "%lu", (long) h);
|
|
|
7c98bb |
- (void)sprintf(im_h, "%lu", (long) h);
|
|
|
7c98bb |
+ (void)snprintf(im_y, sizeof(im_y), "%lu", (long) h);
|
|
|
7c98bb |
+ (void)snprintf(im_h, sizeof(im_h), "%lu", (long) h);
|
|
|
7c98bb |
tile_width = w;
|
|
|
7c98bb |
tile_height = h;
|
|
|
7c98bb |
if (TIFFIsTiled(tif)) {
|
|
|
7c98bb |
@@ -1101,7 +1101,7 @@
|
|
|
7c98bb |
}
|
|
|
7c98bb |
if (tile_height < h) {
|
|
|
7c98bb |
fputs("/im_y 0 def\n", fd);
|
|
|
7c98bb |
- (void)sprintf(im_y, "%lu im_y sub", (unsigned long) h);
|
|
|
7c98bb |
+ (void)snprintf(im_y, sizeof(im_y), "%lu im_y sub", (unsigned long) h);
|
|
|
7c98bb |
}
|
|
|
7c98bb |
} else {
|
|
|
7c98bb |
repeat_count = tf_numberstrips;
|
|
|
7c98bb |
@@ -1113,7 +1113,7 @@
|
|
|
7c98bb |
fprintf(fd, "/im_h %lu def\n",
|
|
|
7c98bb |
(unsigned long) tile_height);
|
|
|
7c98bb |
(void)strcpy(im_h, "im_h");
|
|
|
7c98bb |
- (void)sprintf(im_y, "%lu im_y sub", (unsigned long) h);
|
|
|
7c98bb |
+ (void)snprintf(im_y, sizeof(im_y), "%lu im_y sub", (unsigned long) h);
|
|
|
7c98bb |
}
|
|
|
7c98bb |
}
|
|
|
7c98bb |
|
|
|
7c98bb |
diff -Naur tiff-3.9.4.orig/tools/tiffcrop.c tiff-3.9.4/tools/tiffcrop.c
|
|
|
7c98bb |
--- tiff-3.9.4.orig/tools/tiffcrop.c 2010-06-11 18:24:23.000000000 -0400
|
|
|
7c98bb |
+++ tiff-3.9.4/tools/tiffcrop.c 2013-04-16 12:57:52.968382205 -0400
|
|
|
7c98bb |
@@ -2063,7 +2063,7 @@
|
|
|
7c98bb |
strncpy (export_ext, ".tiff", 5);
|
|
|
7c98bb |
export_ext[5] = '\0';
|
|
|
7c98bb |
|
|
|
7c98bb |
- sprintf (filenum, "-%03d%s", findex, export_ext);
|
|
|
7c98bb |
+ snprintf(filenum, sizeof(filenum), "-%03d%s", findex, export_ext);
|
|
|
7c98bb |
filenum[15] = '\0';
|
|
|
7c98bb |
strncat (exportname, filenum, 14);
|
|
|
7c98bb |
}
|
|
|
7c98bb |
@@ -2213,7 +2213,8 @@
|
|
|
7c98bb |
if (dump.infile != NULL)
|
|
|
7c98bb |
fclose (dump.infile);
|
|
|
7c98bb |
|
|
|
7c98bb |
- sprintf (temp_filename, "%s-read-%03d.%s", dump.infilename, dump_images,
|
|
|
7c98bb |
+ snprintf(temp_filename, sizeof(temp_filename), "%s-read-%03d.%s",
|
|
|
7c98bb |
+ dump.infilename, dump_images,
|
|
|
7c98bb |
(dump.format == DUMP_TEXT) ? "txt" : "raw");
|
|
|
7c98bb |
if ((dump.infile = fopen(temp_filename, dump.mode)) == NULL)
|
|
|
7c98bb |
{
|
|
|
7c98bb |
@@ -2229,7 +2230,8 @@
|
|
|
7c98bb |
if (dump.outfile != NULL)
|
|
|
7c98bb |
fclose (dump.outfile);
|
|
|
7c98bb |
|
|
|
7c98bb |
- sprintf (temp_filename, "%s-write-%03d.%s", dump.outfilename, dump_images,
|
|
|
7c98bb |
+ snprintf(temp_filename, sizeof(temp_filename), "%s-write-%03d.%s",
|
|
|
7c98bb |
+ dump.outfilename, dump_images,
|
|
|
7c98bb |
(dump.format == DUMP_TEXT) ? "txt" : "raw");
|
|
|
7c98bb |
if ((dump.outfile = fopen(temp_filename, dump.mode)) == NULL)
|
|
|
7c98bb |
{
|
|
|
7c98bb |
diff -Naur tiff-3.9.4.orig/tools/tiffdither.c tiff-3.9.4/tools/tiffdither.c
|
|
|
7c98bb |
--- tiff-3.9.4.orig/tools/tiffdither.c 2010-06-08 14:50:44.000000000 -0400
|
|
|
7c98bb |
+++ tiff-3.9.4/tools/tiffdither.c 2013-04-16 12:52:23.890251187 -0400
|
|
|
7c98bb |
@@ -256,7 +256,7 @@
|
|
|
7c98bb |
TIFFSetField(out, TIFFTAG_FILLORDER, fillorder);
|
|
|
7c98bb |
else
|
|
|
7c98bb |
CopyField(TIFFTAG_FILLORDER, shortv);
|
|
|
7c98bb |
- sprintf(thing, "Dithered B&W version of %s", argv[optind]);
|
|
|
7c98bb |
+ snprintf(thing, sizeof(thing), "Dithered B&W version of %s", argv[optind]);
|
|
|
7c98bb |
TIFFSetField(out, TIFFTAG_IMAGEDESCRIPTION, thing);
|
|
|
7c98bb |
CopyField(TIFFTAG_PHOTOMETRIC, shortv);
|
|
|
7c98bb |
CopyField(TIFFTAG_ORIENTATION, shortv);
|