summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mupdf/fitz/string-util.h3
-rw-r--r--source/fitz/stext-search.c2
-rw-r--r--source/fitz/util.c2
-rw-r--r--source/pdf/pdf-encoding.c2
-rw-r--r--source/pdf/pdf-op-run.c2
-rw-r--r--source/pdf/pdf-parse.c2
-rw-r--r--source/pdf/pdf-type3.c2
-rw-r--r--source/pdf/pdf-unicode.c2
-rw-r--r--source/xps/xps-glyphs.c2
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;