From 905df6869e5ad8ab9f34590cce771fe50c444473 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 30 Dec 2004 00:11:00 +0000 Subject: [PATCH] Avoid signed char subscript --- src/log.c | 10 ++++------ src/marcdisp.c | 6 +++--- src/matchstr.c | 6 +++--- src/odr_util.c | 4 ++-- src/oid.c | 6 +++--- ztest/read-grs.c | 6 +++--- ztest/read-marc.c | 4 ++-- ztest/ztest.c | 4 ++-- 8 files changed, 22 insertions(+), 24 deletions(-) diff --git a/src/log.c b/src/log.c index 6fd475d..e8aa1a8 100644 --- a/src/log.c +++ b/src/log.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2004, Index Data * See the file LICENSE for details. * - * $Id: log.c,v 1.18 2004-12-13 14:21:55 heikki Exp $ + * $Id: log.c,v 1.19 2004-12-30 00:11:00 adam Exp $ */ /** @@ -397,15 +397,13 @@ int yaz_log_mask_str_x (const char *str, int level) { const char *p; int i; - int found; - int negated; char clean[255] = ""; char *n = clean; while (*str) { - found = 0; - negated=0; + int found = 0; + int negated = 0; for (p = str; *p && *p != ','; p++) ; if (*str=='-') @@ -413,7 +411,7 @@ int yaz_log_mask_str_x (const char *str, int level) negated=1; str++; } - if (isdigit(*str)) + if (isdigit(*(unsigned char *) str)) { level = atoi (str); found = 1; diff --git a/src/marcdisp.c b/src/marcdisp.c index e42080a..ef06425 100644 --- a/src/marcdisp.c +++ b/src/marcdisp.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2004, Index Data * See the file LICENSE for details. * - * $Id: marcdisp.c,v 1.10 2004-11-26 11:01:05 adam Exp $ + * $Id: marcdisp.c,v 1.11 2004-12-30 00:12:13 adam Exp $ */ /** @@ -84,11 +84,11 @@ int yaz_marc_decode_wrbuf (yaz_marc_t mt, const char *buf, int bsize, WRBUF wr) /* ballout if bsize is known and record_length is less than that */ if (bsize != -1 && record_length > bsize) return -1; - if (isdigit(buf[10])) + if (isdigit(((const unsigned char *) buf)[10])) indicator_length = atoi_n (buf+10, 1); else indicator_length = 2; - if (isdigit(buf[11])) + if (isdigit(((const unsigned char *) buf)[11])) identifier_length = atoi_n (buf+11, 1); else identifier_length = 2; diff --git a/src/matchstr.c b/src/matchstr.c index 95c32e0..4db3360 100644 --- a/src/matchstr.c +++ b/src/matchstr.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2004, Index Data. * See the file LICENSE for details. * - * $Id: matchstr.c,v 1.2 2004-10-15 00:19:00 adam Exp $ + * $Id: matchstr.c,v 1.3 2004-12-30 00:14:00 adam Exp $ */ /** @@ -30,8 +30,8 @@ int yaz_matchstr(const char *s1, const char *s2) { while (*s1 && *s2) { - char c1 = *s1; - char c2 = *s2; + unsigned char c1 = *s1; + unsigned char c2 = *s2; if (c2 == '?') return 0; diff --git a/src/odr_util.c b/src/odr_util.c index 0d4db2e..2748da4 100644 --- a/src/odr_util.c +++ b/src/odr_util.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2004, Index Data * See the file LICENSE for details. * - * $Id: odr_util.c,v 1.5 2004-10-15 00:19:00 adam Exp $ + * $Id: odr_util.c,v 1.6 2004-12-30 00:14:38 adam Exp $ */ /** * \file odr_util.c @@ -69,7 +69,7 @@ Odr_oid *odr_getoidbystr_nmem(NMEM nmem, const char *str) const char *p = str; Odr_oid *ret; - if (!isdigit(*str)) + if (!isdigit(*(const unsigned char *) str)) return 0; while ((p = strchr(p, '.'))) num++, p++; diff --git a/src/oid.c b/src/oid.c index 0fb1b1d..b7ec98d 100644 --- a/src/oid.c +++ b/src/oid.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2004, Index Data * See the file LICENSE for details. * - * $Id: oid.c,v 1.5 2004-12-22 23:45:13 adam Exp $ + * $Id: oid.c,v 1.6 2004-12-30 00:12:54 adam Exp $ */ /** @@ -542,7 +542,7 @@ static oid_value oid_getval_raw(const char *name) int val = 0, i = 0, oid[OID_SIZE]; struct oident *oident; - while (isdigit (*name)) + while (isdigit (*(const unsigned char *) name)) { val = val*10 + (*name - '0'); name++; @@ -568,7 +568,7 @@ oid_value oid_getvalbyname(const char *name) struct oident_list *ol; oid_init (); - if (isdigit (*name)) + if (isdigit (*(const unsigned char *) name)) return oid_getval_raw (name); for (ol = oident_table; ol; ol = ol->next) if (!yaz_matchstr(ol->oident.desc, name)) diff --git a/ztest/read-grs.c b/ztest/read-grs.c index 2acbca5..18b668f 100644 --- a/ztest/read-grs.c +++ b/ztest/read-grs.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2003, Index Data. * See the file LICENSE for details. * - * $Id: read-grs.c,v 1.10 2004-12-13 14:21:59 heikki Exp $ + * $Id: read-grs.c,v 1.11 2004-12-30 00:18:04 adam Exp $ */ /* @@ -32,7 +32,7 @@ static Z_GenericRecord *read_grs1(FILE *f, ODR o) while (fgets(buf = line, 512, f)) { - while (*buf && isspace(*buf)) + while (*buf && isspace(*(unsigned char *) buf)) buf++; if (!*buf || *buf == '#') continue; @@ -50,7 +50,7 @@ static Z_GenericRecord *read_grs1(FILE *f, ODR o) if (!(buf = strchr(buf, ')'))) return 0; buf++; - while (*buf && isspace(*buf)) + while (*buf && isspace(*(unsigned char *) buf)) buf++; if (!*buf) return 0; diff --git a/ztest/read-marc.c b/ztest/read-marc.c index cc9ca29..850b706 100644 --- a/ztest/read-marc.c +++ b/ztest/read-marc.c @@ -2,7 +2,7 @@ * Copyright (c) 2002, Index Data. * See the file LICENSE for details. * - * $Id: read-marc.c,v 1.4 2002-12-16 13:13:53 adam Exp $ + * $Id: read-marc.c,v 1.5 2004-12-30 00:18:04 adam Exp $ */ /* @@ -1537,7 +1537,7 @@ static int atoin (const char *buf, int n) int val = 0; while (--n >= 0) { - if (isdigit(*buf)) + if (isdigit(*(const unsigned char *) buf)) val = val*10 + (*buf - '0'); buf++; } diff --git a/ztest/ztest.c b/ztest/ztest.c index 1396c4e..c7f7fdb 100644 --- a/ztest/ztest.c +++ b/ztest/ztest.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2004, Index Data. * See the file LICENSE for details. * - * $Id: ztest.c,v 1.67 2004-11-18 15:18:14 heikki Exp $ + * $Id: ztest.c,v 1.68 2004-12-30 00:18:04 adam Exp $ */ /* @@ -568,7 +568,7 @@ int ztest_scan(void *handle, bend_scan_rr *q) memcpy(term, q->term->term->u.general->buf, q->term->term->u.general->len); term[q->term->term->u.general->len] = '\0'; for (p = term; *p; p++) - if (islower(*p)) + if (islower(*(unsigned char *) p)) *p = toupper(*p); fseek(f, 0, SEEK_SET); -- 1.7.10.4