1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00

Cast the input to isalpha et al to integer

* libguile/gc_os_dep.c (GC_linux_stack_base) [LINUX_STACKBOTTOM]: cast
  input of ctype functions to int

* libguile/inet_aton.c (inet_aton): cast input of ctype functions to int

* libguile/read.c (scm_scan_for_encoding): cast input of isalnum to int

* libguile/win32-socket.c (scm_i_socket_uncomment): cast input of isspace
  to int
This commit is contained in:
Michael Gran 2009-08-28 21:19:05 -07:00
parent 5950cc3fcc
commit 6d736fdba2
4 changed files with 14 additions and 10 deletions

View file

@ -1867,11 +1867,14 @@ void *scm_get_stack_base()
/* Skip the required number of fields. This number is hopefully */ /* Skip the required number of fields. This number is hopefully */
/* constant across all Linux implementations. */ /* constant across all Linux implementations. */
for (i = 0; i < STAT_SKIP; ++i) { for (i = 0; i < STAT_SKIP; ++i) {
while (isspace(c)) c = stat_buf[buf_offset++]; while (isspace ((int) c))
while (!isspace(c)) c = stat_buf[buf_offset++]; c = stat_buf[buf_offset++];
while (!isspace ((int) c))
c = stat_buf[buf_offset++];
} }
while (isspace(c)) c = stat_buf[buf_offset++]; while (isspace ((int) c))
while (isdigit(c)) { c = stat_buf[buf_offset++];
while (isdigit ((int) c)) {
result *= 10; result *= 10;
result += c - '0'; result += c - '0';
c = stat_buf[buf_offset++]; c = stat_buf[buf_offset++];

View file

@ -103,14 +103,14 @@ inet_aton(const char *cp_arg, struct in_addr *addr)
base = 8; base = 8;
} }
while ((c = *cp) != '\0') { while ((c = *cp) != '\0') {
if (isascii(c) && isdigit(c)) { if (isascii ((int) c) && isdigit ((int) c)) {
val = (val * base) + (c - '0'); val = (val * base) + (c - '0');
cp++; cp++;
continue; continue;
} }
if (base == 16 && isascii(c) && isxdigit(c)) { if (base == 16 && isascii ((int) c) && isxdigit ((int) c)) {
val = (val << 4) + val = (val << 4) +
(c + 10 - (islower(c) ? 'a' : 'A')); (c + 10 - (islower((int) c) ? 'a' : 'A'));
cp++; cp++;
continue; continue;
} }
@ -132,7 +132,7 @@ inet_aton(const char *cp_arg, struct in_addr *addr)
/* /*
* Check for trailing characters. * Check for trailing characters.
*/ */
if (*cp && (!isascii(*cp) || !isspace(*cp))) if (*cp && (!isascii ((int) (*cp)) || !isspace ((int) (*cp))))
return (0); return (0);
/* /*
* Concoct the address according to * Concoct the address according to

View file

@ -1437,7 +1437,8 @@ scm_scan_for_encoding (SCM port)
/* grab the next token */ /* grab the next token */
i = 0; i = 0;
while (pos + i - header <= SCM_ENCODING_SEARCH_SIZE while (pos + i - header <= SCM_ENCODING_SEARCH_SIZE
&& (isalnum(pos[i]) || pos[i] == '_' || pos[i] == '-' || pos[i] == '.')) && (isalnum((int) pos[i]) || pos[i] == '_' || pos[i] == '-'
|| pos[i] == '.'))
i++; i++;
if (i == 0) if (i == 0)

View file

@ -435,7 +435,7 @@ scm_i_socket_uncomment (char *line)
while (end > line && (*end == '\r' || *end == '\n')) while (end > line && (*end == '\r' || *end == '\n'))
*end-- = '\0'; *end-- = '\0';
} }
while (end > line && isspace (*end)) while (end > line && isspace ((int) (*end)))
*end-- = '\0'; *end-- = '\0';
return end; return end;