Ensure we're using unsigned char's ptrs for ctype functions. If not,
Pazpar2 will crash on Windows. This commit also removes ctype.h includes
from source where it's not needed.
int c;
/* skip white space */
int c;
/* skip white space */
- while (*cp && (c = raw_char(tolower(*cp))) < 0)
+ while (*cp && (c = raw_char(tolower(*(const unsigned char *)cp))) < 0)
#include <unistd.h>
#endif
#include <signal.h>
#include <unistd.h>
#endif
#include <signal.h>
#include <assert.h>
#include <yaz/marcdisp.h>
#include <assert.h>
#include <yaz/marcdisp.h>
#endif
#include <signal.h>
#endif
#include <signal.h>
#include <assert.h>
#include <yaz/log.h>
#include <assert.h>
#include <yaz/log.h>
#include <config.h>
#endif
#include <config.h>
#endif
#include <assert.h>
#ifdef WIN32
#include <io.h>
#include <assert.h>
#ifdef WIN32
#include <io.h>
while (*cp == ' ')
cp++;
content_len = 0;
while (*cp == ' ')
cp++;
content_len = 0;
- while (*cp && isdigit(*cp))
+ while (*cp && isdigit(*(const unsigned char *)cp))
content_len = content_len*10 + (*cp++ - '0');
if (content_len < 0) /* prevent negative offsets */
content_len = 0;
content_len = content_len*10 + (*cp++ - '0');
if (content_len < 0) /* prevent negative offsets */
content_len = 0;
return 0;
*(value++) = '\0';
h->name = nmem_strdup(c->nmem, p);
return 0;
*(value++) = '\0';
h->name = nmem_strdup(c->nmem, p);
- while (isspace(*value))
+ while (isspace(*(const unsigned char *) value))
value++;
if (value >= p2) // Empty header;
{
value++;
if (value >= p2) // Empty header;
{
#endif
#include <stdlib.h>
#include <string.h>
#endif
#include <stdlib.h>
#include <string.h>
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
/** \brief removes leading whitespace.. Removes suffix cahrs in rm_chars */
char * normalize7bit_generic(char * str, const char * rm_chars)
{
/** \brief removes leading whitespace.. Removes suffix cahrs in rm_chars */
char * normalize7bit_generic(char * str, const char * rm_chars)
{
- unsigned char *p, *pe;
- for (p = str; *p && isspace(*p); p++)
+ char *p, *pe;
+ for (p = str; *p && isspace(*(unsigned char *)p); p++)
;
for (pe = p + strlen(p) - 1;
pe > p && strchr(rm_chars, *pe); pe--)
;
for (pe = p + strlen(p) - 1;
pe > p && strchr(rm_chars, *pe); pe--)
char * normalize7bit_mergekey(char *buf, int skiparticle)
{
char * normalize7bit_mergekey(char *buf, int skiparticle)
{
- unsigned char *p = buf, *pout = buf;
+ char *p = buf, *pout = buf;
if (skiparticle)
{
char firstword[64];
char articles[] = "the den der die des an a "; // must end in space
if (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)
p++;
pout = firstword;
while (*p && *p != ' ' && pout - firstword < 62)
- *(pout++) = tolower(*(p++));
+ *(pout++) = tolower(*(unsigned char *)(p++));
*(pout++) = ' ';
*(pout++) = '\0';
if (!strstr(articles, firstword))
*(pout++) = ' ';
*(pout++) = '\0';
if (!strstr(articles, firstword))
- while (*p && !isalnum(*p))
+ while (*p && !isalnum(*(unsigned char *)p))
- while (isalnum(*p))
- *(pout++) = tolower(*(p++));
+ while (isalnum(*(unsigned char *)p))
+ *(pout++) = tolower(*(unsigned char *)(p++));
- while (*p && !isalnum(*p))
+ while (*p && !isalnum(*(unsigned char *)p))
#include <config.h>
#endif
#include <config.h>
#endif
#include <math.h>
#include <stdlib.h>
#include <math.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
#include <yaz/yaz-util.h>
#include "termlists.h"
#include <yaz/yaz-util.h>
#include "termlists.h"