From: Stefan Berger Date: Fri, 6 May 2016 19:20:30 +0000 (-0400) Subject: Introduce archive_array_append to append a raw array to an archive_string X-Git-Tag: v3.3.0~64^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a1a72f8807b980c632338470d77edde86f446f6;p=thirdparty%2Flibarchive.git Introduce archive_array_append to append a raw array to an archive_string Introduce archive_array_append to append a raw array to an archive_string. We need this for binary values in the PAX header. We can append arbitray data to the archive_string since its string append operations simply append at the end pointer rather than walking the string and appending at the zero byte. --- diff --git a/libarchive/archive_string.c b/libarchive/archive_string.c index bbb1e4585..e56f583bd 100644 --- a/libarchive/archive_string.c +++ b/libarchive/archive_string.c @@ -219,6 +219,12 @@ archive_wstring_append(struct archive_wstring *as, const wchar_t *p, size_t s) return (as); } +struct archive_string * +archive_array_append(struct archive_string *as, const char *p, size_t s) +{ + return archive_string_append(as, p, s); +} + void archive_string_concat(struct archive_string *dest, struct archive_string *src) { diff --git a/libarchive/archive_string.h b/libarchive/archive_string.h index bac22e6d2..56dfbb28f 100644 --- a/libarchive/archive_string.h +++ b/libarchive/archive_string.h @@ -81,6 +81,10 @@ archive_strappend_char(struct archive_string *, char); struct archive_wstring * archive_wstrappend_wchar(struct archive_wstring *, wchar_t); +/* Append a raw array to an archive_string, resizing as necessary */ +struct archive_string * +archive_array_append(struct archive_string *, const char *, size_t); + /* Convert a Unicode string to current locale and append the result. */ /* Returns -1 if conversion fails. */ int