]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Introduce archive_array_append to append a raw array to an archive_string
authorStefan Berger <stefanb@us.ibm.com>
Fri, 6 May 2016 19:20:30 +0000 (15:20 -0400)
committerStefan Berger <stefanb@linux.vnet.ibm.com>
Mon, 9 Jan 2017 01:31:14 +0000 (20:31 -0500)
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.

libarchive/archive_string.c
libarchive/archive_string.h

index bbb1e4585180da911b6e3e2fa3c8ca4086f5c65d..e56f583bd7e66ac0c8b8ee2c1d71594b6a5b3307 100644 (file)
@@ -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)
 {
index bac22e6d2945851b0ad9ecf730a18aee91b12337..56dfbb28f28721cb172df5ef3d8f8285a24ee30a 100644 (file)
@@ -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