[gs-commits] mupdf 1.16.1.52 Avoid signedness warnings when size of ar
[email protected] (Sebastian Rasmussen) Tue, 1 Oct 2019 14:55:50 +0000 (UTC)
| Newsgroups | gmane.comp.printing.ghostscript.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit 2ad88b8cabdafd9438084d32c20c4728442d81da Author: Sebastian Rasmussen <[email protected]> Date: Fri Sep 27 16:40:48 2019 +0200 Avoid signedness warnings when size of array/type is known. Since most code already uses int, cast the result of sizeof() to int if the array/type size will not become too large. diff --git a/platform/gl/gl-annotate.c b/platform/gl/gl-annotate.c index d543aa3..a941bd7 100644 --- a/platform/gl/gl-annotate.c +++ b/platform/gl/gl-annotate.c @@ -272,7 +272,7 @@ static const char *name_from_hex(unsigned int hex) { static char buf[10]; int i; - for (i = 0; i < nelem(color_names); ++i) + for (i = 0; i < (int)nelem(color_names); ++i) if (color_values[i] == hex) return color_names[i]; fz_snprintf(buf, sizeof buf, "#%06x", hex & 0xffffff); @@ -973,7 +973,7 @@ static void do_edit_ink(fz_irect canvas_area) if (ui.active == selected_annot && drawing) { - if (n < nelem(p) && (ui.x != last_x || ui.y != last_y)) + if (n < (int)nelem(p) && (ui.x != last_x || ui.y != last_y)) { p[n].x = fz_clamp(ui.x, view_page_area.x0, view_page_area.x1); p[n].y = fz_clamp(ui.y, view_page_area.y0, view_page_area.y1); diff --git a/platform/gl/gl-file.c b/platform/gl/gl-file.c index b8fde93..84ab076 100644 --- a/platform/gl/gl-file.c +++ b/platform/gl/gl-file.c @@ -211,7 +211,7 @@ static void load_dir(const char *path) } else { - while ((dp = readdir(dir)) && fc.count < nelem(fc.files)) + while ((dp = readdir(dir)) && fc.count < (int)nelem(fc.files)) { /* skip hidden files */ if (dp->d_name[0] == '.' && strcmp(dp->d_name, ".") && strcmp(dp->d_name, "..")) @@ -282,7 +282,7 @@ static void list_drives(void) ui_list_begin(&drive_list, nelem(common_dirs), 0, nelem(common_dirs) * ui.lineheight + 4); - for (i = 0; i < nelem(common_dirs); ++i) + for (i = 0; i < (int)nelem(common_dirs); ++i) if (has_dir(home, user, i, dir, vis)) if (ui_list_item(&drive_list, common_dirs[i].name, vis, 0)) load_dir(dir); diff --git a/platform/gl/gl-main.c b/platform/gl/gl-main.c index f543185..9cd7218 100644 --- a/platform/gl/gl-main.c +++ b/platform/gl/gl-main.c @@ -93,7 +93,7 @@ static const int zoom_list[] = { static int zoom_in(int oldres) { int i; - for (i = 0; i < nelem(zoom_list) - 1; ++i) + for (i = 0; i < (int)nelem(zoom_list) - 1; ++i) if (zoom_list[i] <= oldres && zoom_list[i+1] > oldres) return zoom_list[i+1]; return zoom_list[i]; @@ -102,7 +102,7 @@ static int zoom_in(int oldres) static int zoom_out(int oldres) { int i; - for (i = 0; i < nelem(zoom_list) - 1; ++i) + for (i = 0; i < (int)nelem(zoom_list) - 1; ++i) if (zoom_list[i] < oldres && zoom_list[i+1] >= oldres) return zoom_list[i]; return zoom_list[0]; @@ -357,7 +357,7 @@ static void save_history(void) js_setproperty(J, -2, "future"); js_newarray(J); - for (i = 0; i < nelem(marks); ++i) + for (i = 0; i < (int)nelem(marks); ++i) { js_pushnumber(J, marks[i].page+1); js_setindex(J, -2, i); @@ -666,7 +666,7 @@ static void push_history(void) { if (history_count > 0 && history[history_count-1].page == currentpage) return; - if (history_count + 1 >= nelem(history)) + if (history_count + 1 >= (int)nelem(history)) { memmove(history, history + 1, sizeof *history * (nelem(history) - 1)); history[history_count] = save_mark(); @@ -679,7 +679,7 @@ static void push_history(void) static void push_future(void) { - if (future_count + 1 >= nelem(future)) + if (future_count + 1 >= (int)nelem(future)) { memmove(future, future + 1, sizeof *future * (nelem(future) - 1)); future[future_count] = save_mark(); @@ -1243,7 +1243,7 @@ static void do_app(void) case 'm': if (number == 0) push_history(); - else if (number > 0 && number < nelem(marks)) + else if (number > 0 && number < (int)nelem(marks)) marks[number] = save_mark(); break; case 't': @@ -1252,7 +1252,7 @@ static void do_app(void) if (history_count > 0) pop_history(); } - else if (number > 0 && number < nelem(marks)) + else if (number > 0 && number < (int)nelem(marks)) { struct mark mark = marks[number]; restore_mark(mark); diff --git a/platform/x11/pdfapp.c b/platform/x11/pdfapp.c index 468df13..ef7d174 100644 --- a/platform/x11/pdfapp.c +++ b/platform/x11/pdfapp.c @@ -60,7 +60,7 @@ static const int zoomlist[] = { static int zoom_in(int oldres) { int i; - for (i = 0; i < nelem(zoomlist) - 1; ++i) + for (i = 0; i < (int)nelem(zoomlist) - 1; ++i) if (zoomlist[i] <= oldres && zoomlist[i+1] > oldres) return zoomlist[i+1]; return zoomlist[i]; @@ -69,7 +69,7 @@ static int zoom_in(int oldres) static int zoom_out(int oldres) { int i; - for (i = 0; i < nelem(zoomlist) - 1; ++i) + for (i = 0; i < (int)nelem(zoomlist) - 1; ++i) if (zoomlist[i] < oldres && zoomlist[i+1] >= oldres) return zoomlist[i]; return zoomlist[0]; @@ -1420,7 +1420,7 @@ void pdfapp_onkey(pdfapp_t *app, int c, int modifiers) if (app->numberlen > 0) { int idx = atoi(app->number); - if (idx >= 0 && idx < nelem(app->marks)) + if (idx >= 0 && idx < (int)nelem(app->marks)) app->marks[idx] = app->pageno; } else @@ -1439,7 +1439,7 @@ void pdfapp_onkey(pdfapp_t *app, int c, int modifiers) { int idx = atoi(app->number); - if (idx >= 0 && idx < nelem(app->marks)) + if (idx >= 0 && idx < (int)nelem(app->marks)) if (app->marks[idx] > 0) app->pageno = app->marks[idx]; } diff --git a/source/fitz/colorspace.c b/source/fitz/colorspace.c index 240eab0..8d245ce 100644 --- a/source/fitz/colorspace.c +++ b/source/fitz/colorspace.c @@ -156,7 +156,7 @@ static const char *fz_intent_names[] = int fz_lookup_rendering_intent(const char *name) { int i; - for (i = 0; i < nelem(fz_intent_names); i++) + for (i = 0; i < (int)nelem(fz_intent_names); i++) if (!strcmp(name, fz_intent_names[i])) return i; return FZ_RI_RELATIVE_COLORIMETRIC; @@ -164,7 +164,7 @@ int fz_lookup_rendering_intent(const char *name) const char *fz_rendering_intent_name(int ri) { - if (ri >= 0 && ri < nelem(fz_intent_names)) + if (ri >= 0 && ri < (int)nelem(fz_intent_names)) return fz_intent_names[ri]; return "RelativeColorimetric"; } diff --git a/source/fitz/draw-blend.c b/source/fitz/draw-blend.c index d565d80..179ea80 100644 --- a/source/fitz/draw-blend.c +++ b/source/fitz/draw-blend.c @@ -107,7 +107,7 @@ static const char *fz_blendmode_names[] = int fz_lookup_blendmode(const char *name) { int i; - for (i = 0; i < nelem(fz_blendmode_names); i++) + for (i = 0; i < (int)nelem(fz_blendmode_names); i++) if (!strcmp(name, fz_blendmode_names[i])) return i; return FZ_BLEND_NORMAL; @@ -115,7 +115,7 @@ int fz_lookup_blendmode(const char *name) char *fz_blendmode_name(int blendmode) { - if (blendmode >= 0 && blendmode < nelem(fz_blendmode_names)) + if (blendmode >= 0 && blendmode < (int)nelem(fz_blendmode_names)) return (char*)fz_blendmode_names[blendmode]; return "Normal"; } diff --git a/source/fitz/draw-unpack.c b/source/fitz/draw-unpack.c index c87887d..e7f206a 100644 --- a/source/fitz/draw-unpack.c +++ b/source/fitz/draw-unpack.c @@ -237,7 +237,7 @@ fz_unpack_tile(fz_context *ctx, fz_pixmap *dst, unsigned char *src, int n, int d } } } - else if (depth > 0 && depth <= 8 * sizeof(int)) + else if (depth > 0 && depth <= 8 * (int)sizeof(int)) { fz_stream *stm; int x, k; diff --git a/source/fitz/font.c b/source/fitz/font.c index 592d56c..7dfd3e2 100644 --- a/source/fitz/font.c +++ b/source/fitz/font.c @@ -388,11 +388,11 @@ void fz_drop_font_context(fz_context *ctx) { int i; - for (i = 0; i < nelem(ctx->font->base14); ++i) + for (i = 0; i < (int)nelem(ctx->font->base14); ++i) fz_drop_font(ctx, ctx->font->base14[i]); - for (i = 0; i < nelem(ctx->font->cjk); ++i) + for (i = 0; i < (int)nelem(ctx->font->cjk); ++i) fz_drop_font(ctx, ctx->font->cjk[i]); - for (i = 0; i < nelem(ctx->font->fallback); ++i) + for (i = 0; i < (int)nelem(ctx->font->fallback); ++i) { fz_drop_font(ctx, ctx->font->fallback[i].serif); fz_drop_font(ctx, ctx->font->fallback[i].sans); @@ -524,7 +524,7 @@ fz_font *fz_load_fallback_font(fz_context *ctx, int script, int language, int se int subfont; int size; - if (script < 0 || script >= nelem(ctx->font->fallback)) + if (script < 0 || script >= (int)nelem(ctx->font->fallback)) return NULL; /* TODO: bold and italic */ @@ -933,7 +933,7 @@ fz_new_cjk_font(fz_context *ctx, int ordering) { const unsigned char *data; int size, index; - if (ordering >= 0 && ordering < nelem(ctx->font->cjk)) + if (ordering >= 0 && ordering < (int)nelem(ctx->font->cjk)) { if (ctx->font->cjk[ordering]) return fz_keep_font(ctx, ctx->font->cjk[ordering]); diff --git a/source/fitz/load-gif.c b/source/fitz/load-gif.c index 1238b34..37175c5 100644 --- a/source/fitz/load-gif.c +++ b/source/fitz/load-gif.c @@ -423,7 +423,7 @@ gif_read_ae(fz_context *ctx, struct info *info, const unsigned char *p, const un fz_throw(ctx, FZ_ERROR_GENERIC, "out of range application extension block size in gif image"); ignored = 0; - for (i = 0; i < nelem(ignorable); i++) + for (i = 0; i < (int)nelem(ignorable); i++) ignored |= memcmp(&p[3], ignorable[i], 8 + 3); if (!ignored) { diff --git a/source/fitz/load-pnm.c b/source/fitz/load-pnm.c index 8c21300..cb08880 100644 --- a/source/fitz/load-pnm.c +++ b/source/fitz/load-pnm.c @@ -176,7 +176,7 @@ pnm_read_tupletype(fz_context *ctx, const unsigned char *p, const unsigned char p++; len = p - s; - for (i = 0; i < nelem(tupletypes); i++) + for (i = 0; i < (int)nelem(tupletypes); i++) if (len == tupletypes[i].len && !strncmp((char *) s, tupletypes[i].str, len)) { *tupletype = tupletypes[i].type; @@ -209,7 +209,7 @@ pnm_read_token(fz_context *ctx, const unsigned char *p, const unsigned char *e, p++; len = p - s; - for (i = 0; i < nelem(tokens); i++) + for (i = 0; i < (int)nelem(tokens); i++) if (len == tokens[i].len && !strncmp((char *) s, tokens[i].str, len)) { *token = tokens[i].type; diff --git a/source/fitz/output-pcl.c b/source/fitz/output-pcl.c index 03c2af3..fdc6806 100644 --- a/source/fitz/output-pcl.c +++ b/source/fitz/output-pcl.c @@ -605,7 +605,7 @@ static void guess_paper_size(fz_pcl_options *pcl, int w, int h, int xres, int yr h = h * 300 / xres; /* Look for an exact match */ - for (size = 0; size < num_elems(papersizes); size++) + for (size = 0; size < (int)num_elems(papersizes); size++) { if (papersizes[size].code > eCustomPaperSize && (pcl->features & PCL_HAS_RICOH_PAPER_SIZES) == 0) continue; @@ -632,7 +632,7 @@ static void guess_paper_size(fz_pcl_options *pcl, int w, int h, int xres, int yr /* Send the next larger one (minimise waste) */ int i; int best_waste = INT_MAX; - for (i = 0; i < num_elems(papersizes); i++) + for (i = 0; i < (int)num_elems(papersizes); i++) { int waste; if (papersizes[i].code > eCustomPaperSize && (pcl->features & PCL_HAS_RICOH_PAPER_SIZES) == 0) @@ -658,7 +658,7 @@ static void guess_paper_size(fz_pcl_options *pcl, int w, int h, int xres, int yr /* Now, size = The best size we have (or num_elems(papersizes)) if it's too big */ - if (size < num_elems(papersizes)) + if (size < (int)num_elems(papersizes)) pcl->paper_size = papersizes[size].code; else pcl->paper_size = eCustomPaperSize; /* Custom */ diff --git a/source/fitz/string.c b/source/fitz/string.c index f8eedb6..488cbbb 100644 --- a/source/fitz/string.c +++ b/source/fitz/string.c @@ -257,7 +257,7 @@ fz_format_output_path(fz_context *ctx, char *path, size_t size, const char *fmt, if (z < 1) z = 1; - while (i < z && i < sizeof num) + while (i < z && i < (int)sizeof num) num[i++] = '0'; n = s - fmt; if (n + i + strlen(p) >= size) diff --git a/source/html/css-apply.c b/source/html/css-apply.c index ba97386..7ff6e58 100644 --- a/source/html/css-apply.c +++ b/source/html/css-apply.c @@ -593,7 +593,7 @@ add_property(fz_css_match *match, const char *name, fz_css_value *value, int spe } } - if (match->count + 1 >= nelem(match->prop)) + if (match->count + 1 >= (int)nelem(match->prop)) { // fz_warn(ctx, "too many css properties"); return; diff --git a/source/html/css-parse.c b/source/html/css-parse.c index 8242279..4e984fb 100644 --- a/source/html/css-parse.c +++ b/source/html/css-parse.c @@ -151,7 +151,7 @@ static int isnmchar(int c) static void css_push_char(struct lexbuf *buf, int c) { - if (buf->string_len + 1 >= nelem(buf->string)) + if (buf->string_len + 1 >= (int)nelem(buf->string)) fz_css_error(buf, "token too long"); buf->string[buf->string_len++] = c; } diff --git a/source/html/html-font.c b/source/html/html-font.c index 6f8a6bd..68a3fa0 100644 --- a/source/html/html-font.c +++ b/source/html/html-font.c @@ -115,7 +115,7 @@ void fz_drop_html_font_set(fz_context *ctx, fz_html_font_set *set) font = next; } - for (i = 0; i < nelem(set->fonts); ++i) + for (i = 0; i < (int)nelem(set->fonts); ++i) fz_drop_font(ctx, set->fonts[i]); fz_free(ctx, set); diff --git a/source/html/html-outline.c b/source/html/html-outline.c index 7bc707c..a1a2cbf 100644 --- a/source/html/html-outline.c +++ b/source/html/html-outline.c @@ -372,14 +372,14 @@ add_html_outline(fz_context *ctx, struct outline_parser *x, fz_html_box *box) fz_rethrow(ctx); } - if (x->level[x->current] < box->heading && x->current < 5) + if (x->level[x->current] < (int)box->heading && x->current < 5) { x->tail[x->current+1] = x->down[x->current]; x->current += 1; } else { - while (x->current > 0 && x->level[x->current] > box->heading) + while (x->current > 0 && x->level[x->current] > (int)box->heading) { x->current -= 1; } diff --git a/source/pdf/pdf-crypt.c b/source/pdf/pdf-crypt.c index e838503..f53c894 100644 --- a/source/pdf/pdf-crypt.c +++ b/source/pdf/pdf-crypt.c @@ -1230,7 +1230,7 @@ void pdf_encrypt_data(fz_context *ctx, pdf_crypt *crypt, int num, int gen, void while (n > 0) { int len = n; - if (len > sizeof(buffer)) + if (len > (int)sizeof(buffer)) len = sizeof(buffer); fz_arc4_encrypt(&arc4, buffer, s, len); write_data(ctx, arg, buffer, len); diff --git a/source/pdf/pdf-font.c b/source/pdf/pdf-font.c index c8b121f..d376a93 100644 --- a/source/pdf/pdf-font.c +++ b/source/pdf/pdf-font.c @@ -138,7 +138,7 @@ static int strcmp_ignore_space(const char *a, const char *b) const char *pdf_clean_font_name(const char *fontname) { int i, k; - for (i = 0; i < nelem(base_font_names); i++) + for (i = 0; i < (int)nelem(base_font_names); i++) for (k = 0; base_font_names[i][k]; k++) if (!strcmp_ignore_space(base_font_names[i][k], fontname)) return base_font_names[i][0]; @@ -287,7 +287,7 @@ static const struct { int code; const char *name; } mre_diff_table[] = static int lookup_mre_code(const char *name) { int i; - for (i = 0; i < nelem(mre_diff_table); ++i) + for (i = 0; i < (int)nelem(mre_diff_table); ++i) if (!strcmp(name, mre_diff_table[i].name)) return mre_diff_table[i].code; for (i = 0; i < 256; i++) @@ -737,7 +737,7 @@ pdf_load_simple_font(fz_context *ctx, pdf_document *doc, pdf_obj *dict) item = pdf_array_get(ctx, diff, i); if (pdf_is_int(ctx, item)) k = pdf_to_int(ctx, item); - if (pdf_is_name(ctx, item) && k >= 0 && k < nelem(estrings)) + if (pdf_is_name(ctx, item) && k >= 0 && k < (int)nelem(estrings)) estrings[k++] = pdf_to_name(ctx, item); } } diff --git a/source/pdf/pdf-function.c b/source/pdf/pdf-function.c index e9214b5..7d17b0b 100644 --- a/source/pdf/pdf-function.c +++ b/source/pdf/pdf-function.c @@ -150,7 +150,7 @@ ps_init_stack(ps_stack *st) static inline int ps_overflow(ps_stack *st, int n) { - return n < 0 || st->sp + n >= nelem(st->stack); + return n < 0 || st->sp + n >= (int)nelem(st->stack); } static inline int ps_underflow(ps_stack *st, int n) @@ -359,7 +359,7 @@ ps_run(fz_context *ctx, psobj *code, ps_stack *st, int pc) case PS_OP_BITSHIFT: i2 = ps_pop_int(st); i1 = ps_pop_int(st); - if (i2 > 0 && i2 < 8 * sizeof (i2)) + if (i2 > 0 && i2 < 8 * (int)sizeof (i2)) ps_push_int(st, i1 << i2); else if (i2 < 0 && i2 > -8 * (int)sizeof (i2)) ps_push_int(st, (int)((unsigned int)i1 >> -i2)); diff --git a/source/pdf/pdf-interpret.c b/source/pdf/pdf-interpret.c index 81b210d..294f523 100644 --- a/source/pdf/pdf-interpret.c +++ b/source/pdf/pdf-interpret.c @@ -893,7 +893,7 @@ pdf_process_stream(fz_context *ctx, pdf_processor *proc, pdf_csi *csi, fz_stream break; case PDF_TOK_INT: - if (csi->top < nelem(csi->stack)) { + if (csi->top < (int)nelem(csi->stack)) { csi->stack[csi->top] = buf->i; csi->top ++; } @@ -902,7 +902,7 @@ pdf_process_stream(fz_context *ctx, pdf_processor *proc, pdf_csi *csi, fz_stream break; case PDF_TOK_REAL: - if (csi->top < nelem(csi->stack)) { + if (csi->top < (int)nelem(csi->stack)) { csi->stack[csi->top] = buf->f; csi->top ++; } diff --git a/source/pdf/pdf-type3.c b/source/pdf/pdf-type3.c index fd6b443..0fa4e01 100644 --- a/source/pdf/pdf-type3.c +++ b/source/pdf/pdf-type3.c @@ -95,7 +95,7 @@ pdf_load_type3_font(fz_context *ctx, pdf_document *doc, pdf_obj *rdb, pdf_obj *d item = pdf_array_get(ctx, diff, i); if (pdf_is_int(ctx, item)) k = pdf_to_int(ctx, item); - if (pdf_is_name(ctx, item) && k >= 0 && k < nelem(estrings)) + if (pdf_is_name(ctx, item) && k >= 0 && k < (int)nelem(estrings)) estrings[k++] = pdf_to_name(ctx, item); } } diff --git a/source/svg/svg-color.c b/source/svg/svg-color.c index 9154d23..444c461 100644 --- a/source/svg/svg-color.c +++ b/source/svg/svg-color.c @@ -235,7 +235,7 @@ svg_parse_color(fz_context *ctx, svg_document *doc, const char *str, float *rgb) if (svg_is_digit(*str)) { numberlen = 0; - while (svg_is_digit(*str) && numberlen < sizeof(numberbuf) - 1) + while (svg_is_digit(*str) && numberlen < (int)sizeof(numberbuf) - 1) numberbuf[numberlen++] = *str++; numberbuf[numberlen] = 0; diff --git a/source/svg/svg-parse.c b/source/svg/svg-parse.c index dff32e7..7720051 100644 --- a/source/svg/svg-parse.c +++ b/source/svg/svg-parse.c @@ -140,7 +140,7 @@ svg_parse_transform(fz_context *ctx, svg_document *doc, const char *str, fz_matr */ keywordlen = 0; - while (svg_is_alpha(*str) && keywordlen < sizeof(keyword) - 1) + while (svg_is_alpha(*str) && keywordlen < (int)sizeof(keyword) - 1) keyword[keywordlen++] = *str++; keyword[keywordlen] = 0; diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c index 14634f1..24b99c2 100644 --- a/source/tools/mudraw.c +++ b/source/tools/mudraw.c @@ -1208,7 +1208,7 @@ parse_colorspace(const char *name) { int i; - for (i = 0; i < nelem(cs_name_table); i++) + for (i = 0; i < (int)nelem(cs_name_table); i++) { if (!strcmp(name, cs_name_table[i].name)) return cs_name_table[i].colorspace; @@ -1656,7 +1656,7 @@ int mudraw_main(int argc, char **argv) { int i; - for (i = 0; i < nelem(suffix_table); i++) + for (i = 0; i < (int)nelem(suffix_table); i++) { if (!strcmp(format, suffix_table[i].suffix+1)) { @@ -1669,7 +1669,7 @@ int mudraw_main(int argc, char **argv) break; } } - if (i == nelem(suffix_table)) + if (i == (int)nelem(suffix_table)) { fprintf(stderr, "Unknown output format '%s'\n", format); exit(1); @@ -1680,7 +1680,7 @@ int mudraw_main(int argc, char **argv) char *suffix = output; int i; - for (i = 0; i < nelem(suffix_table); i++) + for (i = 0; i < (int)nelem(suffix_table); i++) { char *s = strstr(suffix, suffix_table[i].suffix); @@ -1715,18 +1715,18 @@ int mudraw_main(int argc, char **argv) { int i, j; - for (i = 0; i < nelem(format_cs_table); i++) + for (i = 0; i < (int)nelem(format_cs_table); i++) { if (format_cs_table[i].format == output_format) { if (out_cs == CS_UNSET) out_cs = format_cs_table[i].default_cs; - for (j = 0; j < nelem(format_cs_table[i].permitted_cs); j++) + for (j = 0; j < (int)nelem(format_cs_table[i].permitted_cs); j++) { if (format_cs_table[i].permitted_cs[j] == out_cs) break; } - if (j == nelem(format_cs_table[i].permitted_cs)) + if (j == (int)nelem(format_cs_table[i].permitted_cs)) { fprintf(stderr, "Unsupported colorspace for this format\n"); exit(1); @@ -1787,11 +1787,11 @@ int mudraw_main(int argc, char **argv) /* Check to make sure this icc profile is ok with the output format */ okay = 0; - for (i = 0; i < nelem(format_cs_table); i++) + for (i = 0; i < (int)nelem(format_cs_table); i++) { if (format_cs_table[i].format == output_format) { - for (j = 0; j < nelem(format_cs_table[i].permitted_cs); j++) + for (j = 0; j < (int)nelem(format_cs_table[i].permitted_cs); j++) { switch (format_cs_table[i].permitted_cs[j]) { diff --git a/source/tools/muraster.c b/source/tools/muraster.c index 421e659..20b641b 100644 --- a/source/tools/muraster.c +++ b/source/tools/muraster.c @@ -1582,7 +1582,7 @@ int main(int argc, char **argv) { int i; - for (i = 0; i < nelem(suffix_table); i++) + for (i = 0; i < (int)nelem(suffix_table); i++) { if (!strcmp(format, suffix_table[i].suffix+1)) { @@ -1591,7 +1591,7 @@ int main(int argc, char **argv) break; } } - if (i == nelem(suffix_table)) + if (i == (int)nelem(suffix_table)) { fprintf(stderr, "Unknown output format '%s'\n", format); exit(1); @@ -1602,7 +1602,7 @@ int main(int argc, char **argv) char *suffix = output; int i; - for (i = 0; i < nelem(suffix_table); i++) + for (i = 0; i < (int)nelem(suffix_table); i++) { char *s = strstr(suffix, suffix_table[i].suffix); diff --git a/source/tools/murun.c b/source/tools/murun.c index b666353..3ec61b6 100644 --- a/source/tools/murun.c +++ b/source/tools/murun.c @@ -654,7 +654,7 @@ static fz_stroke_state ffi_tostroke(js_State *J, int idx) } if (js_hasproperty(J, idx, "dashes")) { int i, n = js_getlength(J, -1); - if (n > nelem(stroke.dash_list)) + if (n > (int)nelem(stroke.dash_list)) n = nelem(stroke.dash_list); stroke.dash_len = n; for (i = 0; i < n; ++i) { diff --git a/source/tools/mutool.c b/source/tools/mutool.c index 8eca9b1..7b3363c 100644 --- a/source/tools/mutool.c +++ b/source/tools/mutool.c @@ -108,7 +108,7 @@ int main(int argc, char **argv) end++; if ((end-4 >= start) && (end[-4] == '.') && (end[-3] == 'e') && (end[-2] == 'x') && (end[-1] == 'e')) end = end-4; - for (i = 0; i < nelem(tools); i++) + for (i = 0; i < (int)nelem(tools); i++) { strcpy(buf, "mupdf"); strcat(buf, tools[i].name); @@ -125,7 +125,7 @@ int main(int argc, char **argv) if (argc > 1) { - for (i = 0; i < nelem(tools); i++) + for (i = 0; i < (int)nelem(tools); i++) if (!strcmp(tools[i].name, argv[1])) return tools[i].func(argc - 1, argv + 1); if (!strcmp(argv[1], "-v")) @@ -139,7 +139,7 @@ int main(int argc, char **argv) fprintf(stderr, "usage: mutool <command> [options]\n"); - for (i = 0; i < nelem(tools); i++) + for (i = 0; i < (int)nelem(tools); i++) fprintf(stderr, "\t%s\t-- %s\n", tools[i].name, tools[i].desc); return 1; diff --git a/source/tools/pdfmerge.c b/source/tools/pdfmerge.c index 8d3d449..c8a163f 100644 --- a/source/tools/pdfmerge.c +++ b/source/tools/pdfmerge.c @@ -61,7 +61,7 @@ static void page_merge(int page_from, int page_to, pdf_graft_map *graft_map) pdf_dict_put(ctx, page_dict, PDF_NAME(Type), PDF_NAME(Page)); - for (i = 0; i < nelem(copy_list); i++) + for (i = 0; i < (int)nelem(copy_list); i++) { obj = pdf_dict_get(ctx, page_ref, copy_list[i]); if (obj != NULL) diff --git a/source/xps/xps-common.c b/source/xps/xps-common.c index ab9aaff..9454f37 100644 --- a/source/xps/xps-common.c +++ b/source/xps/xps-common.c @@ -102,7 +102,7 @@ xps_begin_opacity(fz_context *ctx, xps_document *doc, fz_matrix ctm, fz_rect are opacity_mask_tag = NULL; } - if (doc->opacity_top + 1 < nelem(doc->opacity)) + if (doc->opacity_top + 1 < (int)nelem(doc->opacity)) { doc->opacity[doc->opacity_top + 1] = doc->opacity[doc->opacity_top] * opacity; doc->opacity_top++; http://git.ghostscript.com/?p=mupdf.git;a=commit;h=2ad88b8cabdafd9438084d32c20c4728442d81da -- MuPDF library Artifex Software, Inc.