X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=blobdiff_plain;f=util%2Fcharmap.c;h=c67cae95278d364632974536156a5e302f5edd12;hp=1e718a56db098c6b496de05ac746db31e9c82be1;hb=e2d9fea369fcf6f0e8927b7b53b69d0bc4f9a50a;hpb=09a9136012a8e5b13ba96150bad03193660e6015 diff --git a/util/charmap.c b/util/charmap.c index 1e718a5..c67cae9 100644 --- a/util/charmap.c +++ b/util/charmap.c @@ -1,5 +1,5 @@ /* This file is part of the Zebra server. - Copyright (C) 1994-2009 Index Data + Copyright (C) 1994-2011 Index Data Zebra is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -26,6 +26,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Zebra dictionary. */ +#if HAVE_CONFIG_H +#include +#endif #include #include #include @@ -239,7 +242,6 @@ ucs4_t zebra_prim_w(ucs4_t **s) ucs4_t i = 0; char fmtstr[8]; - yaz_log(YLOG_DEBUG, "prim_w %.3s", (char *) *s); if (**s == '\\' && 1[*s]) { (*s)++; @@ -425,7 +427,7 @@ static int scan_string(char *s_native, ucs4_t arg[512]; ucs4_t arg_prim[512]; - ucs4_t *s0, *s = arg; + ucs4_t *s = arg; ucs4_t c, begin, end; size_t i; @@ -482,9 +484,16 @@ static int scan_string(char *s_native, break; case '(': ++s; - s0 = s; i = 0; + i = 0; while (*s != ')' || s[-1] == '\\') + { + if (*s == '\0') + { + yaz_log(YLOG_FATAL, "Missing ) in charmap"); + return -1; + } arg_prim[i++] = zebra_prim_w(&s); + } arg_prim[i] = 0; if (scan_to_utf8(t_utf8, arg_prim, zebra_ucs4_strlen(arg_prim), str, sizeof(str)-1)) return -1; @@ -728,7 +737,7 @@ chrmaptab chrmaptab_create(const char *tabpath, const char *name, chrmaptab_destroy(res); res = 0; } - yaz_log(YLOG_DEBUG, "maptab %s close %d errors", name, errors); + yaz_log(YLOG_DEBUG, "maptab %s num=%d close %d errors", name, num, errors); if (t_utf8 != 0) yaz_iconv_close(t_utf8); if (t_unicode != 0) @@ -746,6 +755,7 @@ void chrmaptab_destroy(chrmaptab tab) /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab