summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2017-11-02 16:18:11 +0100
committerTor Andersson <tor.andersson@artifex.com>2017-11-02 16:31:32 +0100
commitfa7b06100f3c49abcac263f27368082040a2f95e (patch)
tree55500d82cc77242d97eb32740204cad3405fc115 /source
parent1dc763159b03cbd4387713f353f26c890d2c0e52 (diff)
downloadmupdf-fa7b06100f3c49abcac263f27368082040a2f95e.tar.xz
Fixes for win32 build.
Diffstat (limited to 'source')
-rw-r--r--source/fitz/output.c2
-rw-r--r--source/pdf/pdf-pkcs7.c2
-rw-r--r--source/tools/pdfextract.c6
3 files changed, 5 insertions, 5 deletions
diff --git a/source/fitz/output.c b/source/fitz/output.c
index a06a81b6..4c6aa6b4 100644
--- a/source/fitz/output.c
+++ b/source/fitz/output.c
@@ -197,7 +197,7 @@ fz_new_output_with_path(fz_context *ctx, const char *filename, int append)
if (errno != ENOENT)
fz_throw(ctx, FZ_ERROR_GENERIC, "cannot remove file '%s': %s", filename, strerror(errno));
}
- file = fz_fopen_utf8(filename, "rb");
+ file = fz_fopen_utf8(filename, append ? "ab" : "wb");
#else
/* Ensure we create a brand new file. We don't want to clobber our old file. */
if (!append)
diff --git a/source/pdf/pdf-pkcs7.c b/source/pdf/pdf-pkcs7.c
index 735548d0..cab54742 100644
--- a/source/pdf/pdf-pkcs7.c
+++ b/source/pdf/pdf-pkcs7.c
@@ -303,7 +303,7 @@ static int pk7_verify(X509_STORE *cert_store, PKCS7 *p7, BIO *detached, char *eb
else
{
/* Error while checking the certificate chain */
- snprintf(ebuf, ebufsize, "%s(%d): %s", X509_verify_cert_error_string(vctx.err), vctx.err, vctx.certdesc);
+ fz_snprintf(ebuf, ebufsize, "%s(%d): %s", X509_verify_cert_error_string(vctx.err), vctx.err, vctx.certdesc);
}
res = 0;
diff --git a/source/tools/pdfextract.c b/source/tools/pdfextract.c
index c6fe92aa..c7105613 100644
--- a/source/tools/pdfextract.c
+++ b/source/tools/pdfextract.c
@@ -100,7 +100,7 @@ static void saveimage(int num)
{
image = pdf_load_image(ctx, doc, ref);
cbuf = fz_compressed_image_buffer(ctx, image);
- snprintf(buf, sizeof(buf), "img-%04d", num);
+ fz_snprintf(buf, sizeof(buf), "img-%04d", num);
type = cbuf == NULL ? FZ_IMAGE_UNKNOWN : cbuf->params.type;
if (image->use_colorkey)
type = FZ_IMAGE_UNKNOWN;
@@ -114,7 +114,7 @@ static void saveimage(int num)
{
unsigned char *data;
size_t len = fz_buffer_storage(ctx, cbuf->buffer, &data);
- snprintf(buf, sizeof(buf), "img-%04d", num);
+ fz_snprintf(buf, sizeof(buf), "img-%04d", num);
writejpeg(ctx, data, len, buf);
break;
}
@@ -192,7 +192,7 @@ static void savefont(pdf_obj *dict, int num)
len = fz_buffer_storage(ctx, buf, &data);
fz_try(ctx)
{
- snprintf(namebuf, sizeof(namebuf), "%s-%04d.%s", fontname, num, ext);
+ fz_snprintf(namebuf, sizeof(namebuf), "%s-%04d.%s", fontname, num, ext);
printf("extracting font %s\n", namebuf);
out = fz_new_output_with_path(ctx, namebuf, 0);
fz_try(ctx)