From e6baedddcf54e7da049ebc49183565b99facd4c7 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Sun, 12 Dec 2010 14:50:04 +0200 Subject: DOS-like: Treat \ and : as directory separators in addition to /. Juan Manuel Guerrero had fixed this in his XZ Utils port to DOS/DJGPP. The bug affects also Windows and OS/2. --- src/xz/suffix.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/src/xz/suffix.c b/src/xz/suffix.c index f2a2da27..ea86c1a3 100644 --- a/src/xz/suffix.c +++ b/src/xz/suffix.c @@ -27,6 +27,30 @@ struct suffix_pair { }; +/// \brief Test if the char is a directory separator +static bool +is_dir_sep(char c) +{ +#ifdef TUKLIB_DOSLIKE + return c == '/' || c == '\\' || c == ':'; +#else + return c == '/'; +#endif +} + + +/// \brief Test if the string contains a directory separator +static bool +has_dir_sep(const char *str) +{ +#ifdef TUKLIB_DOSLIKE + return strpbrk(str, "/\\:") != NULL; +#else + return strchr(str, '/') != NULL; +#endif +} + + /// \brief Checks if src_name has given compressed_suffix /// /// \param suffix Filename suffix to look for @@ -44,7 +68,8 @@ test_suffix(const char *suffix, const char *src_name, size_t src_len) // The filename must have at least one character in addition to // the suffix. src_name may contain path to the filename, so we // need to check for directory separator too. - if (src_len <= suffix_len || src_name[src_len - suffix_len - 1] == '/') + if (src_len <= suffix_len + || is_dir_sep(src_name[src_len - suffix_len - 1])) return 0; if (strcmp(suffix, src_name + src_len - suffix_len) == 0) @@ -199,9 +224,9 @@ suffix_get_dest_name(const char *src_name) extern void suffix_set(const char *suffix) { - // Empty suffix and suffixes having a slash are rejected. Such - // suffixes would break things later. - if (suffix[0] == '\0' || strchr(suffix, '/') != NULL) + // Empty suffix and suffixes having a directory separator are + // rejected. Such suffixes would break things later. + if (suffix[0] == '\0' || has_dir_sep(suffix)) message_fatal(_("%s: Invalid filename suffix"), optarg); // Replace the old custom_suffix (if any) with the new suffix. -- cgit v1.2.3 From ce56f63c41ee210e6308090eb6d49221fdf67d6c Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Sun, 12 Dec 2010 16:07:11 +0200 Subject: Add missing PRIx32 and PRIx64 compatibility definitions. This fixes portability to systems that lack C99 inttypes.h. Thanks to Juan Manuel Guerrero. --- src/common/sysdefs.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/common/sysdefs.h b/src/common/sysdefs.h index c74c6212..51f06cf0 100644 --- a/src/common/sysdefs.h +++ b/src/common/sysdefs.h @@ -65,6 +65,9 @@ #ifndef PRIu32 # define PRIu32 "u" #endif +#ifndef PRIx32 +# define PRIx32 "x" +#endif #ifndef PRIX32 # define PRIX32 "X" #endif @@ -76,6 +79,9 @@ # ifndef PRIu64 # define PRIu64 "llu" # endif +# ifndef PRIx64 +# define PRIx64 "llx" +# endif # ifndef PRIX64 # define PRIX64 "llX" # endif @@ -86,6 +92,9 @@ # ifndef PRIu64 # define PRIu64 "lu" # endif +# ifndef PRIx64 +# define PRIx64 "lx" +# endif # ifndef PRIX64 # define PRIX64 "lX" # endif -- cgit v1.2.3 From 4a42aaee282fc73b482581684d65110506d5efdd Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Sun, 12 Dec 2010 16:09:42 +0200 Subject: Updated THANKS. --- THANKS | 1 + 1 file changed, 1 insertion(+) diff --git a/THANKS b/THANKS index 635a29ac..65c267f8 100644 --- a/THANKS +++ b/THANKS @@ -22,6 +22,7 @@ has been important. :-) In alphabetical order: - Gilles Espinasse - Denis Excoffier - Mike Frysinger + - Juan Manuel Guerrero - Joachim Henke - Peter Ivanov - Jouk Jansen -- cgit v1.2.3 From 9311774c493c19deab51ded919dcd2e9c4aa2829 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Sun, 12 Dec 2010 21:23:55 +0200 Subject: Build: Enable ASM on DJGPP by default. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index e0418216..35720fef 100644 --- a/configure.ac +++ b/configure.ac @@ -283,7 +283,7 @@ if test "x$enable_assembler" = xyes; then case $host_os in # Darwin should work too but only if not creating universal # binaries. Solaris x86 could work too but I cannot test. - linux* | *bsd* | mingw* | cygwin*) + linux* | *bsd* | mingw* | cygwin* | *djgpp*) case $host_cpu in i?86) enable_assembler=x86 ;; x86_64) enable_assembler=x86_64 ;; -- cgit v1.2.3