summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2011-04-04 01:02:34 +0200
committerTor Andersson <tor.andersson@artifex.com>2011-04-04 01:02:34 +0200
commitfc5ff7b56e0e0797570eba81a39e13d40aaccb40 (patch)
tree2217f1aedcd3d650da53398019159d31d900e559
parent68769d87e0c7fa0a365447d690eca45e48748bc4 (diff)
downloadmupdf-fc5ff7b56e0e0797570eba81a39e13d40aaccb40.tar.xz
Incorporate small fixes from SumatraPDF.
-rw-r--r--fitz/filt_basic.c2
-rw-r--r--fitz/filt_dctd.c2
-rw-r--r--mupdf/mupdf.h1
-rw-r--r--mupdf/pdf_function.c2
-rw-r--r--mupdf/pdf_image.c4
-rw-r--r--mupdf/pdf_xref.c4
6 files changed, 8 insertions, 7 deletions
diff --git a/fitz/filt_basic.c b/fitz/filt_basic.c
index 91af02d4..221d0846 100644
--- a/fitz/filt_basic.c
+++ b/fitz/filt_basic.c
@@ -225,7 +225,7 @@ reada85d(fz_stream *stm, unsigned char *buf, int len)
{
c = fz_readbyte(state->chain);
if (c != '>')
- return fz_throw("bad eod marker in a85d");
+ fz_warn("bad eod marker in a85d");
switch (count) {
case 0:
diff --git a/fitz/filt_dctd.c b/fitz/filt_dctd.c
index 97651297..05c3db4d 100644
--- a/fitz/filt_dctd.c
+++ b/fitz/filt_dctd.c
@@ -64,7 +64,7 @@ static void skip_input_data(j_decompress_ptr cinfo, long num_bytes)
struct jpeg_source_mgr *src = cinfo->src;
if (num_bytes > 0)
{
- while (num_bytes > src->bytes_in_buffer)
+ while ((size_t)num_bytes > src->bytes_in_buffer)
{
num_bytes -= src->bytes_in_buffer;
(void) src->fill_input_buffer(cinfo);
diff --git a/mupdf/mupdf.h b/mupdf/mupdf.h
index fe4cfee3..f82bf9bb 100644
--- a/mupdf/mupdf.h
+++ b/mupdf/mupdf.h
@@ -152,6 +152,7 @@ struct pdf_xref_s
char scratch[65536];
};
+fz_obj *pdf_resolveindirect(fz_obj *ref);
fz_error pdf_cacheobject(pdf_xref *, int num, int gen);
fz_error pdf_loadobject(fz_obj **objp, pdf_xref *, int num, int gen);
void pdf_updateobject( pdf_xref *xref, int num, int gen, fz_obj *newobj);
diff --git a/mupdf/pdf_function.c b/mupdf/pdf_function.c
index 28c52151..3fdd6ac7 100644
--- a/mupdf/pdf_function.c
+++ b/mupdf/pdf_function.c
@@ -264,7 +264,7 @@ psroll(psstack *st, int n, int j)
psobj tmp;
int i;
- if (psunderflow(st, n) || j == 0)
+ if (psunderflow(st, n) || j == 0 || n == 0)
return;
if (j >= 0)
diff --git a/mupdf/pdf_image.c b/mupdf/pdf_image.c
index b75644a3..b37c7257 100644
--- a/mupdf/pdf_image.c
+++ b/mupdf/pdf_image.c
@@ -157,7 +157,6 @@ pdf_loadimageimp(fz_pixmap **imgp, pdf_xref *xref, fz_obj *rdb, fz_obj *dict, fz
}
stride = (w * n * bpc + 7) / 8;
- samples = fz_calloc(h, stride);
if (cstm)
{
@@ -176,6 +175,8 @@ pdf_loadimageimp(fz_pixmap **imgp, pdf_xref *xref, fz_obj *rdb, fz_obj *dict, fz
}
}
+ samples = fz_calloc(h, stride);
+
len = fz_read(stm, samples, h * stride);
if (len < 0)
{
@@ -184,6 +185,7 @@ pdf_loadimageimp(fz_pixmap **imgp, pdf_xref *xref, fz_obj *rdb, fz_obj *dict, fz
fz_dropcolorspace(colorspace);
if (mask)
fz_droppixmap(mask);
+ fz_free(samples);
return fz_rethrow(len, "cannot read image data");
}
diff --git a/mupdf/pdf_xref.c b/mupdf/pdf_xref.c
index 4ec23a30..64d92cc7 100644
--- a/mupdf/pdf_xref.c
+++ b/mupdf/pdf_xref.c
@@ -1,8 +1,6 @@
#include "fitz.h"
#include "mupdf.h"
-static fz_obj *pdf_resolveindirect(fz_obj *ref);
-
static inline int iswhite(int ch)
{
return
@@ -898,7 +896,7 @@ pdf_loadobject(fz_obj **objp, pdf_xref *xref, int num, int gen)
return fz_okay;
}
-static fz_obj *
+fz_obj *
pdf_resolveindirect(fz_obj *ref)
{
if (fz_isindirect(ref))