From: Michihiro NAKAJIMA Date: Wed, 7 Jan 2009 23:42:22 +0000 (-0500) Subject: On Windows, now archive_read_disk_set_standard_lookup.c is linked. X-Git-Tag: v2.7.0~448 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa545d9284f2853359068a19e822945e808eaec7;p=thirdparty%2Flibarchive.git On Windows, now archive_read_disk_set_standard_lookup.c is linked. We call archive_read_disk_set_standard_lookup() function on libarchive_test again, and check a value which that function returns to what the feature is available. This aims that programs which use libarchive shouldn't have to to know what features are available on a particular platform. Suggested by Tim SVN-Revision: 402 --- diff --git a/libarchive/archive_read_disk_set_standard_lookup.c b/libarchive/archive_read_disk_set_standard_lookup.c index 8af42b0e3..3c6723add 100644 --- a/libarchive/archive_read_disk_set_standard_lookup.c +++ b/libarchive/archive_read_disk_set_standard_lookup.c @@ -47,6 +47,14 @@ __FBSDID("$FreeBSD$"); #include "archive.h" +#ifdef _WIN32 +int +archive_read_disk_set_standard_lookup(struct archive *a) +{ + archive_set_error(a, -1, "Standard lookups not available on Windows"); + return (ARCHIVE_FATAL); +} +#else #define name_cache_size 127 static const char * const NO_NAME = "(noname)"; @@ -218,3 +226,4 @@ lookup_gname_helper(struct archive *a, id_t id) return strdup(grent.gr_name); } +#endif /* _WIN32 */ \ No newline at end of file diff --git a/libarchive/test/test_read_disk.c b/libarchive/test/test_read_disk.c index 95ba4532a..1332408de 100644 --- a/libarchive/test/test_read_disk.c +++ b/libarchive/test/test_read_disk.c @@ -94,13 +94,13 @@ DEFINE_TEST(test_read_disk) archive_read_disk_set_uname_lookup(a, NULL, NULL, NULL)); assertEqualInt(umagic, 0x2345); -#ifndef _WIN32 /* Try the standard lookup functions. */ - assertEqualInt(ARCHIVE_OK, - archive_read_disk_set_standard_lookup(a)); -#endif - assertEqualString(archive_read_disk_uname(a, 0), "root"); - assertEqualString(archive_read_disk_gname(a, 0), "wheel"); + if (archive_read_disk_set_standard_lookup(a) != ARCHIVE_OK) { + skipping("standard uname/gname lookup"); + } else { + assertEqualString(archive_read_disk_uname(a, 0), "root"); + assertEqualString(archive_read_disk_gname(a, 0), "wheel"); + } /* Deregister again and verify the default lookups again. */ assertEqualInt(ARCHIVE_OK, diff --git a/windows/vc71/libarchive.vcproj b/windows/vc71/libarchive.vcproj index f79edd0d8..6edeccb96 100644 --- a/windows/vc71/libarchive.vcproj +++ b/windows/vc71/libarchive.vcproj @@ -124,6 +124,9 @@ + + diff --git a/windows/vc80/libarchive.vcproj b/windows/vc80/libarchive.vcproj index c344ffcae..12f4d4e04 100644 --- a/windows/vc80/libarchive.vcproj +++ b/windows/vc80/libarchive.vcproj @@ -188,6 +188,10 @@ RelativePath="..\..\libarchive\archive_read_disk.c" > + + diff --git a/windows/vc90/libarchive.vcproj b/windows/vc90/libarchive.vcproj index dc372f659..6a5499eb0 100644 --- a/windows/vc90/libarchive.vcproj +++ b/windows/vc90/libarchive.vcproj @@ -189,6 +189,10 @@ RelativePath="..\..\libarchive\archive_read_disk.c" > + +