From 14def5e0c1c11cee1523e10c72df74f4cf5e451d Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Sun, 28 Sep 2008 16:55:50 +0000 Subject: [PATCH] Rename error as mdvi_error to avoid symbol conflicts with the libc error. 2008-09-28 Carlos Garcia Campos * backend/dvi/mdvi-lib/common.h: * backend/dvi/mdvi-lib/dviread.c: * backend/dvi/mdvi-lib/font.c: * backend/dvi/mdvi-lib/fontmap.c: * backend/dvi/mdvi-lib/fontsrch.c: * backend/dvi/mdvi-lib/gf.c: * backend/dvi/mdvi-lib/pagesel.c: * backend/dvi/mdvi-lib/pk.c: * backend/dvi/mdvi-lib/sp-epsf.c: * backend/dvi/mdvi-lib/special.c: * backend/dvi/mdvi-lib/tfm.c: * backend/dvi/mdvi-lib/tfmfile.c: * backend/dvi/mdvi-lib/util.c: * backend/dvi/mdvi-lib/vf.c: Rename error as mdvi_error to avoid symbol conflicts with the libc error. Rename also message, crash, fatal and warning for consistency. Fixes bug #553369. svn path=/trunk/; revision=3210 --- ChangeLog | 21 +++++++++++++++++++++ backend/dvi/mdvi-lib/common.h | 14 +++++++------- backend/dvi/mdvi-lib/dviread.c | 28 ++++++++++++++-------------- backend/dvi/mdvi-lib/font.c | 2 +- backend/dvi/mdvi-lib/fontmap.c | 16 ++++++++-------- backend/dvi/mdvi-lib/fontsrch.c | 12 ++++++------ backend/dvi/mdvi-lib/gf.c | 20 ++++++++++---------- backend/dvi/mdvi-lib/pagesel.c | 8 ++++---- backend/dvi/mdvi-lib/pk.c | 16 ++++++++-------- backend/dvi/mdvi-lib/sp-epsf.c | 14 +++++++------- backend/dvi/mdvi-lib/special.c | 4 ++-- backend/dvi/mdvi-lib/tfm.c | 6 +++--- backend/dvi/mdvi-lib/tfmfile.c | 18 +++++++++--------- backend/dvi/mdvi-lib/util.c | 28 ++++++++++++++-------------- backend/dvi/mdvi-lib/vf.c | 16 ++++++++-------- 15 files changed, 122 insertions(+), 101 deletions(-) diff --git a/ChangeLog b/ChangeLog index 22f51f78..ecdf7b2d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2008-09-28 Carlos Garcia Campos + + * backend/dvi/mdvi-lib/common.h: + * backend/dvi/mdvi-lib/dviread.c: + * backend/dvi/mdvi-lib/font.c: + * backend/dvi/mdvi-lib/fontmap.c: + * backend/dvi/mdvi-lib/fontsrch.c: + * backend/dvi/mdvi-lib/gf.c: + * backend/dvi/mdvi-lib/pagesel.c: + * backend/dvi/mdvi-lib/pk.c: + * backend/dvi/mdvi-lib/sp-epsf.c: + * backend/dvi/mdvi-lib/special.c: + * backend/dvi/mdvi-lib/tfm.c: + * backend/dvi/mdvi-lib/tfmfile.c: + * backend/dvi/mdvi-lib/util.c: + * backend/dvi/mdvi-lib/vf.c: + + Rename error as mdvi_error to avoid symbol conflicts with the libc + error. Rename also message, crash, fatal and warning for + consistency. Fixes bug #553369. + 2008-09-28 Carlos Garcia Campos * backend/dvi/dvi-document.c: (dvi_document_load): diff --git a/backend/dvi/mdvi-lib/common.h b/backend/dvi/mdvi-lib/common.h index 2da61c81..c5a908eb 100644 --- a/backend/dvi/mdvi-lib/common.h +++ b/backend/dvi/mdvi-lib/common.h @@ -136,11 +136,11 @@ extern char *read_alloc_bcpl __PROTO((FILE *, size_t, size_t *)); /* miscellaneous */ -extern void message __PROTO((const char *, ...)); -extern void crash __PROTO((const char *, ...)); -extern void fatal __PROTO((const char *, ...)); -extern void error __PROTO((const char *, ...)); -extern void warning __PROTO((const char *, ...)); +extern void mdvi_message __PROTO((const char *, ...)); +extern void mdvi_crash __PROTO((const char *, ...)); +extern void mdvi_fatal __PROTO((const char *, ...)); +extern void mdvi_error __PROTO((const char *, ...)); +extern void mdvi_warning __PROTO((const char *, ...)); extern int unit2pix __PROTO((int, const char *)); extern double unit2pix_factor __PROTO((const char *)); @@ -182,12 +182,12 @@ extern Uint32 _mdvi_debug_mask; extern void __debug __PROTO((int, const char *, ...)); #define DEBUG(x) __debug x #define ASSERT(x) do { \ - if(!(x)) crash("%s:%d: Assertion %s failed\n", \ + if(!(x)) mdvi_crash("%s:%d: Assertion %s failed\n", \ __FILE__, __LINE__, #x); \ } while(0) #define ASSERT_VALUE(x,y) do { \ if((x) != (y)) \ - crash("%s:%d: Assertion failed (%d = %s != %s)\n", \ + mdvi_crash("%s:%d: Assertion failed (%d = %s != %s)\n", \ __FILE__, __LINE__, (x), #x, #x); \ } while(0) #else diff --git a/backend/dvi/mdvi-lib/dviread.c b/backend/dvi/mdvi-lib/dviread.c index 8d879919..d696d8a6 100644 --- a/backend/dvi/mdvi-lib/dviread.c +++ b/backend/dvi/mdvi-lib/dviread.c @@ -238,7 +238,7 @@ static int get_bytes(DviContext *dvi, size_t n) newlen = fread(dvi->buffer.data + dvi->buffer.length, 1, dvi->buffer.size - dvi->buffer.length, dvi->in); if(newlen == -1) { - error("%s: %s\n", dvi->filename, strerror(errno)); + mdvi_error("%s: %s\n", dvi->filename, strerror(errno)); return -1; } dvi->buffer.length += newlen; @@ -427,7 +427,7 @@ static DviFontRef *define_font(DviContext *dvi, int op) hdpi, vdpi)); ref = font_reference(&dvi->params, arg, name, checksum, hdpi, vdpi, scale); if(ref == NULL) { - error(_("could not load font `%s'\n"), name); + mdvi_error(_("could not load font `%s'\n"), name); mdvi_free(name); return NULL; } @@ -481,7 +481,7 @@ int mdvi_reload(DviContext *dvi, DviParams *np) /* load it again */ newdvi = mdvi_init_context(pars, dvi->pagesel, dvi->filename); if(newdvi == NULL) { - warning(_("could not reload `%s'\n"), dvi->filename); + mdvi_warning(_("could not reload `%s'\n"), dvi->filename); return -1; } @@ -708,8 +708,8 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil if(fuget1(p) != DVI_PRE) goto bad_dvi; if((arg = fuget1(p)) != DVI_ID) { - error(_("%s: unsupported DVI format (version %u)\n"), - file, arg); + mdvi_error(_("%s: unsupported DVI format (version %u)\n"), + file, arg); goto error; /* jump to the end of this routine, * where we handle errors */ } @@ -868,7 +868,7 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil } pagecount++; if(pagecount >= dvi->npages) { - error(_("no pages selected\n")); + mdvi_error(_("no pages selected\n")); goto error; } if(pagecount) { @@ -901,7 +901,7 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil return dvi; bad_dvi: - error(_("%s: File corrupted, or not a DVI file\n"), file); + mdvi_error(_("%s: File corrupted, or not a DVI file\n"), file); error: /* if we came from the font definitions, this will be non-trivial */ dreset(dvi); @@ -1010,9 +1010,9 @@ again: /* try reopening the file */ dvi->in = fopen(dvi->filename, "r"); if(dvi->in == NULL) { - warning(_("%s: could not reopen file (%s)\n"), - dvi->filename, - strerror(errno)); + mdvi_warning(_("%s: could not reopen file (%s)\n"), + dvi->filename, + strerror(errno)); return -1; } DEBUG((DBG_FILES, "reopen(%s) -> Ok\n", dvi->filename)); @@ -1027,15 +1027,15 @@ again: } if(pageno < 0 || pageno > dvi->npages-1) { - error(_("%s: page %d out of range\n"), - dvi->filename, pageno); + mdvi_error(_("%s: page %d out of range\n"), + dvi->filename, pageno); return -1; } fseek(dvi->in, (long)dvi->pagemap[pageno][0], SEEK_SET); if((op = fuget1(dvi->in)) != DVI_BOP) { - error(_("%s: bad offset at page %d\n"), - dvi->filename, pageno+1); + mdvi_error(_("%s: bad offset at page %d\n"), + dvi->filename, pageno+1); return -1; } diff --git a/backend/dvi/mdvi-lib/font.c b/backend/dvi/mdvi-lib/font.c index be778a20..065b5869 100644 --- a/backend/dvi/mdvi-lib/font.c +++ b/backend/dvi/mdvi-lib/font.c @@ -469,7 +469,7 @@ void font_finish_definitions(DviContext *dvi) font_free_unused(&dvi->device); if(dvi->fonts == NULL) { - warning(_("%s: no fonts defined\n"), dvi->filename); + mdvi_warning(_("%s: no fonts defined\n"), dvi->filename); return; } map = xnalloc(DviFontRef *, dvi->nfonts); diff --git a/backend/dvi/mdvi-lib/fontmap.c b/backend/dvi/mdvi-lib/fontmap.c index 88ba89fd..e186bd45 100644 --- a/backend/dvi/mdvi-lib/fontmap.c +++ b/backend/dvi/mdvi-lib/fontmap.c @@ -586,7 +586,7 @@ DviFontMapEnt *mdvi_load_fontmap(const char *file) } if(ent->encfile && enc){ if(ent->encoding && !STREQ(ent->encoding, enc->name)) { - warning( + mdvi_warning( _("%s: %d: [%s] requested encoding `%s' does not match vector `%s'\n"), file, lineno, ent->encfile, ent->encoding, enc->name); @@ -749,7 +749,7 @@ static int mdvi_init_fontmaps(void) DEBUG((DBG_FMAP, "%s: loading fontmap\n", arg)); ent = mdvi_load_fontmap(arg); if(ent == NULL) - warning(_("%s: could not load fontmap\n"), arg); + mdvi_warning(_("%s: could not load fontmap\n"), arg); else { DEBUG((DBG_FMAP, "%s: installing fontmap\n", arg)); @@ -763,8 +763,8 @@ static int mdvi_init_fontmaps(void) } else if(STRNEQ(line, "default-encoding", 16)) { arg = getstring(line + 16, " \t", &line); *line = 0; if(mdvi_set_default_encoding(arg) < 0) - warning(_("%s: could not set as default encoding\n"), - arg); + mdvi_warning(_("%s: could not set as default encoding\n"), + arg); } else if(STRNEQ(line, "psfontpath", 10)) { arg = getstring(line + 11, " \t", &line); *line = 0; if(!psinitialized) @@ -782,8 +782,8 @@ static int mdvi_init_fontmaps(void) } else if(STRNEQ(line, "psfontmap", 9)) { arg = getstring(line + 9, " \t", &line); *line = 0; if(mdvi_ps_read_fontmap(arg) < 0) - warning("%s: %s: could not read PS fontmap\n", - config, arg); + mdvi_warning("%s: %s: could not read PS fontmap\n", + config, arg); } } fclose(in); @@ -842,8 +842,8 @@ void mdvi_flush_encodings(void) for(; (enc = (DviEncoding *)encodings.head); ) { encodings.head = LIST(enc->next); if((enc != tex_text_encoding && enc->links) || enc->links > 1) { - warning(_("encoding vector `%s' is in use\n"), - enc->name); + mdvi_warning(_("encoding vector `%s' is in use\n"), + enc->name); } destroy_encoding(enc); } diff --git a/backend/dvi/mdvi-lib/fontsrch.c b/backend/dvi/mdvi-lib/fontsrch.c index 99d70ee1..3f979da8 100644 --- a/backend/dvi/mdvi-lib/fontsrch.c +++ b/backend/dvi/mdvi-lib/fontsrch.c @@ -255,8 +255,8 @@ again: } if(kid < MAX_CLASS - 1 && !STREQ(name, _mdvi_fallback_font)) { - warning("font `%s' at %dx%d not found, trying `%s' instead\n", - name, hdpi, vdpi, _mdvi_fallback_font); + mdvi_warning("font `%s' at %dx%d not found, trying `%s' instead\n", + name, hdpi, vdpi, _mdvi_fallback_font); name = _mdvi_fallback_font; kid = 0; goto again; @@ -275,8 +275,8 @@ again: } ptr = last->next; } else { - warning("font `%s' not found, trying metric files instead\n", - name); + mdvi_warning("font `%s' not found, trying metric files instead\n", + name); ptr = (DviFontClass *)font_classes[MAX_CLASS-1].head; } @@ -303,8 +303,8 @@ metrics: return filename; } if(!STREQ(name, _mdvi_fallback_font)) { - warning("metric file for `%s' not found, trying `%s' instead\n", - name, _mdvi_fallback_font); + mdvi_warning("metric file for `%s' not found, trying `%s' instead\n", + name, _mdvi_fallback_font); name = _mdvi_fallback_font; ptr = (DviFontClass *)font_classes[MAX_CLASS-1].head; goto metrics; diff --git a/backend/dvi/mdvi-lib/gf.c b/backend/dvi/mdvi-lib/gf.c index 820d54c4..2cfcb36a 100644 --- a/backend/dvi/mdvi-lib/gf.c +++ b/backend/dvi/mdvi-lib/gf.c @@ -110,8 +110,8 @@ static int gf_read_bitmap(FILE *p, DviFontChar *ch) min_m = max_m - min_m; min_n = max_n - min_n; } else { - error(_("GF: invalid opcode %d in character %d\n"), - op, ch->code); + mdvi_error(_("GF: invalid opcode %d in character %d\n"), + op, ch->code); return -1; } @@ -208,8 +208,8 @@ static int gf_read_bitmap(FILE *p, DviFontChar *ch) DEBUG((DBG_BITMAPS, "(gf) no_op\n")); break; default: - error(_("(gf) Character %d: invalid opcode %d\n"), - ch->code, op); + mdvi_error(_("(gf) Character %d: invalid opcode %d\n"), + ch->code, op); goto error; } /* chech that we're still inside the bitmap */ @@ -224,8 +224,8 @@ static int gf_read_bitmap(FILE *p, DviFontChar *ch) return 0; toobig: - error(_("(gf) character %d has an incorrect bounding box\n"), - ch->code); + mdvi_error(_("(gf) character %d has an incorrect bounding box\n"), + ch->code); error: bitmap_destroy(map); ch->glyph.data = NULL; @@ -287,8 +287,8 @@ static int gf_load_font(DviParams *unused, DviFont *font) /* the checksum */ word = fuget4(p); if(word && font->checksum && font->checksum != word) { - warning(_("%s: bad checksum (expected %u, found %u)\n"), - font->fontname, font->checksum, word); + mdvi_warning(_("%s: bad checksum (expected %u, found %u)\n"), + font->fontname, font->checksum, word); } else if(!font->checksum) font->checksum = word; /* skip pixels per point ratio */ @@ -323,7 +323,7 @@ static int gf_load_font(DviParams *unused, DviFont *font) /* dy assumed 0 */ break; default: - error(_("%s: junk in postamble\n"), font->fontname); + mdvi_error(_("%s: junk in postamble\n"), font->fontname); goto error; } ch->code = cc; @@ -360,7 +360,7 @@ static int gf_load_font(DviParams *unused, DviFont *font) return 0; badgf: - error(_("%s: File corrupted, or not a GF file\n"), font->fontname); + mdvi_error(_("%s: File corrupted, or not a GF file\n"), font->fontname); error: if(font->chars) { mdvi_free(font->chars); diff --git a/backend/dvi/mdvi-lib/pagesel.c b/backend/dvi/mdvi-lib/pagesel.c index 75fdad8b..bab1cbf8 100644 --- a/backend/dvi/mdvi-lib/pagesel.c +++ b/backend/dvi/mdvi-lib/pagesel.c @@ -209,7 +209,7 @@ DviPageSpec *mdvi_parse_page_spec(const char *format) range = mdvi_parse_range(format, NULL, &count, &ptr); if(ptr == format) { if(range) mdvi_free(range); - error(_("invalid page specification `%s'\n"), format); + mdvi_error(_("invalid page specification `%s'\n"), format); return NULL; } } else @@ -229,7 +229,7 @@ DviPageSpec *mdvi_parse_page_spec(const char *format) if(*ptr != '.') { if(*ptr) - warning(_("garbage after DVI page specification ignored\n")); + mdvi_warning(_("garbage after DVI page specification ignored\n")); return spec; } @@ -257,9 +257,9 @@ DviPageSpec *mdvi_parse_page_spec(const char *format) } if(i > 10) - warning(_("more than 10 counters in page specification\n")); + mdvi_warning(_("more than 10 counters in page specification\n")); else if(*ptr) - warning(_("garbage after TeX page specification ignored\n")); + mdvi_warning(_("garbage after TeX page specification ignored\n")); return spec; } diff --git a/backend/dvi/mdvi-lib/pk.c b/backend/dvi/mdvi-lib/pk.c index 39064a13..98ef26b5 100644 --- a/backend/dvi/mdvi-lib/pk.c +++ b/backend/dvi/mdvi-lib/pk.c @@ -307,7 +307,7 @@ static BITMAP *get_packed(FILE *p, int w, int h, int flags) paint = !paint; } if(row != h || inrow != w) { - error(_("Bad PK file: More bits than required\n")); + mdvi_error(_("Bad PK file: More bits than required\n")); bitmap_destroy(bm); return NULL; } @@ -360,8 +360,8 @@ static int pk_load_font(DviParams *unused, DviFont *font) /* get the checksum */ checksum = fuget4(p); if(checksum && font->checksum && font->checksum != checksum) { - warning(_("%s: checksum mismatch (expected %u, got %u)\n"), - font->fontname, font->checksum, checksum); + mdvi_warning(_("%s: checksum mismatch (expected %u, got %u)\n"), + font->fontname, font->checksum, checksum); } else if(!font->checksum) font->checksum = checksum; /* skip pixel per point ratios */ @@ -417,7 +417,7 @@ static int pk_load_font(DviParams *unused, DviFont *font) case PK_NOOP: break; case PK_PRE: - error(_("%s: unexpected preamble\n"), font->fontname); + mdvi_error(_("%s: unexpected preamble\n"), font->fontname); goto error; } } else { @@ -500,13 +500,13 @@ static int pk_load_font(DviParams *unused, DviFont *font) } } if(flag_byte != PK_POST) { - error(_("%s: unexpected end of file (no postamble)\n"), - font->fontname); + mdvi_error(_("%s: unexpected end of file (no postamble)\n"), + font->fontname); goto error; } while((flag_byte = fuget1(p)) != EOF) { if(flag_byte != PK_NOOP) { - error(_("invalid PK file! (junk in postamble)\n")); + mdvi_error(_("invalid PK file! (junk in postamble)\n")); goto error; } } @@ -523,7 +523,7 @@ static int pk_load_font(DviParams *unused, DviFont *font) return 0; badpk: - error(_("%s: File corrupted, or not a PK file\n"), font->fontname); + mdvi_error(_("%s: File corrupted, or not a PK file\n"), font->fontname); error: mdvi_free(font->chars); font->chars = NULL; diff --git a/backend/dvi/mdvi-lib/sp-epsf.c b/backend/dvi/mdvi-lib/sp-epsf.c index 7a58541f..1aa9fa55 100644 --- a/backend/dvi/mdvi-lib/sp-epsf.c +++ b/backend/dvi/mdvi-lib/sp-epsf.c @@ -149,7 +149,7 @@ static char *parse_epsf_special(EpsfBox *box, char **ret, while(*p && *p != '"') p++; if(*p != '"') - warning( + mdvi_warning( _("%s: malformed value for key `%s'\n"), filename, keyname); } else @@ -161,17 +161,17 @@ static char *parse_epsf_special(EpsfBox *box, char **ret, if(STRCEQ(keys[i].name, keyname)) break; if(i == NKEYS) { - warning(_("%s: unknown key `%s' ignored\n"), - filename, keyname); + mdvi_warning(_("%s: unknown key `%s' ignored\n"), + filename, keyname); continue; } if(keys[i].has_arg && val == NULL) { - warning(_("%s: no argument for key `%s', using defaults\n"), - filename, keyname); + mdvi_warning(_("%s: no argument for key `%s', using defaults\n"), + filename, keyname); val = keys[i].value; } else if(!keys[i].has_arg && val) { - warning(_("%s: argument `%s' ignored for key `%s'\n"), - filename, val, keyname); + mdvi_warning(_("%s: argument `%s' ignored for key `%s'\n"), + filename, val, keyname); val = NULL; } if(val) diff --git a/backend/dvi/mdvi-lib/special.c b/backend/dvi/mdvi-lib/special.c index e0e6b8ef..1bc55a71 100644 --- a/backend/dvi/mdvi-lib/special.c +++ b/backend/dvi/mdvi-lib/special.c @@ -240,8 +240,8 @@ void sp_layer(DviContext *dvi, const char *prefix, const char *arg) if(dvi->curr_layer) dvi->curr_layer--; else - warning(_("%s: tried to pop top level layer\n"), - dvi->filename); + mdvi_warning(_("%s: tried to pop top level layer\n"), + dvi->filename); } else if(STREQ("reset", arg)) dvi->curr_layer = 0; DEBUG((DBG_SPECIAL, "Layer level: %d\n", dvi->curr_layer)); diff --git a/backend/dvi/mdvi-lib/tfm.c b/backend/dvi/mdvi-lib/tfm.c index 9d6ca4a8..969ef803 100644 --- a/backend/dvi/mdvi-lib/tfm.c +++ b/backend/dvi/mdvi-lib/tfm.c @@ -175,9 +175,9 @@ static int tfm_load_font(DviParams *params, DviFont *font) return -1; if(tfm->checksum && font->checksum && tfm->checksum != font->checksum) { - warning(_("%s: Checksum mismatch (got %u, expected %u)\n"), - font->fontname, (unsigned)tfm->checksum, - (unsigned)font->checksum); + mdvi_warning(_("%s: Checksum mismatch (got %u, expected %u)\n"), + font->fontname, (unsigned)tfm->checksum, + (unsigned)font->checksum); } font->checksum = tfm->checksum; font->design = tfm->design; diff --git a/backend/dvi/mdvi-lib/tfmfile.c b/backend/dvi/mdvi-lib/tfmfile.c index 36568bd7..cab4f19d 100644 --- a/backend/dvi/mdvi-lib/tfmfile.c +++ b/backend/dvi/mdvi-lib/tfmfile.c @@ -88,7 +88,7 @@ int afm_load_file(const char *filename, TFMInfo *info) fclose(in); if(status != ok) { - error(_("%s: Error reading AFM data\n"), filename); + mdvi_error(_("%s: Error reading AFM data\n"), filename); return -1; } @@ -178,8 +178,8 @@ int tfm_load_file(const char *filename, TFMInfo *info) /* allocate a word-aligned buffer to hold the file */ size = 4 * ROUND(st.st_size, 4); if(size != st.st_size) - warning(_("Warning: TFM file `%s' has suspicious size\n"), - filename); + mdvi_warning(_("Warning: TFM file `%s' has suspicious size\n"), + filename); tfm = (Uchar *)mdvi_malloc(size); if(fread(tfm, st.st_size, 1, in) != 1) goto error; @@ -228,8 +228,8 @@ int tfm_load_file(const char *filename, TFMInfo *info) /* get the coding scheme */ i = n = msget1(ptr); if(n < 0 || n > 39) { - warning(_("%s: font coding scheme truncated to 40 bytes\n"), - filename); + mdvi_warning(_("%s: font coding scheme truncated to 40 bytes\n"), + filename); n = 39; } memcpy(info->coding, ptr, n); @@ -288,7 +288,7 @@ int tfm_load_file(const char *filename, TFMInfo *info) return 0; bad_tfm: - error(_("%s: File corrupted, or not a TFM file\n"), filename); + mdvi_error(_("%s: File corrupted, or not a TFM file\n"), filename); error: if(tfm) mdvi_free(tfm); if(in) fclose(in); @@ -509,8 +509,8 @@ static int ofm_load_file(const char *filename, TFMInfo *info) /* get the coding scheme */ i = n = fsget1(in); if(n < 0 || n > 39) { - warning(_("%s: font coding scheme truncated to 40 bytes\n"), - filename); + mdvi_warning(_("%s: font coding scheme truncated to 40 bytes\n"), + filename); n = 39; } fread(info->coding, 39, 1, in); @@ -587,7 +587,7 @@ static int ofm_load_file(const char *filename, TFMInfo *info) return 0; bad_tfm: - error(_("%s: File corrupted, or not a TFM file\n"), filename); + mdvi_error(_("%s: File corrupted, or not a TFM file\n"), filename); fclose(in); return -1; } diff --git a/backend/dvi/mdvi-lib/util.c b/backend/dvi/mdvi-lib/util.c index ddf52174..0fe66cd9 100644 --- a/backend/dvi/mdvi-lib/util.c +++ b/backend/dvi/mdvi-lib/util.c @@ -115,7 +115,7 @@ void __debug(int mask, const char *format, ...) } #endif -void message(const char *format, ...) +void mdvi_message(const char *format, ...) { va_list ap; @@ -132,7 +132,7 @@ void message(const char *format, ...) va_end(ap); } -void crash(const char *format, ...) +void mdvi_crash(const char *format, ...) { va_list ap; @@ -151,7 +151,7 @@ void crash(const char *format, ...) abort(); } -void error(const char *format, ...) +void mdvi_error(const char *format, ...) { va_list ap; @@ -167,7 +167,7 @@ void error(const char *format, ...) va_end(ap); } -void warning(const char *format, ...) +void mdvi_warning(const char *format, ...) { va_list ap; @@ -183,7 +183,7 @@ void warning(const char *format, ...) va_end(ap); } -void fatal(const char *format, ...) +void mdvi_fatal(const char *format, ...) { va_list ap; @@ -209,8 +209,8 @@ void *mdvi_malloc(size_t nelems) void *ptr = malloc(nelems); if(ptr == NULL) - fatal(_("out of memory allocating %u bytes\n"), - (unsigned)nelems); + mdvi_fatal(_("out of memory allocating %u bytes\n"), + (unsigned)nelems); return ptr; } @@ -219,10 +219,10 @@ void *mdvi_realloc(void *data, size_t newsize) void *ptr; if(newsize == 0) - crash(_("attempted to reallocate with zero size\n")); + mdvi_crash(_("attempted to reallocate with zero size\n")); ptr = realloc(data, newsize); if(ptr == NULL) - fatal(_("failed to reallocate %u bytes\n"), (unsigned)newsize); + mdvi_fatal(_("failed to reallocate %u bytes\n"), (unsigned)newsize); return ptr; } @@ -231,21 +231,21 @@ void *mdvi_calloc(size_t nmemb, size_t size) void *ptr; if(nmemb == 0) - crash(_("attempted to callocate 0 members\n")); + mdvi_crash(_("attempted to callocate 0 members\n")); if(size == 0) - crash(_("attempted to callocate %u members with size 0\n"), + mdvi_crash(_("attempted to callocate %u members with size 0\n"), (unsigned)nmemb); ptr = calloc(nmemb, size); if(ptr == 0) - fatal(_("failed to allocate %ux%u bytes\n"), - (unsigned)nmemb, (unsigned)size); + mdvi_fatal(_("failed to allocate %ux%u bytes\n"), + (unsigned)nmemb, (unsigned)size); return ptr; } void mdvi_free(void *ptr) { if(ptr == NULL) - crash(_("attempted to free NULL pointer\n")); + mdvi_crash(_("attempted to free NULL pointer\n")); free(ptr); } diff --git a/backend/dvi/mdvi-lib/vf.c b/backend/dvi/mdvi-lib/vf.c index 640077ad..3826ae87 100644 --- a/backend/dvi/mdvi-lib/vf.c +++ b/backend/dvi/mdvi-lib/vf.c @@ -79,8 +79,8 @@ static int vf_load_font(DviParams *params, DviFont *font) fseek(p, (long)mlen, SEEK_CUR); checksum = fuget4(p); if(checksum && font->checksum && checksum != font->checksum) { - warning(_("%s: Checksum mismatch (expected %u, got %u)\n"), - font->fontname, font->checksum, checksum); + mdvi_warning(_("%s: Checksum mismatch (expected %u, got %u)\n"), + font->fontname, font->checksum, checksum); } else if(!font->checksum) font->checksum = checksum; font->design = fuget4(p); @@ -127,8 +127,8 @@ static int vf_load_font(DviParams *params, DviFont *font) /* get the font */ ref = font_reference(params, id, name, checksum, hdpi, vdpi, scale); if(ref == NULL) { - error(_("(vf) %s: could not load font `%s'\n"), - font->fontname, name); + mdvi_error(_("(vf) %s: could not load font `%s'\n"), + font->fontname, name); goto error; } mdvi_free(name); @@ -177,8 +177,8 @@ static int vf_load_font(DviParams *params, DviFont *font) nchars = cc + 16; } if(font->chars[cc].offset) { - error(_("(vf) %s: character %d redefined\n"), - font->fontname, cc); + mdvi_error(_("(vf) %s: character %d redefined\n"), + font->fontname, cc); goto error; } @@ -200,7 +200,7 @@ static int vf_load_font(DviParams *params, DviFont *font) op = fuget1(p); } if(op != 248) { - error(_("(vf) %s: no postamble\n"), font->fontname); + mdvi_error(_("(vf) %s: no postamble\n"), font->fontname); goto error; } @@ -226,7 +226,7 @@ static int vf_load_font(DviParams *params, DviFont *font) return 0; badvf: - error(_("%s: File corrupted, or not a VF file.\n"), font->fontname); + mdvi_error(_("%s: File corrupted, or not a VF file.\n"), font->fontname); error: if(font->chars) mdvi_free(font->chars); -- 2.43.5