summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2017-06-19 14:37:59 +0200
committerRobin Watts <robin.watts@artifex.com>2017-06-22 15:46:56 +0100
commitc444b1b1a593ab253944cc2b33f22733115c0ff7 (patch)
tree2f6d52f6186e4c894bdf2741481bb7fd31cee4cb
parent638384c10ff1b7b1233bec1d62db3e82cffeaafc (diff)
downloadmupdf-c444b1b1a593ab253944cc2b33f22733115c0ff7.tar.xz
Use unsigned char arrays in hexdumped data.
-rw-r--r--include/mupdf/fitz/buffer.h2
-rw-r--r--include/mupdf/fitz/font.h14
-rw-r--r--include/mupdf/pdf/font.h2
-rw-r--r--platform/gl/gl-font.c2
-rw-r--r--scripts/hexdump.c2
-rw-r--r--source/fitz/buffer.c2
-rw-r--r--source/fitz/colorspace.c2
-rw-r--r--source/fitz/font.c8
-rw-r--r--source/fitz/noto.c14
-rw-r--r--source/html/html-font.c4
-rw-r--r--source/pdf/pdf-font.c10
-rw-r--r--source/pdf/pdf-js.c4
-rw-r--r--source/tools/murun.c4
-rw-r--r--source/tools/pdfcreate.c2
-rw-r--r--source/tools/pdfportfolio.c4
15 files changed, 38 insertions, 38 deletions
diff --git a/include/mupdf/fitz/buffer.h b/include/mupdf/fitz/buffer.h
index c6f4c2a4..54c1078b 100644
--- a/include/mupdf/fitz/buffer.h
+++ b/include/mupdf/fitz/buffer.h
@@ -66,7 +66,7 @@ fz_buffer *fz_new_buffer_from_data(fz_context *ctx, unsigned char *data, size_t
/*
fz_new_buffer_from_shared_data: Like fz_new_buffer, but does not take ownership.
*/
-fz_buffer *fz_new_buffer_from_shared_data(fz_context *ctx, const char *data, size_t size);
+fz_buffer *fz_new_buffer_from_shared_data(fz_context *ctx, const unsigned char *data, size_t size);
/*
fz_new_buffer_from_base64: Create a new buffer with data decoded from a base64 input string.
diff --git a/include/mupdf/fitz/font.h b/include/mupdf/fitz/font.h
index 1a736084..c47702be 100644
--- a/include/mupdf/fitz/font.h
+++ b/include/mupdf/fitz/font.h
@@ -250,7 +250,7 @@ fz_font *fz_load_system_cjk_font(fz_context *ctx, const char *name, int ros, int
Returns a pointer to the font file data, or NULL if not present.
*/
-const char *fz_lookup_builtin_font(fz_context *ctx, const char *name, int bold, int italic, int *len);
+const unsigned char *fz_lookup_builtin_font(fz_context *ctx, const char *name, int bold, int italic, int *len);
/*
fz_lookup_base14_font: Search the builtin base14 fonts for a match.
@@ -264,7 +264,7 @@ const char *fz_lookup_builtin_font(fz_context *ctx, const char *name, int bold,
Returns a pointer to the font file data, or NULL if not present.
*/
-const char *fz_lookup_base14_font(fz_context *ctx, const char *name, int *len);
+const unsigned char *fz_lookup_base14_font(fz_context *ctx, const char *name, int *len);
/* ToDo: Share fz_lookup_builtin_font and fz_lookup_icc? Check with Tor */
/*
@@ -298,7 +298,7 @@ const unsigned char *fz_lookup_icc(fz_context *ctx, const char *name, size_t *le
Returns a pointer to the font file data, or NULL if not present.
*/
-const char *fz_lookup_cjk_font(fz_context *ctx, int registry, int serif, int wmode, int *len, int *index);
+const unsigned char *fz_lookup_cjk_font(fz_context *ctx, int registry, int serif, int wmode, int *len, int *index);
/*
fz_lookup_noto_font: Search the builtin noto fonts for a match.
@@ -316,7 +316,7 @@ const char *fz_lookup_cjk_font(fz_context *ctx, int registry, int serif, int wmo
Returns a pointer to the font file data, or NULL if not present.
*/
-const char *fz_lookup_noto_font(fz_context *ctx, int script, int lang, int serif, int *len);
+const unsigned char *fz_lookup_noto_font(fz_context *ctx, int script, int lang, int serif, int *len);
/*
fz_lookup_noto_symbol_font: Search the builtin noto fonts
@@ -328,7 +328,7 @@ const char *fz_lookup_noto_font(fz_context *ctx, int script, int lang, int serif
Returns a pointer to the font file data, or NULL if not present.
*/
-const char *fz_lookup_noto_symbol_font(fz_context *ctx, int *len);
+const unsigned char *fz_lookup_noto_symbol_font(fz_context *ctx, int *len);
/*
fz_lookup_noto_emoji_font: Search the builtin noto fonts
@@ -340,7 +340,7 @@ const char *fz_lookup_noto_symbol_font(fz_context *ctx, int *len);
Returns a pointer to the font file data, or NULL if not present.
*/
-const char *fz_lookup_noto_emoji_font(fz_context *ctx, int *len);
+const unsigned char *fz_lookup_noto_emoji_font(fz_context *ctx, int *len);
/*
fz_load_fallback_font: Try to load a fallback font for the
@@ -408,7 +408,7 @@ fz_font *fz_new_type3_font(fz_context *ctx, const char *name, const fz_matrix *m
Returns new font handle, or throws exception on error.
*/
-fz_font *fz_new_font_from_memory(fz_context *ctx, const char *name, const char *data, int len, int index, int use_glyph_bbox);
+fz_font *fz_new_font_from_memory(fz_context *ctx, const char *name, const unsigned char *data, int len, int index, int use_glyph_bbox);
/*
fz_new_font_from_buffer: Create a new font from a font
diff --git a/include/mupdf/pdf/font.h b/include/mupdf/pdf/font.h
index a68aab90..51e9cd43 100644
--- a/include/mupdf/pdf/font.h
+++ b/include/mupdf/pdf/font.h
@@ -103,7 +103,7 @@ void pdf_load_to_unicode(fz_context *ctx, pdf_document *doc, pdf_font_desc *font
int pdf_font_cid_to_gid(fz_context *ctx, pdf_font_desc *fontdesc, int cid);
-const char *pdf_lookup_substitute_font(fz_context *ctx, int mono, int serif, int bold, int italic, int *len);
+const unsigned char *pdf_lookup_substitute_font(fz_context *ctx, int mono, int serif, int bold, int italic, int *len);
pdf_font_desc *pdf_load_type3_font(fz_context *ctx, pdf_document *doc, pdf_obj *rdb, pdf_obj *obj);
void pdf_load_type3_glyphs(fz_context *ctx, pdf_document *doc, pdf_font_desc *fontdesc, int nestedDepth);
diff --git a/platform/gl/gl-font.c b/platform/gl/gl-font.c
index 98bb62af..44f42c3c 100644
--- a/platform/gl/gl-font.c
+++ b/platform/gl/gl-font.c
@@ -78,7 +78,7 @@ static void clear_font_cache(void)
void ui_init_fonts(fz_context *ctx, float pixelsize)
{
- const char *data;
+ const unsigned char *data;
int size;
glGenTextures(1, &g_cache_tex);
diff --git a/scripts/hexdump.c b/scripts/hexdump.c
index 18f6ac15..3e35105d 100644
--- a/scripts/hexdump.c
+++ b/scripts/hexdump.c
@@ -107,7 +107,7 @@ main(int argc, char **argv)
fseek(fi, 0, SEEK_SET);
fprintf(fo, "const int fz_%s_size = %d;\n", filename, size + zero);
- fprintf(fo, "const char fz_%s[] =", filename);
+ fprintf(fo, "const unsigned char fz_%s[] =", filename);
fprintf(fo, string ? "\n" : " {\n");
hexdump(fo, fi);
if (!zero)
diff --git a/source/fitz/buffer.c b/source/fitz/buffer.c
index 96aa36a6..49c35726 100644
--- a/source/fitz/buffer.c
+++ b/source/fitz/buffer.c
@@ -52,7 +52,7 @@ fz_new_buffer_from_data(fz_context *ctx, unsigned char *data, size_t size)
}
fz_buffer *
-fz_new_buffer_from_shared_data(fz_context *ctx, const char *data, size_t size)
+fz_new_buffer_from_shared_data(fz_context *ctx, const unsigned char *data, size_t size)
{
fz_buffer *b;
diff --git a/source/fitz/colorspace.c b/source/fitz/colorspace.c
index d040b076..05b46ac6 100644
--- a/source/fitz/colorspace.c
+++ b/source/fitz/colorspace.c
@@ -2992,7 +2992,7 @@ fz_new_icc_colorspace(fz_context *ctx, int is_static, int num, fz_buffer *buf, c
size_t size;
const unsigned char *data;
data = fz_lookup_icc(ctx, name, &size);
- profile->buffer = fz_new_buffer_from_shared_data(ctx, (const char *)data, size);
+ profile->buffer = fz_new_buffer_from_shared_data(ctx, data, size);
is_lab = (strcmp(name, "lab-icc") == 0);
profile->bgr = (strcmp(name, "bgr-icc") == 0);
}
diff --git a/source/fitz/font.c b/source/fitz/font.c
index 79b17458..4c90e5f8 100644
--- a/source/fitz/font.c
+++ b/source/fitz/font.c
@@ -317,7 +317,7 @@ fz_font *fz_load_system_fallback_font(fz_context *ctx, int script, int language,
fz_font *fz_load_fallback_font(fz_context *ctx, int script, int language, int serif, int bold, int italic)
{
fz_font **fontp;
- const char *data;
+ const unsigned char *data;
int index;
int size;
@@ -364,7 +364,7 @@ fz_font *fz_load_fallback_font(fz_context *ctx, int script, int language, int se
fz_font *fz_load_fallback_symbol_font(fz_context *ctx)
{
- const char *data;
+ const unsigned char *data;
int size;
if (!ctx->font->symbol)
{
@@ -377,7 +377,7 @@ fz_font *fz_load_fallback_symbol_font(fz_context *ctx)
fz_font *fz_load_fallback_emoji_font(fz_context *ctx)
{
- const char *data;
+ const unsigned char *data;
int size;
if (!ctx->font->emoji)
{
@@ -515,7 +515,7 @@ fz_new_font_from_buffer(fz_context *ctx, const char *name, fz_buffer *buffer, in
}
fz_font *
-fz_new_font_from_memory(fz_context *ctx, const char *name, const char *data, int len, int index, int use_glyph_bbox)
+fz_new_font_from_memory(fz_context *ctx, const char *name, const unsigned char *data, int len, int index, int use_glyph_bbox)
{
fz_buffer *buffer = fz_new_buffer_from_shared_data(ctx, data, len);
fz_font *font;
diff --git a/source/fitz/noto.c b/source/fitz/noto.c
index eb070261..f6951ba2 100644
--- a/source/fitz/noto.c
+++ b/source/fitz/noto.c
@@ -51,11 +51,11 @@
#define RETURN(NAME) \
do { \
extern const int fz_resources_fonts_ ## NAME ## _size; \
- extern const char fz_resources_fonts_ ## NAME []; \
+ extern const unsigned char fz_resources_fonts_ ## NAME []; \
return *size = fz_resources_fonts_ ## NAME ## _size, fz_resources_fonts_ ## NAME; \
} while (0)
-const char *
+const unsigned char *
fz_lookup_base14_font(fz_context *ctx, const char *name, int *size)
{
#ifndef TOFU_BASE14
@@ -84,7 +84,7 @@ fz_lookup_base14_font(fz_context *ctx, const char *name, int *size)
if (!is_italic) RETURN(B); else RETURN(BI); \
}
-const char *
+const unsigned char *
fz_lookup_builtin_font(fz_context *ctx, const char *name, int is_bold, int is_italic, int *size)
{
#ifndef TOFU_BASE14
@@ -137,7 +137,7 @@ fz_lookup_builtin_font(fz_context *ctx, const char *name, int is_bold, int is_it
return *size = 0, NULL;
}
-const char *
+const unsigned char *
fz_lookup_cjk_font(fz_context *ctx, int registry, int serif, int wmode, int *size, int *index)
{
if (index) *index = 0;
@@ -167,7 +167,7 @@ fz_lookup_cjk_font(fz_context *ctx, int registry, int serif, int wmode, int *siz
#define Noto2(SANS,SERIF) \
if (serif) { RETURN(noto_Noto ## SERIF ## _Regular_ttf); } else { RETURN(noto_Noto ## SANS ## _Regular_ttf); }
-const char *
+const unsigned char *
fz_lookup_noto_font(fz_context *ctx, int script, int language, int serif, int *size)
{
/* TODO: Noto(SansSyriacEstrangela); */
@@ -348,7 +348,7 @@ fz_lookup_noto_font(fz_context *ctx, int script, int language, int serif, int *s
return *size = 0, NULL;
}
-const char *
+const unsigned char *
fz_lookup_noto_symbol_font(fz_context *ctx, int *size)
{
#ifndef TOFU_SYMBOL
@@ -358,7 +358,7 @@ fz_lookup_noto_symbol_font(fz_context *ctx, int *size)
#endif
}
-const char *
+const unsigned char *
fz_lookup_noto_emoji_font(fz_context *ctx, int *size)
{
#ifndef TOFU_EMOJI
diff --git a/source/html/html-font.c b/source/html/html-font.c
index cf572440..d319a462 100644
--- a/source/html/html-font.c
+++ b/source/html/html-font.c
@@ -13,7 +13,7 @@ fz_load_html_default_font(fz_context *ctx, fz_html_font_set *set, const char *fa
int idx = (is_mono ? 8 : is_sans ? 4 : 0) + is_bold * 2 + is_italic;
if (!set->fonts[idx])
{
- const char *data;
+ const unsigned char *data;
int size;
data = fz_lookup_builtin_font(ctx, real_family, is_bold, is_italic, &size);
@@ -46,7 +46,7 @@ fz_font *
fz_load_html_font(fz_context *ctx, fz_html_font_set *set, const char *family, int is_bold, int is_italic)
{
fz_html_font_face *custom;
- const char *data;
+ const unsigned char *data;
int size;
for (custom = set->custom; custom; custom = custom->next)
diff --git a/source/pdf/pdf-font.c b/source/pdf/pdf-font.c
index 11349534..0088b09c 100644
--- a/source/pdf/pdf-font.c
+++ b/source/pdf/pdf-font.c
@@ -53,7 +53,7 @@ static const char *base_font_names[][10] =
{ "ZapfDingbats", NULL }
};
-const char *
+const unsigned char *
pdf_lookup_substitute_font(fz_context *ctx, int mono, int serif, int bold, int italic, int *len)
{
if (mono) {
@@ -132,7 +132,7 @@ static int is_builtin_font(fz_context *ctx, fz_font *font)
if (!font->buffer)
return 0;
fz_buffer_storage(ctx, font->buffer, &data);
- return fz_lookup_base14_font(ctx, clean_font_name(font->name), &size) == (char*)data;
+ return fz_lookup_base14_font(ctx, clean_font_name(font->name), &size) == data;
}
/*
@@ -349,7 +349,7 @@ pdf_load_builtin_font(fz_context *ctx, pdf_font_desc *fontdesc, const char *font
fontdesc->font = fz_load_system_font(ctx, fontname, 0, 0, !has_descriptor);
if (!fontdesc->font)
{
- const char *data;
+ const unsigned char *data;
int len;
data = fz_lookup_base14_font(ctx, clean_name, &len);
@@ -374,7 +374,7 @@ pdf_load_substitute_font(fz_context *ctx, pdf_font_desc *fontdesc, const char *f
fontdesc->font = fz_load_system_font(ctx, fontname, bold, italic, 0);
if (!fontdesc->font)
{
- const char *data;
+ const unsigned char *data;
int len;
data = pdf_lookup_substitute_font(ctx, mono, serif, bold, italic, &len);
@@ -401,7 +401,7 @@ pdf_load_substitute_cjk_font(fz_context *ctx, pdf_font_desc *fontdesc, const cha
fontdesc->font = fz_load_system_cjk_font(ctx, fontname, ros, serif);
if (!fontdesc->font)
{
- const char *data;
+ const unsigned char *data;
int len;
int index;
diff --git a/source/pdf/pdf-js.c b/source/pdf/pdf-js.c
index e4bccc28..4ff1c601 100644
--- a/source/pdf/pdf-js.c
+++ b/source/pdf/pdf-js.c
@@ -562,7 +562,7 @@ static void declare_dom(pdf_js *js)
js_setglobal(J, "MuPDF_Doc"); /* for pdf-util.js use */
}
-extern const char fz_source_pdf_pdf_js_util_js[];
+extern const unsigned char fz_source_pdf_pdf_js_util_js[];
static void preload_helpers(pdf_js *js)
{
@@ -582,7 +582,7 @@ static void preload_helpers(pdf_js *js)
);
#endif
- js_dostring(js->imp, fz_source_pdf_pdf_js_util_js);
+ js_dostring(js->imp, (const char *)fz_source_pdf_pdf_js_util_js);
}
void pdf_drop_js(fz_context *ctx, pdf_js *js)
diff --git a/source/tools/murun.c b/source/tools/murun.c
index 47cc1884..5e627295 100644
--- a/source/tools/murun.c
+++ b/source/tools/murun.c
@@ -763,7 +763,7 @@ static fz_buffer *ffi_tobuffer(js_State *J, int idx)
else {
const char *str = js_tostring(J, idx);
fz_try(ctx)
- buf = fz_new_buffer_from_shared_data(ctx, str, strlen(str));
+ buf = fz_new_buffer_from_shared_data(ctx, (const unsigned char *)str, strlen(str));
fz_catch(ctx)
rethrow(J);
}
@@ -2253,7 +2253,7 @@ static void ffi_new_Font(js_State *J)
fz_context *ctx = js_getcontext(J);
const char *name = js_tostring(J, 1);
int index = js_isnumber(J, 2) ? js_tonumber(J, 2) : 0;
- const char *data;
+ const unsigned char *data;
int size;
fz_font *font = NULL;
diff --git a/source/tools/pdfcreate.c b/source/tools/pdfcreate.c
index f4fec946..b1649500 100644
--- a/source/tools/pdfcreate.c
+++ b/source/tools/pdfcreate.c
@@ -33,7 +33,7 @@ static pdf_document *doc = NULL;
static void add_font_res(pdf_obj *resources, char *name, char *path)
{
- const char *data;
+ const unsigned char *data;
int size;
fz_font *font;
pdf_obj *subres, *ref;
diff --git a/source/tools/pdfportfolio.c b/source/tools/pdfportfolio.c
index a473968b..9f08cff1 100644
--- a/source/tools/pdfportfolio.c
+++ b/source/tools/pdfportfolio.c
@@ -244,7 +244,7 @@ int pdfportfolio_main(int argc, char **argv)
/* add a blank page */
{
const char *template = "BT /Tm 16 Tf 50 434 TD (This is a portfolio document.) Tj ET\n";
- const char *data;
+ const unsigned char *data;
int size;
fz_font *font;
pdf_obj *font_obj, *page_obj;
@@ -260,7 +260,7 @@ int pdfportfolio_main(int argc, char **argv)
resources = pdf_add_object_drop(ctx, doc, pdf_new_dict(ctx, doc, 1));
pdf_dict_putp_drop(ctx, resources, "Font/Tm", font_obj);
- contents = fz_new_buffer_from_shared_data(ctx, template, strlen(template));
+ contents = fz_new_buffer_from_shared_data(ctx, (const unsigned char *)template, strlen(template));
page_obj = pdf_add_page(ctx, doc, &mediabox, 0, resources, contents);
pdf_insert_page(ctx, doc, -1, page_obj);