summaryrefslogtreecommitdiffstats
path: root/lib/libarchive/archive_string.h
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2008-05-26 17:00:24 +0000
committerkientzle <kientzle@FreeBSD.org>2008-05-26 17:00:24 +0000
commita24d28f8e3d3892010c91baad77e2178c6a16ba2 (patch)
treed200bbdabe22d32b68a61172999be232d0c31d75 /lib/libarchive/archive_string.h
parent268a4c430f25bc479b5e1e097f51394aa0f1fffb (diff)
downloadFreeBSD-src-a24d28f8e3d3892010c91baad77e2178c6a16ba2.zip
FreeBSD-src-a24d28f8e3d3892010c91baad77e2178c6a16ba2.tar.gz
MFp4: libarchive 2.5.4b. (Still 'b' until I get a bit more
feedback, but the 2.5 branch is shaping up nicely.) In addition to many small bug fixes and code improvements: * Another iteration of versioning; I think I've got it right now. * Portability: A lot of progress on Windows support (though I'm not committing all of the Windows support files to FreeBSD CVS) * Explicit tracking of MBS, WCS, and UTF-8 versions of strings in archive_entry; the archive_entry routines now correctly return NULL only when something is unset, setting NULL properly clears string values. Most charset conversions have been pushed down to archive_string. * Better handling of charset conversion failure when writing or reading UTF-8 headers in pax archives * archive_entry_linkify() provides multiple strategies for hardlink matching to suit different format expectations * More accurate bzip2 format detection * Joerg Sonnenberger's extensive improvements to mtree support * Rough support for self-extracting ZIP archives. Not an ideal approach, but it works for the archives I've tried. * New "sparsify" option in archive_write_disk converts blocks of nulls into seeks. * Better default behavior for the test harness; it now reports all failures by default instead of coredumping at the first one.
Diffstat (limited to 'lib/libarchive/archive_string.h')
-rw-r--r--lib/libarchive/archive_string.h26
1 files changed, 20 insertions, 6 deletions
diff --git a/lib/libarchive/archive_string.h b/lib/libarchive/archive_string.h
index 271eae3..84f3669 100644
--- a/lib/libarchive/archive_string.h
+++ b/lib/libarchive/archive_string.h
@@ -33,6 +33,9 @@
#ifdef HAVE_STRING_H
#include <string.h>
#endif
+#ifdef HAVE_WCHAR_H
+#include <wchar.h>
+#endif
/*
* Basic resizable/reusable string support a la Java's "StringBuffer."
@@ -60,16 +63,22 @@ struct archive_string *
__archive_strappend_char(struct archive_string *, char);
#define archive_strappend_char __archive_strappend_char
-/* Append a char to an archive_string using UTF8. */
-struct archive_string *
-__archive_strappend_char_UTF8(struct archive_string *, int);
-#define archive_strappend_char_UTF8 __archive_strappend_char_UTF8
-
/* Append an integer in the specified base (2 <= base <= 16). */
struct archive_string *
__archive_strappend_int(struct archive_string *as, int d, int base);
#define archive_strappend_int __archive_strappend_int
+/* Convert a wide-char string to UTF-8 and append the result. */
+struct archive_string *
+__archive_strappend_w_utf8(struct archive_string *, const wchar_t *);
+#define archive_strappend_w_utf8 __archive_strappend_w_utf8
+
+/* Convert a wide-char string to current locale and append the result. */
+/* Returns NULL if conversion fails. */
+struct archive_string *
+__archive_strappend_w_mbs(struct archive_string *, const wchar_t *);
+#define archive_strappend_w_mbs __archive_strappend_w_mbs
+
/* Basic append operation. */
struct archive_string *
__archive_string_append(struct archive_string *as, const char *p, size_t s);
@@ -95,7 +104,7 @@ __archive_strncat(struct archive_string *, const char *, size_t);
/* Copy a C string to an archive_string, resizing as necessary. */
#define archive_strcpy(as,p) \
- ((as)->length = 0, __archive_string_append((as), (p), strlen(p)))
+ ((as)->length = 0, __archive_string_append((as), (p), p == NULL ? 0 : strlen(p)))
/* Copy a C string to an archive_string with limit, resizing as necessary. */
#define archive_strncpy(as,p,l) \
@@ -119,4 +128,9 @@ void __archive_string_vsprintf(struct archive_string *, const char *,
void __archive_string_sprintf(struct archive_string *, const char *, ...);
#define archive_string_sprintf __archive_string_sprintf
+/* Allocates a fresh buffer and converts as (assumed to be UTF-8) into it.
+ * Returns NULL if conversion failed in any way. */
+wchar_t *__archive_string_utf8_w(struct archive_string *as);
+
+
#endif
OpenPOWER on IntegriCloud