From: Joerg Sonnenberger Date: Sun, 1 Feb 2009 17:07:13 +0000 (-0500) Subject: Don't use ctype.h in the library, it is locale dependent. X-Git-Tag: v2.7.0~363 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1806da2646b073210b2dae99f0c654c879eb25f;p=thirdparty%2Flibarchive.git Don't use ctype.h in the library, it is locale dependent. SVN-Revision: 530 --- diff --git a/libarchive/archive_util.c b/libarchive/archive_util.c index 6b14cf3fb..22b5699a4 100644 --- a/libarchive/archive_util.c +++ b/libarchive/archive_util.c @@ -30,9 +30,6 @@ __FBSDID("$FreeBSD: src/lib/libarchive/archive_util.c,v 1.19 2008/10/21 12:10:30 #ifdef HAVE_SYS_TYPES_H #include #endif -#ifdef HAVE_CTYPE_H -#include -#endif #ifdef HAVE_STDLIB_H #include #endif @@ -250,8 +247,9 @@ __archive_parse_options(const char *p, const char *fn, int keysize, char *key, break; case F_BOTH: case F_NAME: - if (islower(*p) || isdigit(*p) || *p == '-') { - if (kidx == 0 && !islower(*p)) + if ((*p >= 'a' && *p <= 'z') || + (*p >= '0' && *p <= '9') || *p == '-') { + if (kidx == 0 && !(*p >= 'a' && *p <= 'z')) /* Illegal sequence. */ return (-1); if (kidx >= keysize -1) @@ -308,7 +306,7 @@ __archive_parse_options(const char *p, const char *fn, int keysize, char *key, return (-1); ++p; state = G_VALUE; - } else if (isspace(*p)) { + } else if (*p == ' ') { /* Pass the space character */ ++p; } else { @@ -330,7 +328,7 @@ __archive_parse_options(const char *p, const char *fn, int keysize, char *key, * format which the fn variable * indicate. */ state = INIT; - } else if (isspace(*p)) { + } else if (*p == ' ') { /* Pass the space character */ ++p; } else { diff --git a/libarchive/archive_write_set_compression_gzip.c b/libarchive/archive_write_set_compression_gzip.c index 63fd8fb41..b6991ba5c 100644 --- a/libarchive/archive_write_set_compression_gzip.c +++ b/libarchive/archive_write_set_compression_gzip.c @@ -27,9 +27,6 @@ __FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_compression_gzip.c,v 1.16 2008/02/21 03:21:50 kientzle Exp $"); -#ifdef HAVE_CTYPE_H -#include -#endif #ifdef HAVE_ERRNO_H #include #endif @@ -235,7 +232,8 @@ archive_compressor_gzip_options(struct archive_write *a, const char *key, if (strcmp(key, "compression-level") == 0) { int level; - if (value == NULL || !isdigit(value[0]) || value[1] != '\0') + if (value == NULL || !(value[0] >= '0' && value[0] <= '9') || + value[1] != '\0') return (ARCHIVE_WARN); level = value[0] - '0'; if (level == state->compression_level) diff --git a/libarchive/archive_write_set_compression_xz.c b/libarchive/archive_write_set_compression_xz.c index 5abe35202..4262957b2 100644 --- a/libarchive/archive_write_set_compression_xz.c +++ b/libarchive/archive_write_set_compression_xz.c @@ -28,9 +28,6 @@ __FBSDID("$FreeBSD$"); -#ifdef HAVE_CTYPE_H -#include -#endif #ifdef HAVE_ERRNO_H #include #endif @@ -235,7 +232,8 @@ archive_compressor_xz_options(struct archive_write *a, const char *key, */ int level; - if (value == NULL || !isdigit(value[0]) || value[1] != '\0') + if (value == NULL || !(value[0] >= '0' && value[0] <= '9') || + value[1] != '\0') return (ARCHIVE_WARN); level = value[0] - '0'; if (level == state->compression_level)