Changeset 3441:f78b184ef598

Show
Ignore:
Timestamp:
2003-07-24 11:40:50 (5 years ago)
Author:
Vincent Lefevre <vincent@…>
Branch:
HEAD
Message:

Some functions/macros like isspace take an int and require the
argument to have the value of an unsigned char (or EOF). Under
Solaris, gcc complains when the argument is a char (as this is a
possible bug, on platforms where char is signed, like Solaris). The
attached patch fixes such problems (well, perhaps I've changed more
than necessary, but this doesn't hurt).

Files:
21 modified

Legend:

Unmodified
Added
Removed
  • alias.c

    r3317 r3441  
    354354{ 
    355355  return (c == '-' || c == '_' || c == '+' || c == '=' || c == '.' || 
    356           isalnum (c)); 
     356          isalnum ((unsigned char) c)); 
    357357} 
    358358 
  • copy.c

    r3341 r3441  
    845845  ADDRESS *a = NULL; 
    846846 
    847   switch (tolower (*s)) 
     847  switch (tolower ((unsigned char) *s)) 
    848848  { 
    849849    case 'r':  
  • handler.c

    r3323 r3441  
    155155   
    156156  /* quoted-printable triple */ 
    157   if (*s == '=' && isxdigit (*(s+1)) && isxdigit (*(s+2))) 
     157  if (*s == '=' && 
     158      isxdigit ((unsigned char) *(s+1)) && 
     159      isxdigit ((unsigned char) *(s+2))) 
    158160  { 
    159161    *d = (hexval (*(s+1)) << 4) | hexval (*(s+2)); 
  • imap/command.c

    r3433 r3441  
    309309  s = imap_next_word (idata->cmd.buf); 
    310310 
    311   if ((idata->state == IMAP_SELECTED) && isdigit (*s)) 
     311  if ((idata->state == IMAP_SELECTED) && isdigit ((unsigned char) *s)) 
    312312  { 
    313313    pn = s; 
     
    526526  memset (idata->rights, 0, sizeof (idata->rights)); 
    527527 
    528   while (*s && !isspace(*s)) 
     528  while (*s && !isspace((unsigned char) *s)) 
    529529  { 
    530530    switch (*s)  
  • imap/imap.c

    r3437 r3441  
    12351235        s = imap_next_word (s); 
    12361236        s = imap_next_word (s); 
    1237         if (isdigit (*s)) 
     1237        if (isdigit ((unsigned char) *s)) 
    12381238        { 
    12391239          if (*s != '0') 
  • imap/message.c

    r3173 r3441  
    853853      SKIPWS (s); 
    854854      ptmp = tmp; 
    855       while (isdigit (*s)) 
     855      while (isdigit ((unsigned char) *s)) 
    856856        *ptmp++ = *s++; 
    857857      *ptmp = 0; 
  • imap/util.c

    r3433 r3441  
    311311  pc++; 
    312312  pn = pc; 
    313   while (isdigit (*pc)) 
     313  while (isdigit ((unsigned char) *pc)) 
    314314    pc++; 
    315315  *pc = 0; 
  • init.c

    r3410 r3441  
    140140            if (!*tok->dptr) 
    141141                return -1; /* premature end of token */ 
    142           mutt_buffer_addch (dest, (toupper (*tok->dptr) - '@') & 0x7f); 
     142          mutt_buffer_addch (dest, (toupper ((unsigned char) *tok->dptr) 
     143                                    - '@') & 0x7f); 
    143144          tok->dptr++; 
    144145          break; 
     
    181182        mutt_buffer_addch (dest, '\033'); 
    182183      else if (isalpha ((unsigned char) ch)) 
    183         mutt_buffer_addch (dest, toupper (ch) - '@'); 
     184        mutt_buffer_addch (dest, toupper ((unsigned char) ch) - '@'); 
    184185      else 
    185186      { 
  • intl/l10nflist.c

    r2769 r3441  
    357357 
    358358  for (cnt = 0; cnt < name_len; ++cnt) 
    359     if (isalnum (codeset[cnt])) 
     359    if (isalnum ((unsigned char) codeset[cnt])) 
    360360      { 
    361361        ++len; 
    362362 
    363         if (isalpha (codeset[cnt])) 
     363        if (isalpha ((unsigned char) codeset[cnt])) 
    364364          only_digit = 0; 
    365365      } 
     
    375375 
    376376      for (cnt = 0; cnt < name_len; ++cnt) 
    377         if (isalpha (codeset[cnt])) 
    378           *wp++ = tolower (codeset[cnt]); 
    379         else if (isdigit (codeset[cnt])) 
     377        if (isalpha ((unsigned char) codeset[cnt])) 
     378          *wp++ = tolower ((unsigned char) codeset[cnt]); 
     379        else if (isdigit ((unsigned char) codeset[cnt])) 
    380380          *wp++ = codeset[cnt]; 
    381381 
  • intl/loadmsgcat.c

    r2769 r3441  
    509509 
    510510          nplurals += 9; 
    511           while (*nplurals != '\0' && isspace (*nplurals)) 
     511          while (*nplurals != '\0' && isspace ((unsigned char) *nplurals)) 
    512512            ++nplurals; 
    513513#if defined HAVE_STRTOUL || defined _LIBC 
  • intl/localealias.c

    r2769 r3441  
    245245      cp = buf; 
    246246      /* Ignore leading white space.  */ 
    247       while (isspace (cp[0])) 
     247      while (isspace ((unsigned char) cp[0])) 
    248248        ++cp; 
    249249 
     
    252252        { 
    253253          alias = cp++; 
    254           while (cp[0] != '\0' && !isspace (cp[0])) 
     254          while (cp[0] != '\0' && !isspace ((unsigned char) cp[0])) 
    255255            ++cp; 
    256256          /* Terminate alias name.  */ 
     
    259259 
    260260          /* Now look for the beginning of the value.  */ 
    261           while (isspace (cp[0])) 
     261          while (isspace ((unsigned char) cp[0])) 
    262262            ++cp; 
    263263 
     
    268268 
    269269              value = cp++; 
    270               while (cp[0] != '\0' && !isspace (cp[0])) 
     270              while (cp[0] != '\0' && !isspace ((unsigned char) cp[0])) 
    271271                ++cp; 
    272272              /* Terminate value.  */ 
  • keymap.c

    r3435 r3441  
    121121static int parse_keycode (const char *s) 
    122122{ 
    123   if (isdigit (s[1]) && isdigit (s[2]) && isdigit (s[3]) && s[4] == '>') 
     123  if (isdigit ((unsigned char) s[1]) && 
     124      isdigit ((unsigned char) s[2]) && 
     125      isdigit ((unsigned char) s[3]) && 
     126      s[4] == '>') 
    124127  { 
    125128    return (s[3] - '0') + (s[2] - '0') * 8 + (s[1] - '0') * 64; 
  • lib.c

    r3379 r3441  
    171171  while (*p) 
    172172  { 
    173     *p = tolower (*p); 
     173    *p = tolower ((unsigned char) *p); 
    174174    p++; 
    175175  } 
     
    609609  while (*(p = haystack)) 
    610610  { 
    611     for (q = needle; *p && *q && tolower (*p) == tolower (*q); p++, q++) 
     611    for (q = needle; 
     612         *p && *q && 
     613           tolower ((unsigned char) *p) == tolower ((unsigned char) *q); 
     614         p++, q++) 
    612615      ; 
    613616    if (!*q) 
  • makedoc.c

    r3179 r3441  
    219219static char *skip_ws (char *s) 
    220220{ 
    221   while (*s && isspace (*s)) 
     221  while (*s && isspace ((unsigned char) *s)) 
    222222    s++; 
    223223 
     
    301301    else if (!is_quoted && strchr (single_char_tokens, *t)) 
    302302      break; 
    303     else if (!is_quoted && isspace (*t)) 
     303    else if (!is_quoted && isspace ((unsigned char) *t)) 
    304304      break; 
    305305    else 
     
    487487      /* heuristic! */ 
    488488      strncpy (t, s + 5, l); 
    489       for (; *t; t++) *t = tolower (*t); 
     489      for (; *t; t++) *t = tolower ((unsigned char) *t); 
    490490      break; 
    491491    } 
     
    494494      /* heuristic! */ 
    495495      strncpy (t, s + 2, l); 
    496       for (; *t; t++) *t = tolower (*t); 
     496      for (; *t; t++) *t = tolower ((unsigned char) *t); 
    497497      break; 
    498498    } 
     
    11891189      { 
    11901190        ref = s; 
    1191         while (isalnum (*s) || *s == '-' || *s == '_') 
     1191        while (isalnum ((unsigned char) *s) || *s == '-' || *s == '_') 
    11921192          ++s; 
    11931193 
  • muttlib.c

    r3415 r3441  
    522522               MAX(destlen - idx - pwnl - 1, 0)); 
    523523      memcpy (&dest[idx], pw->pw_name, MIN(destlen - idx - 1, pwnl)); 
    524       dest[idx] = toupper (dest[idx]); 
     524      dest[idx] = toupper ((unsigned char) dest[idx]); 
    525525    } 
    526526  } 
  • pattern.c

    r3417 r3441  
    279279    else 
    280280      pat->min = strtol (s->dptr, &tmp, 0); 
    281     if (toupper (*tmp) == 'K') /* is there a prefix? */ 
     281    if (toupper ((unsigned char) *tmp) == 'K') /* is there a prefix? */ 
    282282    { 
    283283      pat->min *= 1024; 
    284284      tmp++; 
    285285    } 
    286     else if (toupper (*tmp) == 'M') 
     286    else if (toupper ((unsigned char) *tmp) == 'M') 
    287287    { 
    288288      pat->min *= 1048576; 
     
    313313    /* range maximum */ 
    314314    pat->max = strtol (tmp, &tmp, 0); 
    315     if (toupper (*tmp) == 'K') 
     315    if (toupper ((unsigned char) *tmp) == 'K') 
    316316    { 
    317317      pat->max *= 1024; 
    318318      tmp++; 
    319319    } 
    320     else if (toupper (*tmp) == 'M') 
     320    else if (toupper ((unsigned char) *tmp) == 'M') 
    321321    { 
    322322      pat->max *= 1048576; 
  • rfc2047.c

    r3195 r3441  
    607607        break; 
    608608      case 3: 
    609         if (toupper (*pp) == 'Q') 
     609        if (toupper ((unsigned char) *pp) == 'Q') 
    610610          enc = ENCQUOTEDPRINTABLE; 
    611         else if (toupper (*pp) == 'B') 
     611        else if (toupper ((unsigned char) *pp) == 'B') 
    612612          enc = ENCBASE64; 
    613613        else 
  • rfc2231.c

    r3179 r3441  
    136136    { 
    137137      *s = '\0'; s++; /* let s point to the first character of index. */ 
    138       for (t = s; *t && isdigit (*t); t++) 
     138      for (t = s; *t && isdigit ((unsigned char) *t); t++) 
    139139        ; 
    140140      encoded = (*t == '*'); 
     
    209209  for (d = dest; *src; src++) 
    210210  { 
    211     if (*src == '%' && isxdigit (*(src + 1)) && isxdigit (*(src + 2))) 
     211    if (*src == '%' && 
     212        isxdigit ((unsigned char) *(src + 1)) && 
     213        isxdigit ((unsigned char) *(src + 2))) 
    212214    { 
    213215      *d++ = (hexval (*(src + 1)) << 4) | (hexval (*(src + 2))); 
  • rfc822.c

    r3311 r3441  
    175175  while (*s) 
    176176  { 
    177     if (ISSPACE (*s) || is_special (*s)) 
     177    if (ISSPACE ((unsigned char) *s) || is_special (*s)) 
    178178      break; 
    179179    if (*tokenlen < tokenmax) 
     
    346346    last = last->next; 
    347347 
    348   ws_pending = isspace (*s); 
     348  ws_pending = isspace ((unsigned char) *s); 
    349349   
    350350  SKIPWS (s); 
     
    480480      s = ps; 
    481481    } 
    482     ws_pending = isspace (*s); 
     482    ws_pending = isspace ((unsigned char) *s); 
    483483    SKIPWS (s); 
    484484  } 
  • strcasecmp.c

    r2766 r3441  
    1010  while (*s1 && *s2 && l < n) 
    1111  { 
    12     c1 = tolower (*s1); 
    13     c2 = tolower (*s2); 
     12    c1 = tolower ((unsigned char) *s1); 
     13    c2 = tolower ((unsigned char) *s2); 
    1414    if (c1 != c2) 
    1515      return (c1 - c2); 
     
    3030  while (*s1 && *s2) 
    3131  { 
    32     c1 = tolower (*s1); 
    33     c2 = tolower (*s2); 
     32    c1 = tolower ((unsigned char) *s1); 
     33    c2 = tolower ((unsigned char) *s2); 
    3434    if (c1 != c2) 
    3535      return (c1 - c2); 
  • url.c

    r3195 r3441  
    5151  { 
    5252    if (*s == '%' && s[1] && s[2] && 
    53         isxdigit (s[1]) && isxdigit (s[2]) && 
     53        isxdigit ((unsigned char) s[1]) && 
     54        isxdigit ((unsigned char) s[2]) && 
    5455        hexval (s[1]) >= 0 && hexval (s[2]) >= 0) 
    5556    {