]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Don't use ctype.h in the library, it is locale dependent.
authorJoerg Sonnenberger <joerg.sonnenberger@gmail.com>
Sun, 1 Feb 2009 17:07:13 +0000 (12:07 -0500)
committerJoerg Sonnenberger <joerg.sonnenberger@gmail.com>
Sun, 1 Feb 2009 17:07:13 +0000 (12:07 -0500)
SVN-Revision: 530

libarchive/archive_util.c
libarchive/archive_write_set_compression_gzip.c
libarchive/archive_write_set_compression_xz.c

index 6b14cf3fb449c4c18c20138d287d7cb399cce266..22b5699a4b08589d2876d6114e33e6235fa5ccdd 100644 (file)
@@ -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 <sys/types.h>
 #endif
-#ifdef HAVE_CTYPE_H
-#include <ctype.h>
-#endif
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #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 {
index 63fd8fb411e3006af520565c4d24028ac72334bd..b6991ba5c391e41074ca8db2323d72fd97190042 100644 (file)
@@ -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 <ctype.h>
-#endif
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
 #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)
index 5abe35202cde97049b531b2ade74a3d7a6e18ee7..4262957b25691b4f7e26b38c8ae5c0d7bc4dc7fa 100644 (file)
@@ -28,9 +28,6 @@
 
 __FBSDID("$FreeBSD$");
 
-#ifdef HAVE_CTYPE_H
-#include <ctype.h>
-#endif
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
 #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)