summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2014-05-13 14:19:57 +0200
committerTor Andersson <tor.andersson@artifex.com>2014-05-13 14:44:18 +0200
commit4a1d6f9886c141e165c281f127c0cb387c6407d6 (patch)
treed031c88c4485731e1f06e52235fe24d7b48e8f4b /source
parent11366353e1e88805f25053825cfd99be035cd245 (diff)
downloadmupdf-4a1d6f9886c141e165c281f127c0cb387c6407d6.tar.xz
Fix signedness in cmap interface.
Diffstat (limited to 'source')
-rw-r--r--source/pdf/pdf-cmap.c16
-rw-r--r--source/pdf/pdf-op-run.c3
-rw-r--r--source/pdf/pdf-unicode.c17
3 files changed, 20 insertions, 16 deletions
diff --git a/source/pdf/pdf-cmap.c b/source/pdf/pdf-cmap.c
index db628f23..e9eb25b2 100644
--- a/source/pdf/pdf-cmap.c
+++ b/source/pdf/pdf-cmap.c
@@ -73,7 +73,7 @@ pdf_set_cmap_wmode(fz_context *ctx, pdf_cmap *cmap, int wmode)
* multi-byte encoded strings.
*/
void
-pdf_add_codespace(fz_context *ctx, pdf_cmap *cmap, int low, int high, int n)
+pdf_add_codespace(fz_context *ctx, pdf_cmap *cmap, unsigned int low, unsigned int high, int n)
{
if (cmap->codespace_len + 1 == nelem(cmap->codespace))
{
@@ -153,7 +153,7 @@ add_mrange(fz_context *ctx, pdf_cmap *cmap, unsigned int low, int *out, int len)
* Add a range-to-table mapping.
*/
void
-pdf_map_range_to_table(fz_context *ctx, pdf_cmap *cmap, int low, int *table, int len)
+pdf_map_range_to_table(fz_context *ctx, pdf_cmap *cmap, unsigned int low, int *table, int len)
{
int i;
for (i = 0; i < len; i++)
@@ -164,7 +164,7 @@ pdf_map_range_to_table(fz_context *ctx, pdf_cmap *cmap, int low, int *table, int
* Add a range of contiguous one-to-one mappings (ie 1..5 maps to 21..25)
*/
void
-pdf_map_range_to_range(fz_context *ctx, pdf_cmap *cmap, int low, int high, int out)
+pdf_map_range_to_range(fz_context *ctx, pdf_cmap *cmap, unsigned int low, unsigned int high, int out)
{
add_range(ctx, cmap, low, high, out);
}
@@ -173,7 +173,7 @@ pdf_map_range_to_range(fz_context *ctx, pdf_cmap *cmap, int low, int high, int o
* Add a single one-to-many mapping.
*/
void
-pdf_map_one_to_many(fz_context *ctx, pdf_cmap *cmap, int low, int *values, int len)
+pdf_map_one_to_many(fz_context *ctx, pdf_cmap *cmap, unsigned int low, int *values, int len)
{
if (len == 1)
{
@@ -315,7 +315,8 @@ pdf_lookup_cmap_full(pdf_cmap *cmap, unsigned int cpt, int *out)
pdf_range *ranges = cmap->ranges;
pdf_xrange *xranges = cmap->xranges;
pdf_mrange *mranges = cmap->mranges;
- int l, r, m, i;
+ unsigned int i;
+ int l, r, m;
l = 0;
r = cmap->rlen - 1;
@@ -377,9 +378,10 @@ pdf_lookup_cmap_full(pdf_cmap *cmap, unsigned int cpt, int *out)
* multi-byte encoded string.
*/
int
-pdf_decode_cmap(pdf_cmap *cmap, unsigned char *buf, unsigned char *end, int *cpt)
+pdf_decode_cmap(pdf_cmap *cmap, unsigned char *buf, unsigned char *end, unsigned int *cpt)
{
- int k, n, c;
+ unsigned int c;
+ int k, n;
int len = end - buf;
if (len > 4)
diff --git a/source/pdf/pdf-op-run.c b/source/pdf/pdf-op-run.c
index ab1bf246..2f4a8c0a 100644
--- a/source/pdf/pdf-op-run.c
+++ b/source/pdf/pdf-op-run.c
@@ -1197,7 +1197,8 @@ pdf_show_string(pdf_csi *csi, pdf_run_state *pr, unsigned char *buf, int len)
pdf_gstate *gstate = pr->gstate + pr->gtop;
pdf_font_desc *fontdesc = gstate->font;
unsigned char *end = buf + len;
- int cpt, cid;
+ unsigned int cpt;
+ int cid;
if (!fontdesc)
{
diff --git a/source/pdf/pdf-unicode.c b/source/pdf/pdf-unicode.c
index c241dbc7..a6891655 100644
--- a/source/pdf/pdf-unicode.c
+++ b/source/pdf/pdf-unicode.c
@@ -7,10 +7,10 @@ pdf_load_to_unicode(pdf_document *doc, pdf_font_desc *font,
char **strings, char *collection, pdf_obj *cmapstm)
{
pdf_cmap *cmap;
+ unsigned int cpt;
int cid;
int ucsbuf[8];
int ucslen;
- int i;
fz_context *ctx = doc->ctx;
if (pdf_is_stream(doc, pdf_to_num(cmapstm), pdf_to_gen(cmapstm)))
@@ -19,12 +19,13 @@ pdf_load_to_unicode(pdf_document *doc, pdf_font_desc *font,
font->to_unicode = pdf_new_cmap(ctx);
- for (i = 0; i < (strings ? 256 : 65536); i++)
+ /* TODO: use codespace ranges */
+ for (cpt = 0; cpt < (strings ? 256 : 65536); cpt++)
{
- cid = pdf_lookup_cmap(font->encoding, i);
+ cid = pdf_lookup_cmap(font->encoding, cpt);
if (cid >= 0)
{
- ucslen = pdf_lookup_cmap_full(cmap, i, ucsbuf);
+ ucslen = pdf_lookup_cmap_full(cmap, cpt, ucsbuf);
if (ucslen == 1)
pdf_map_range_to_range(ctx, font->to_unicode, cid, cid, ucsbuf[0]);
if (ucslen > 1)
@@ -60,12 +61,12 @@ pdf_load_to_unicode(pdf_document *doc, pdf_font_desc *font,
font->cid_to_ucs = fz_malloc_array(ctx, 256, sizeof(unsigned short));
font->size += 256 * sizeof(unsigned short);
- for (i = 0; i < 256; i++)
+ for (cpt = 0; cpt < 256; cpt++)
{
- if (strings[i])
- font->cid_to_ucs[i] = pdf_lookup_agl(strings[i]);
+ if (strings[cpt])
+ font->cid_to_ucs[cpt] = pdf_lookup_agl(strings[cpt]);
else
- font->cid_to_ucs[i] = '?';
+ font->cid_to_ucs[cpt] = '?';
}
}