summaryrefslogtreecommitdiff
path: root/archivers/libarchive/files/libarchive/archive_string.h
diff options
context:
space:
mode:
Diffstat (limited to 'archivers/libarchive/files/libarchive/archive_string.h')
-rw-r--r--archivers/libarchive/files/libarchive/archive_string.h26
1 files changed, 20 insertions, 6 deletions
diff --git a/archivers/libarchive/files/libarchive/archive_string.h b/archivers/libarchive/files/libarchive/archive_string.h
index f56c50fe42a..61e70777f19 100644
--- a/archivers/libarchive/files/libarchive/archive_string.h
+++ b/archivers/libarchive/files/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