summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mupdf/fitz/system.h1
-rw-r--r--source/fitz/output.c2
-rw-r--r--source/pdf/pdf-pkcs7.c2
-rw-r--r--source/tools/pdfextract.c6
4 files changed, 5 insertions, 6 deletions
diff --git a/include/mupdf/fitz/system.h b/include/mupdf/fitz/system.h
index 7b426264..8a617e5b 100644
--- a/include/mupdf/fitz/system.h
+++ b/include/mupdf/fitz/system.h
@@ -119,7 +119,6 @@ static __inline int signbit(double x)
#define hypotf _hypotf
#define atoll _atoi64
-#define stat _stat
char *fz_utf8_from_wchar(const wchar_t *s);
wchar_t *fz_wchar_from_utf8(const char *s);
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)