diff options
author | kientzle <kientzle@FreeBSD.org> | 2004-08-14 03:45:45 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2004-08-14 03:45:45 +0000 |
commit | 49a8ad2487b2329a538450200f1b1b2d698d6a23 (patch) | |
tree | c8c3ea449972625054a074cdd1e21e770642ffbb /lib/libarchive/archive_read_support_format_tar.c | |
parent | 136013f29f7390ade8ad49fc70a7a0ef804d10b3 (diff) | |
download | FreeBSD-src-49a8ad2487b2329a538450200f1b1b2d698d6a23.zip FreeBSD-src-49a8ad2487b2329a538450200f1b1b2d698d6a23.tar.gz |
Eliminate reliance on non-portable <err.h> by implementing a very
simple errx() function.
Improve behavior when bzlib/zlib are missing by detecting and
issuing an error message on attempts to read gzip/bzip2 compressed
archives.
Diffstat (limited to 'lib/libarchive/archive_read_support_format_tar.c')
-rw-r--r-- | lib/libarchive/archive_read_support_format_tar.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/libarchive/archive_read_support_format_tar.c b/lib/libarchive/archive_read_support_format_tar.c index e91ddc4..ecc42ad 100644 --- a/lib/libarchive/archive_read_support_format_tar.c +++ b/lib/libarchive/archive_read_support_format_tar.c @@ -1602,10 +1602,17 @@ UTF8_mbrtowc(wchar_t *pwc, const char *s, size_t n) return ((size_t)-1); } if (pwc != NULL) { - if (wch < WCHAR_MAX) - *pwc = (wchar_t)wch; - else + /* Assign the value to the output; out-of-range values + * just get truncated. */ + *pwc = (wchar_t)wch; +#ifdef WCHAR_MAX + /* + * If platform has WCHAR_MAX, we can do something + * more sensible with out-of-range values. + */ + if (wch >= WCHAR_MAX) *pwc = '?'; +#endif } return (wch == L'\0' ? 0 : len); } |