X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=src%2Fnormalize7bit.c;h=6e1562abce1499656efe3e26c1b56173cc1d714a;hb=57b393132b1e795da47e50c13260a1346c8029e9;hp=f6a6d498430f51845a491d9afd91351c33e86a38;hpb=e107b0011a295ccc61502d6e5ea79d9125a3fbb4;p=pazpar2-moved-to-github.git diff --git a/src/normalize7bit.c b/src/normalize7bit.c index f6a6d49..6e1562a 100644 --- a/src/normalize7bit.c +++ b/src/normalize7bit.c @@ -21,14 +21,14 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA \brief char and string normalization for 7bit ascii only */ +#if HAVE_CONFIG_H +#include +#endif + #include #include #include -#if HAVE_CONFIG_H -#include "cconfig.h" -#endif - #include "normalize7bit.h" @@ -36,7 +36,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA char * normalize7bit_generic(char * str, const char * rm_chars) { char *p, *pe; - for (p = str; *p && isspace(*p); p++) + for (p = str; *p && isspace(*(unsigned char *)p); p++) ; for (pe = p + strlen(p) - 1; pe > p && strchr(rm_chars, *pe); pe--) @@ -55,11 +55,11 @@ char * normalize7bit_mergekey(char *buf, int skiparticle) char firstword[64]; char articles[] = "the den der die des an a "; // must end in space - while (*p && !isalnum(*p)) + while (*p && !isalnum(*(unsigned char *)p)) p++; pout = firstword; while (*p && *p != ' ' && pout - firstword < 62) - *(pout++) = tolower(*(p++)); + *(pout++) = tolower(*(unsigned char *)(p++)); *(pout++) = ' '; *(pout++) = '\0'; if (!strstr(articles, firstword)) @@ -69,13 +69,13 @@ char * normalize7bit_mergekey(char *buf, int skiparticle) while (*p) { - while (*p && !isalnum(*p)) + while (*p && !isalnum(*(unsigned char *)p)) p++; - while (isalnum(*p)) - *(pout++) = tolower(*(p++)); + while (isalnum(*(unsigned char *)p)) + *(pout++) = tolower(*(unsigned char *)(p++)); if (*p) *(pout++) = ' '; - while (*p && !isalnum(*p)) + while (*p && !isalnum(*(unsigned char *)p)) p++; } if (buf != pout) @@ -99,10 +99,10 @@ int extract7bit_dates(const char *buf, int *first, int *last, int longdate) const char *e; int len; - while (*buf && !isdigit(*buf)) + while (*buf && !isdigit(*(unsigned char *)buf)) buf++; len = 0; - for (e = buf; *e && isdigit(*e); e++) + for (e = buf; *e && isdigit(*(unsigned char *)e); e++) len++; if ((len == 4 && !longdate) || (longdate && len >= 4 && len <= 8)) {