archive_entry.c (315432) | archive_entry.c (316337) |
---|---|
1/*- 2 * Copyright (c) 2003-2007 Tim Kientzle 3 * Copyright (c) 2016 Martin Matuska 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include "archive_platform.h" | 1/*- 2 * Copyright (c) 2003-2007 Tim Kientzle 3 * Copyright (c) 2016 Martin Matuska 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include "archive_platform.h" |
28__FBSDID("$FreeBSD: stable/11/contrib/libarchive/libarchive/archive_entry.c 315432 2017-03-16 23:07:35Z mm $"); | 28__FBSDID("$FreeBSD: stable/11/contrib/libarchive/libarchive/archive_entry.c 316337 2017-03-31 20:16:24Z mm $"); |
29 30#ifdef HAVE_SYS_STAT_H 31#include <sys/stat.h> 32#endif 33#ifdef HAVE_SYS_TYPES_H 34#include <sys/types.h> 35#endif 36#if MAJOR_IN_MKDEV --- 1596 unchanged lines hidden (view full) --- 1633 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 1634 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 1635 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 1636 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 1637 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1638 * SUCH DAMAGE. 1639 */ 1640 | 29 30#ifdef HAVE_SYS_STAT_H 31#include <sys/stat.h> 32#endif 33#ifdef HAVE_SYS_TYPES_H 34#include <sys/types.h> 35#endif 36#if MAJOR_IN_MKDEV --- 1596 unchanged lines hidden (view full) --- 1633 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 1634 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 1635 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 1636 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 1637 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1638 * SUCH DAMAGE. 1639 */ 1640 |
1641static struct flag { | 1641static const struct flag { |
1642 const char *name; 1643 const wchar_t *wname; 1644 unsigned long set; 1645 unsigned long clear; 1646} flags[] = { 1647 /* Preferred (shorter) names per flag first, all prefixed by "no" */ 1648#ifdef SF_APPEND 1649 { "nosappnd", L"nosappnd", SF_APPEND, 0 }, --- 53 unchanged lines hidden (view full) --- 1703#endif 1704#ifdef UF_NOUNLINK 1705 { "nouunlnk", L"nouunlnk", UF_NOUNLINK, 0 }, 1706 { "nouunlink", L"nouunlink", UF_NOUNLINK, 0 }, 1707#endif 1708#ifdef UF_COMPRESSED 1709 { "nocompressed",L"nocompressed", UF_COMPRESSED, 0 }, 1710#endif | 1642 const char *name; 1643 const wchar_t *wname; 1644 unsigned long set; 1645 unsigned long clear; 1646} flags[] = { 1647 /* Preferred (shorter) names per flag first, all prefixed by "no" */ 1648#ifdef SF_APPEND 1649 { "nosappnd", L"nosappnd", SF_APPEND, 0 }, --- 53 unchanged lines hidden (view full) --- 1703#endif 1704#ifdef UF_NOUNLINK 1705 { "nouunlnk", L"nouunlnk", UF_NOUNLINK, 0 }, 1706 { "nouunlink", L"nouunlink", UF_NOUNLINK, 0 }, 1707#endif 1708#ifdef UF_COMPRESSED 1709 { "nocompressed",L"nocompressed", UF_COMPRESSED, 0 }, 1710#endif |
1711#ifdef UF_HIDDEN 1712 { "nohidden", L"nohidden", UF_HIDDEN, 0 }, 1713#endif |
|
1711#if defined(FS_UNRM_FL) 1712 { "nouunlink", L"nouunlink", FS_UNRM_FL, 0}, 1713#elif defined(EXT2_UNRM_FL) 1714 { "nouunlink", L"nouunlink", EXT2_UNRM_FL, 0}, 1715#endif 1716 1717#if defined(FS_BTREE_FL) 1718 { "nobtree", L"nobtree", FS_BTREE_FL, 0 }, --- 116 unchanged lines hidden (view full) --- 1835 * are set, return the empty string. 1836 */ 1837static char * 1838ae_fflagstostr(unsigned long bitset, unsigned long bitclear) 1839{ 1840 char *string, *dp; 1841 const char *sp; 1842 unsigned long bits; | 1714#if defined(FS_UNRM_FL) 1715 { "nouunlink", L"nouunlink", FS_UNRM_FL, 0}, 1716#elif defined(EXT2_UNRM_FL) 1717 { "nouunlink", L"nouunlink", EXT2_UNRM_FL, 0}, 1718#endif 1719 1720#if defined(FS_BTREE_FL) 1721 { "nobtree", L"nobtree", FS_BTREE_FL, 0 }, --- 116 unchanged lines hidden (view full) --- 1838 * are set, return the empty string. 1839 */ 1840static char * 1841ae_fflagstostr(unsigned long bitset, unsigned long bitclear) 1842{ 1843 char *string, *dp; 1844 const char *sp; 1845 unsigned long bits; |
1843 struct flag *flag; | 1846 const struct flag *flag; |
1844 size_t length; 1845 1846 bits = bitset | bitclear; 1847 length = 0; 1848 for (flag = flags; flag->name != NULL; flag++) 1849 if (bits & (flag->set | flag->clear)) { 1850 length += strlen(flag->name) + 1; 1851 bits &= ~(flag->set | flag->clear); --- 35 unchanged lines hidden (view full) --- 1887 * unrecognized token, or NULL if every token was recognized. 1888 * This version is also const-correct and does not modify the 1889 * provided string. 1890 */ 1891static const char * 1892ae_strtofflags(const char *s, unsigned long *setp, unsigned long *clrp) 1893{ 1894 const char *start, *end; | 1847 size_t length; 1848 1849 bits = bitset | bitclear; 1850 length = 0; 1851 for (flag = flags; flag->name != NULL; flag++) 1852 if (bits & (flag->set | flag->clear)) { 1853 length += strlen(flag->name) + 1; 1854 bits &= ~(flag->set | flag->clear); --- 35 unchanged lines hidden (view full) --- 1890 * unrecognized token, or NULL if every token was recognized. 1891 * This version is also const-correct and does not modify the 1892 * provided string. 1893 */ 1894static const char * 1895ae_strtofflags(const char *s, unsigned long *setp, unsigned long *clrp) 1896{ 1897 const char *start, *end; |
1895 struct flag *flag; | 1898 const struct flag *flag; |
1896 unsigned long set, clear; 1897 const char *failed; 1898 1899 set = clear = 0; 1900 start = s; 1901 failed = NULL; 1902 /* Find start of first token. */ 1903 while (*start == '\t' || *start == ' ' || *start == ',') --- 51 unchanged lines hidden (view full) --- 1955 * unrecognized token, or NULL if every token was recognized. 1956 * This version is also const-correct and does not modify the 1957 * provided string. 1958 */ 1959static const wchar_t * 1960ae_wcstofflags(const wchar_t *s, unsigned long *setp, unsigned long *clrp) 1961{ 1962 const wchar_t *start, *end; | 1899 unsigned long set, clear; 1900 const char *failed; 1901 1902 set = clear = 0; 1903 start = s; 1904 failed = NULL; 1905 /* Find start of first token. */ 1906 while (*start == '\t' || *start == ' ' || *start == ',') --- 51 unchanged lines hidden (view full) --- 1958 * unrecognized token, or NULL if every token was recognized. 1959 * This version is also const-correct and does not modify the 1960 * provided string. 1961 */ 1962static const wchar_t * 1963ae_wcstofflags(const wchar_t *s, unsigned long *setp, unsigned long *clrp) 1964{ 1965 const wchar_t *start, *end; |
1963 struct flag *flag; | 1966 const struct flag *flag; |
1964 unsigned long set, clear; 1965 const wchar_t *failed; 1966 1967 set = clear = 0; 1968 start = s; 1969 failed = NULL; 1970 /* Find start of first token. */ 1971 while (*start == L'\t' || *start == L' ' || *start == L',') --- 64 unchanged lines hidden --- | 1967 unsigned long set, clear; 1968 const wchar_t *failed; 1969 1970 set = clear = 0; 1971 start = s; 1972 failed = NULL; 1973 /* Find start of first token. */ 1974 while (*start == L'\t' || *start == L' ' || *start == L',') --- 64 unchanged lines hidden --- |