diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2017-08-08 13:41:31 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2017-08-17 13:38:48 +0200 |
commit | 7225ddf9df514c6c88ecbe01c708137a324456c7 (patch) | |
tree | 9bbe65936eb4a95636bca0cf151975be41712dbc | |
parent | af356930857b57d4f0d9a193603d64ab709a8e56 (diff) | |
download | mupdf-7225ddf9df514c6c88ecbe01c708137a324456c7.tar.xz |
Add FZ_REPLACEMENT_CHARACTER define for U+FFFD character.
-rw-r--r-- | include/mupdf/fitz/string-util.h | 3 | ||||
-rw-r--r-- | source/fitz/stext-search.c | 2 | ||||
-rw-r--r-- | source/fitz/util.c | 2 | ||||
-rw-r--r-- | source/pdf/pdf-encoding.c | 2 | ||||
-rw-r--r-- | source/pdf/pdf-op-run.c | 2 | ||||
-rw-r--r-- | source/pdf/pdf-parse.c | 2 | ||||
-rw-r--r-- | source/pdf/pdf-type3.c | 2 | ||||
-rw-r--r-- | source/pdf/pdf-unicode.c | 2 | ||||
-rw-r--r-- | source/xps/xps-glyphs.c | 2 |
9 files changed, 11 insertions, 8 deletions
diff --git a/include/mupdf/fitz/string-util.h b/include/mupdf/fitz/string-util.h index b174539a..41c4d473 100644 --- a/include/mupdf/fitz/string-util.h +++ b/include/mupdf/fitz/string-util.h @@ -3,6 +3,9 @@ #include "mupdf/fitz/system.h" +/* The Unicode character used to incoming character whose value is unknown or unrepresentable. */ +#define FZ_REPLACEMENT_CHARACTER 0xFFFD + /* Safe string functions */ diff --git a/source/fitz/stext-search.c b/source/fitz/stext-search.c index 6c30ea29..79071684 100644 --- a/source/fitz/stext-search.c +++ b/source/fitz/stext-search.c @@ -253,7 +253,7 @@ fz_copy_selection(fz_context *ctx, fz_stext_page *page, fz_rect rect) fz_stext_char_bbox(ctx, &hitbox, line, ch); c = ch->c; if (c < 32) - c = 0xFFFD; + c = FZ_REPLACEMENT_CHARACTER; if (hitbox.x1 >= x0 && hitbox.x0 <= x1 && hitbox.y1 >= y0 && hitbox.y0 <= y1) { fz_append_rune(ctx, buffer, c); diff --git a/source/fitz/util.c b/source/fitz/util.c index d6a7f317..d22c6a7b 100644 --- a/source/fitz/util.c +++ b/source/fitz/util.c @@ -432,7 +432,7 @@ fz_new_buffer_from_stext_page(fz_context *ctx, fz_stext_page *page, const fz_rec int c = ch->c; fz_stext_char_bbox(ctx, &hitbox, line, ch); if (c < 32) - c = 0xFFFD; + c = FZ_REPLACEMENT_CHARACTER; if (hitbox.x1 >= x0 && hitbox.x0 <= x1 && hitbox.y1 >= y0 && hitbox.y0 <= y1) { saw_text = 1; diff --git a/source/pdf/pdf-encoding.c b/source/pdf/pdf-encoding.c index ac2f1a55..0b2cdfca 100644 --- a/source/pdf/pdf-encoding.c +++ b/source/pdf/pdf-encoding.c @@ -63,7 +63,7 @@ pdf_lookup_agl(const char *name) else if (buf[0] == 'a' && buf[1] != 0 && buf[2] != 0) code = strtol(buf + 1, NULL, 10); - return (code > 0 && code <= 0x10ffff) ? code : 0xFFFD; + return (code > 0 && code <= 0x10ffff) ? code : FZ_REPLACEMENT_CHARACTER; } static const char *empty_dup_list[] = { 0 }; diff --git a/source/pdf/pdf-op-run.c b/source/pdf/pdf-op-run.c index 8a0ba446..f088139e 100644 --- a/source/pdf/pdf-op-run.c +++ b/source/pdf/pdf-op-run.c @@ -909,7 +909,7 @@ pdf_show_char(fz_context *ctx, pdf_run_processor *pr, int cid) } if (ucslen == 0 || (ucslen == 1 && ucsbuf[0] == 0)) { - ucsbuf[0] = 0xFFFD; + ucsbuf[0] = FZ_REPLACEMENT_CHARACTER; ucslen = 1; } diff --git a/source/pdf/pdf-parse.c b/source/pdf/pdf-parse.c index e75baa60..084ffc19 100644 --- a/source/pdf/pdf-parse.c +++ b/source/pdf/pdf-parse.c @@ -54,7 +54,7 @@ rune_from_utf16be(int *out, unsigned char *s, unsigned char *end) *out = a; return 2; } - *out = 0xFFFD; + *out = FZ_REPLACEMENT_CHARACTER; return 1; } diff --git a/source/pdf/pdf-type3.c b/source/pdf/pdf-type3.c index b7c10c4e..9701cf54 100644 --- a/source/pdf/pdf-type3.c +++ b/source/pdf/pdf-type3.c @@ -114,7 +114,7 @@ pdf_load_type3_font(fz_context *ctx, pdf_document *doc, pdf_obj *rdb, pdf_obj *d if (fontdesc->cid_to_ucs_len == 256) { for (i = 32; i < 127; ++i) - if (fontdesc->cid_to_ucs[i] == 0xFFFD) + if (fontdesc->cid_to_ucs[i] == FZ_REPLACEMENT_CHARACTER) fontdesc->cid_to_ucs[i] = i; } diff --git a/source/pdf/pdf-unicode.c b/source/pdf/pdf-unicode.c index c599b202..9cc378c8 100644 --- a/source/pdf/pdf-unicode.c +++ b/source/pdf/pdf-unicode.c @@ -107,7 +107,7 @@ pdf_load_to_unicode(fz_context *ctx, pdf_document *doc, pdf_font_desc *font, if (strings[cpt]) font->cid_to_ucs[cpt] = pdf_lookup_agl(strings[cpt]); else - font->cid_to_ucs[cpt] = 0xFFFD; /* replacement character */ + font->cid_to_ucs[cpt] = FZ_REPLACEMENT_CHARACTER; } } diff --git a/source/xps/xps-glyphs.c b/source/xps/xps-glyphs.c index 55a8a362..29dc5b39 100644 --- a/source/xps/xps-glyphs.c +++ b/source/xps/xps-glyphs.c @@ -378,7 +378,7 @@ xps_parse_glyphs_imp(fz_context *ctx, xps_document *doc, const fz_matrix *ctm, while ((us && un > 0) || (is && *is)) { - int char_code = 0xFFFD; + int char_code = FZ_REPLACEMENT_CHARACTER; int code_count = 1; int glyph_count = 1; |