mutt stable branch with some hacks

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).

+57 -45
+1 -1
alias.c
··· 353 353 static int check_alias_name_char (char c) 354 354 { 355 355 return (c == '-' || c == '_' || c == '+' || c == '=' || c == '.' || 356 - isalnum (c)); 356 + isalnum ((unsigned char) c)); 357 357 } 358 358 359 359 int mutt_check_alias_name (const char *s, char *d)
+1 -1
copy.c
··· 844 844 845 845 ADDRESS *a = NULL; 846 846 847 - switch (tolower (*s)) 847 + switch (tolower ((unsigned char) *s)) 848 848 { 849 849 case 'r': 850 850 {
+3 -1
handler.c
··· 154 154 return 1; 155 155 156 156 /* 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))) 158 160 { 159 161 *d = (hexval (*(s+1)) << 4) | hexval (*(s+2)); 160 162 return 0;
+2 -2
imap/command.c
··· 308 308 309 309 s = imap_next_word (idata->cmd.buf); 310 310 311 - if ((idata->state == IMAP_SELECTED) && isdigit (*s)) 311 + if ((idata->state == IMAP_SELECTED) && isdigit ((unsigned char) *s)) 312 312 { 313 313 pn = s; 314 314 s = imap_next_word (s); ··· 525 525 /* zero out current rights set */ 526 526 memset (idata->rights, 0, sizeof (idata->rights)); 527 527 528 - while (*s && !isspace(*s)) 528 + while (*s && !isspace((unsigned char) *s)) 529 529 { 530 530 switch (*s) 531 531 {
+1 -1
imap/imap.c
··· 1234 1234 { 1235 1235 s = imap_next_word (s); 1236 1236 s = imap_next_word (s); 1237 - if (isdigit (*s)) 1237 + if (isdigit ((unsigned char) *s)) 1238 1238 { 1239 1239 if (*s != '0') 1240 1240 {
+1 -1
imap/message.c
··· 852 852 s += 11; 853 853 SKIPWS (s); 854 854 ptmp = tmp; 855 - while (isdigit (*s)) 855 + while (isdigit ((unsigned char) *s)) 856 856 *ptmp++ = *s++; 857 857 *ptmp = 0; 858 858 h->content_length = atoi (tmp);
+1 -1
imap/util.c
··· 310 310 return (-1); 311 311 pc++; 312 312 pn = pc; 313 - while (isdigit (*pc)) 313 + while (isdigit ((unsigned char) *pc)) 314 314 pc++; 315 315 *pc = 0; 316 316 *bytes = atoi(pn);
+3 -2
init.c
··· 139 139 case 'C': 140 140 if (!*tok->dptr) 141 141 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); 143 144 tok->dptr++; 144 145 break; 145 146 case 'r': ··· 180 181 else if (ch == '[') 181 182 mutt_buffer_addch (dest, '\033'); 182 183 else if (isalpha ((unsigned char) ch)) 183 - mutt_buffer_addch (dest, toupper (ch) - '@'); 184 + mutt_buffer_addch (dest, toupper ((unsigned char) ch) - '@'); 184 185 else 185 186 { 186 187 mutt_buffer_addch (dest, '^');
+5 -5
intl/l10nflist.c
··· 356 356 size_t cnt; 357 357 358 358 for (cnt = 0; cnt < name_len; ++cnt) 359 - if (isalnum (codeset[cnt])) 359 + if (isalnum ((unsigned char) codeset[cnt])) 360 360 { 361 361 ++len; 362 362 363 - if (isalpha (codeset[cnt])) 363 + if (isalpha ((unsigned char) codeset[cnt])) 364 364 only_digit = 0; 365 365 } 366 366 ··· 374 374 wp = retval; 375 375 376 376 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])) 380 380 *wp++ = codeset[cnt]; 381 381 382 382 *wp = '\0';
+1 -1
intl/loadmsgcat.c
··· 508 508 struct parse_args args; 509 509 510 510 nplurals += 9; 511 - while (*nplurals != '\0' && isspace (*nplurals)) 511 + while (*nplurals != '\0' && isspace ((unsigned char) *nplurals)) 512 512 ++nplurals; 513 513 #if defined HAVE_STRTOUL || defined _LIBC 514 514 n = strtoul (nplurals, &endp, 10);
+4 -4
intl/localealias.c
··· 244 244 245 245 cp = buf; 246 246 /* Ignore leading white space. */ 247 - while (isspace (cp[0])) 247 + while (isspace ((unsigned char) cp[0])) 248 248 ++cp; 249 249 250 250 /* A leading '#' signals a comment line. */ 251 251 if (cp[0] != '\0' && cp[0] != '#') 252 252 { 253 253 alias = cp++; 254 - while (cp[0] != '\0' && !isspace (cp[0])) 254 + while (cp[0] != '\0' && !isspace ((unsigned char) cp[0])) 255 255 ++cp; 256 256 /* Terminate alias name. */ 257 257 if (cp[0] != '\0') 258 258 *cp++ = '\0'; 259 259 260 260 /* Now look for the beginning of the value. */ 261 - while (isspace (cp[0])) 261 + while (isspace ((unsigned char) cp[0])) 262 262 ++cp; 263 263 264 264 if (cp[0] != '\0') ··· 267 267 size_t value_len; 268 268 269 269 value = cp++; 270 - while (cp[0] != '\0' && !isspace (cp[0])) 270 + while (cp[0] != '\0' && !isspace ((unsigned char) cp[0])) 271 271 ++cp; 272 272 /* Terminate value. */ 273 273 if (cp[0] == '\n')
+4 -1
keymap.c
··· 120 120 */ 121 121 static int parse_keycode (const char *s) 122 122 { 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] == '>') 124 127 { 125 128 return (s[3] - '0') + (s[2] - '0') * 8 + (s[1] - '0') * 64; 126 129 }
+5 -2
lib.c
··· 170 170 171 171 while (*p) 172 172 { 173 - *p = tolower (*p); 173 + *p = tolower ((unsigned char) *p); 174 174 p++; 175 175 } 176 176 ··· 608 608 609 609 while (*(p = haystack)) 610 610 { 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++) 612 615 ; 613 616 if (!*q) 614 617 return (haystack);
+5 -5
makedoc.c
··· 218 218 219 219 static char *skip_ws (char *s) 220 220 { 221 - while (*s && isspace (*s)) 221 + while (*s && isspace ((unsigned char) *s)) 222 222 s++; 223 223 224 224 return s; ··· 300 300 } 301 301 else if (!is_quoted && strchr (single_char_tokens, *t)) 302 302 break; 303 - else if (!is_quoted && isspace (*t)) 303 + else if (!is_quoted && isspace ((unsigned char) *t)) 304 304 break; 305 305 else 306 306 *d++ = *t; ··· 486 486 { 487 487 /* heuristic! */ 488 488 strncpy (t, s + 5, l); 489 - for (; *t; t++) *t = tolower (*t); 489 + for (; *t; t++) *t = tolower ((unsigned char) *t); 490 490 break; 491 491 } 492 492 case DT_MAGIC: 493 493 { 494 494 /* heuristic! */ 495 495 strncpy (t, s + 2, l); 496 - for (; *t; t++) *t = tolower (*t); 496 + for (; *t; t++) *t = tolower ((unsigned char) *t); 497 497 break; 498 498 } 499 499 case DT_STR: ··· 1188 1188 else 1189 1189 { 1190 1190 ref = s; 1191 - while (isalnum (*s) || *s == '-' || *s == '_') 1191 + while (isalnum ((unsigned char) *s) || *s == '-' || *s == '_') 1192 1192 ++s; 1193 1193 1194 1194 docstat = commit_buff (buff, &d, out, docstat);
+1 -1
muttlib.c
··· 521 521 memmove (&dest[idx + pwnl], &dest[idx + 1], 522 522 MAX(destlen - idx - pwnl - 1, 0)); 523 523 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]); 525 525 } 526 526 } 527 527
+4 -4
pattern.c
··· 278 278 } 279 279 else 280 280 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? */ 282 282 { 283 283 pat->min *= 1024; 284 284 tmp++; 285 285 } 286 - else if (toupper (*tmp) == 'M') 286 + else if (toupper ((unsigned char) *tmp) == 'M') 287 287 { 288 288 pat->min *= 1048576; 289 289 tmp++; ··· 312 312 { 313 313 /* range maximum */ 314 314 pat->max = strtol (tmp, &tmp, 0); 315 - if (toupper (*tmp) == 'K') 315 + if (toupper ((unsigned char) *tmp) == 'K') 316 316 { 317 317 pat->max *= 1024; 318 318 tmp++; 319 319 } 320 - else if (toupper (*tmp) == 'M') 320 + else if (toupper ((unsigned char) *tmp) == 'M') 321 321 { 322 322 pat->max *= 1048576; 323 323 tmp++;
+2 -2
rfc2047.c
··· 606 606 charset[t-pp] = '\0'; 607 607 break; 608 608 case 3: 609 - if (toupper (*pp) == 'Q') 609 + if (toupper ((unsigned char) *pp) == 'Q') 610 610 enc = ENCQUOTEDPRINTABLE; 611 - else if (toupper (*pp) == 'B') 611 + else if (toupper ((unsigned char) *pp) == 'B') 612 612 enc = ENCBASE64; 613 613 else 614 614 {
+4 -2
rfc2231.c
··· 135 135 else 136 136 { 137 137 *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++) 139 139 ; 140 140 encoded = (*t == '*'); 141 141 *t = '\0'; ··· 208 208 209 209 for (d = dest; *src; src++) 210 210 { 211 - if (*src == '%' && isxdigit (*(src + 1)) && isxdigit (*(src + 2))) 211 + if (*src == '%' && 212 + isxdigit ((unsigned char) *(src + 1)) && 213 + isxdigit ((unsigned char) *(src + 2))) 212 214 { 213 215 *d++ = (hexval (*(src + 1)) << 4) | (hexval (*(src + 2))); 214 216 src += 2;
+3 -3
rfc822.c
··· 174 174 } 175 175 while (*s) 176 176 { 177 - if (ISSPACE (*s) || is_special (*s)) 177 + if (ISSPACE ((unsigned char) *s) || is_special (*s)) 178 178 break; 179 179 if (*tokenlen < tokenmax) 180 180 token[(*tokenlen)++] = *s; ··· 345 345 while (last && last->next) 346 346 last = last->next; 347 347 348 - ws_pending = isspace (*s); 348 + ws_pending = isspace ((unsigned char) *s); 349 349 350 350 SKIPWS (s); 351 351 begin = s; ··· 479 479 } 480 480 s = ps; 481 481 } 482 - ws_pending = isspace (*s); 482 + ws_pending = isspace ((unsigned char) *s); 483 483 SKIPWS (s); 484 484 } 485 485
+4 -4
strcasecmp.c
··· 9 9 10 10 while (*s1 && *s2 && l < n) 11 11 { 12 - c1 = tolower (*s1); 13 - c2 = tolower (*s2); 12 + c1 = tolower ((unsigned char) *s1); 13 + c2 = tolower ((unsigned char) *s2); 14 14 if (c1 != c2) 15 15 return (c1 - c2); 16 16 s1++; ··· 29 29 30 30 while (*s1 && *s2) 31 31 { 32 - c1 = tolower (*s1); 33 - c2 = tolower (*s2); 32 + c1 = tolower ((unsigned char) *s1); 33 + c2 = tolower ((unsigned char) *s2); 34 34 if (c1 != c2) 35 35 return (c1 - c2); 36 36 s1++;
+2 -1
url.c
··· 50 50 for (d = s; *s; s++) 51 51 { 52 52 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]) && 54 55 hexval (s[1]) >= 0 && hexval (s[2]) >= 0) 55 56 { 56 57 *d++ = (hexval (s[1]) << 4) | (hexval (s[2]));