diff options
author | Robin Watts <robin.watts@artifex.com> | 2012-02-01 11:01:24 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2012-02-01 11:01:24 +0000 |
commit | d36ddbb53507e45a04ef68b82e77bc224149ae4a (patch) | |
tree | 438a2ac79149a68c65ea8f6f238434596da22b86 | |
parent | 3e65ed4eb3a8aa8cd6375a7029ac3b61a35a1157 (diff) | |
download | mupdf-d36ddbb53507e45a04ef68b82e77bc224149ae4a.tar.xz |
Tweak to previous pdf_decode_cmap fix.
More aesthetically pleasing version.
-rw-r--r-- | pdf/mupdf.h | 2 | ||||
-rw-r--r-- | pdf/pdf_cmap.c | 10 | ||||
-rw-r--r-- | pdf/pdf_interpret.c | 4 |
3 files changed, 7 insertions, 9 deletions
diff --git a/pdf/mupdf.h b/pdf/mupdf.h index 5bbce7f3..5b546ba0 100644 --- a/pdf/mupdf.h +++ b/pdf/mupdf.h @@ -281,7 +281,7 @@ void pdf_sort_cmap(fz_context *ctx, pdf_cmap *cmap); int pdf_lookup_cmap(pdf_cmap *cmap, int cpt); int pdf_lookup_cmap_full(pdf_cmap *cmap, int cpt, int *out); -unsigned char *pdf_decode_cmap(pdf_cmap *cmap, unsigned char *s, int *cpt, int *w); +int pdf_decode_cmap(pdf_cmap *cmap, unsigned char *s, int *cpt); pdf_cmap *pdf_new_identity_cmap(fz_context *ctx, int wmode, int bytes); pdf_cmap *pdf_parse_cmap(fz_stream *file); diff --git a/pdf/pdf_cmap.c b/pdf/pdf_cmap.c index 587b82e2..c42317bb 100644 --- a/pdf/pdf_cmap.c +++ b/pdf/pdf_cmap.c @@ -482,13 +482,12 @@ pdf_lookup_cmap_full(pdf_cmap *cmap, int cpt, int *out) * Use the codespace ranges to extract a codepoint from a * multi-byte encoded string. */ -unsigned char * -pdf_decode_cmap(pdf_cmap *cmap, unsigned char *buf, int *cpt, int *w) +int +pdf_decode_cmap(pdf_cmap *cmap, unsigned char *buf, int *cpt) { int k, n, c; c = 0; - *w = 0; for (n = 0; n < 4; n++) { c = (c << 8) | buf[n]; @@ -499,13 +498,12 @@ pdf_decode_cmap(pdf_cmap *cmap, unsigned char *buf, int *cpt, int *w) if (c >= cmap->codespace[k].low && c <= cmap->codespace[k].high) { *cpt = c; - *w = n + 1; - return buf + n + 1; + return n + 1; } } } } *cpt = 0; - return buf + 1; + return 1; } diff --git a/pdf/pdf_interpret.c b/pdf/pdf_interpret.c index 63f208a1..812e38fb 100644 --- a/pdf/pdf_interpret.c +++ b/pdf/pdf_interpret.c @@ -816,8 +816,8 @@ pdf_show_string(pdf_csi *csi, unsigned char *buf, int len) while (buf < end) { - int w; - buf = pdf_decode_cmap(fontdesc->encoding, buf, &cpt, &w); + int w = pdf_decode_cmap(fontdesc->encoding, buf, &cpt); + buf += w; cid = pdf_lookup_cmap(fontdesc->encoding, cpt); if (cid >= 0) pdf_show_char(csi, cid); |