summaryrefslogtreecommitdiffstats
path: root/lib/libarchive/archive.h
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2008-12-06 06:17:18 +0000
committerkientzle <kientzle@FreeBSD.org>2008-12-06 06:17:18 +0000
commit52442c2b5fab8a9238c8e461c75d5d37691df10e (patch)
treeb71c88d736f788c8d2785a7fd130cfb152c11b77 /lib/libarchive/archive.h
parentcc9ad7c8d58f40d6baaeb980e55105fe6b9624a9 (diff)
downloadFreeBSD-src-52442c2b5fab8a9238c8e461c75d5d37691df10e.zip
FreeBSD-src-52442c2b5fab8a9238c8e461c75d5d37691df10e.tar.gz
Style fixes:
* Wrap long declarations to fit 80 chars * #undef macros that shouldn't be exported * Organize the version-dependent conditionals a bit more consistently Speculative: * libarchive 3.0 will (eventually) use int64_t instead of off_t. This is an attempt to avoid some the headaches caused by Linux LFS. (I'll still have to do ugly things for the struct stat references in archive_entry.h, of course.)
Diffstat (limited to 'lib/libarchive/archive.h')
-rw-r--r--lib/libarchive/archive.h100
1 files changed, 71 insertions, 29 deletions
diff --git a/lib/libarchive/archive.h b/lib/libarchive/archive.h
index ff06f66..0194a5d 100644
--- a/lib/libarchive/archive.h
+++ b/lib/libarchive/archive.h
@@ -82,7 +82,6 @@
# define __LA_DECL
#endif
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -114,13 +113,13 @@ extern "C" {
* (ARCHIVE_API_VERSION * 1000000 + ARCHIVE_API_FEATURE * 1000)
* #endif
*/
-#define ARCHIVE_VERSION_NUMBER 2005005
+#define ARCHIVE_VERSION_NUMBER 2005903
__LA_DECL int archive_version_number(void);
/*
* Textual name/version of the library, useful for version displays.
*/
-#define ARCHIVE_VERSION_STRING "libarchive 2.5.5"
+#define ARCHIVE_VERSION_STRING "libarchive 2.5.903a"
__LA_DECL const char * archive_version_string(void);
#if ARCHIVE_VERSION_NUMBER < 3000000
@@ -185,20 +184,37 @@ struct archive_entry;
*/
/* Returns pointer and size of next block of data from archive. */
-typedef __LA_SSIZE_T archive_read_callback(struct archive *, void *_client_data,
- const void **_buffer);
+typedef __LA_SSIZE_T archive_read_callback(struct archive *,
+ void *_client_data, const void **_buffer);
+
/* Skips at most request bytes from archive and returns the skipped amount */
#if ARCHIVE_VERSION_NUMBER < 2000000
-typedef __LA_SSIZE_T archive_skip_callback(struct archive *, void *_client_data,
- size_t request);
+/* Libarchive 1.0 used ssize_t for the return, which is only 32 bits
+ * on most 32-bit platforms; not large enough. */
+typedef __LA_SSIZE_T archive_skip_callback(struct archive *,
+ void *_client_data, size_t request);
+#elif ARCHIVE_VERSION_NUMBER < 3000000
+/* Libarchive 2.0 used off_t here, but that is a bad idea on Linux and a
+ * few other platforms where off_t varies with build settings. */
+typedef off_t archive_skip_callback(struct archive *,
+ void *_client_data, off_t request);
#else
-typedef off_t archive_skip_callback(struct archive *, void *_client_data,
- off_t request);
+/* Libarchive 3.0 uses int64_t here, which is actually guaranteed to be
+ * 64 bits on every platform. */
+typedef __LA_INT64_T archive_skip_callback(struct archive *,
+ void *_client_data, __LA_INT64_T request);
#endif
+
/* Returns size actually written, zero on EOF, -1 on error. */
-typedef __LA_SSIZE_T archive_write_callback(struct archive *, void *_client_data,
- const void *_buffer, size_t _length);
+typedef __LA_SSIZE_T archive_write_callback(struct archive *,
+ void *_client_data,
+ const void *_buffer, size_t _length);
+
+#if ARCHIVE_VERSION_NUMBER < 3000000
+/* Open callback is actually never needed; remove it in libarchive 3.0. */
typedef int archive_open_callback(struct archive *, void *_client_data);
+#endif
+
typedef int archive_close_callback(struct archive *, void *_client_data);
/*
@@ -209,6 +225,7 @@ typedef int archive_close_callback(struct archive *, void *_client_data);
#define ARCHIVE_COMPRESSION_BZIP2 2
#define ARCHIVE_COMPRESSION_COMPRESS 3
#define ARCHIVE_COMPRESSION_PROGRAM 4
+#define ARCHIVE_COMPRESSION_LZMA 5
/*
* Codes returned by archive_format.
@@ -333,15 +350,23 @@ __LA_DECL int archive_read_next_header(struct archive *,
__LA_DECL __LA_INT64_T archive_read_header_position(struct archive *);
/* Read data from the body of an entry. Similar to read(2). */
-__LA_DECL __LA_SSIZE_T archive_read_data(struct archive *, void *, size_t);
+__LA_DECL __LA_SSIZE_T archive_read_data(struct archive *,
+ void *, size_t);
+
/*
* A zero-copy version of archive_read_data that also exposes the file offset
* of each returned block. Note that the client has no way to specify
* the desired size of the block. The API does guarantee that offsets will
* be strictly increasing and that returned blocks will not overlap.
*/
+#if ARCHIVE_VERSION_NUMBER < 3000000
+__LA_DECL int archive_read_data_block(struct archive *a,
+ const void **buff, size_t *size, off_t *offset);
+#else
__LA_DECL int archive_read_data_block(struct archive *a,
- const void **buff, size_t *size, off_t *offset);
+ const void **buff, size_t *size,
+ __LA_INT64_T *offset);
+#endif
/*-
* Some convenience functions that are built on archive_read_data:
@@ -350,8 +375,8 @@ __LA_DECL int archive_read_data_block(struct archive *a,
* 'into_fd': writes data to specified filedes
*/
__LA_DECL int archive_read_data_skip(struct archive *);
-__LA_DECL int archive_read_data_into_buffer(struct archive *, void *buffer,
- __LA_SSIZE_T len);
+__LA_DECL int archive_read_data_into_buffer(struct archive *,
+ void *buffer, __LA_SSIZE_T len);
__LA_DECL int archive_read_data_into_fd(struct archive *, int fd);
/*-
@@ -414,12 +439,11 @@ __LA_DECL void archive_read_extract_set_skip_file(struct archive *,
__LA_DECL int archive_read_close(struct archive *);
/* Release all resources and destroy the object. */
/* Note that archive_read_finish will call archive_read_close for you. */
-#if ARCHIVE_VERSION_NUMBER >= 2000000
-__LA_DECL int archive_read_finish(struct archive *);
-#else
-/* Temporarily allow library to compile with either 1.x or 2.0 API. */
+#if ARCHIVE_VERSION_NUMBER < 2000000
/* Erroneously declared to return void in libarchive 1.x */
__LA_DECL void archive_read_finish(struct archive *);
+#else
+__LA_DECL int archive_read_finish(struct archive *);
#endif
/*-
@@ -491,22 +515,36 @@ __LA_DECL int archive_write_open_memory(struct archive *,
*/
__LA_DECL int archive_write_header(struct archive *,
struct archive_entry *);
-#if ARCHIVE_VERSION_NUMBER >= 2000000
-__LA_DECL __LA_SSIZE_T archive_write_data(struct archive *, const void *, size_t);
-#else
-/* Temporarily allow library to compile with either 1.x or 2.0 API. */
+#if ARCHIVE_VERSION_NUMBER < 2000000
/* This was erroneously declared to return "int" in libarchive 1.x. */
-__LA_DECL int archive_write_data(struct archive *, const void *, size_t);
+__LA_DECL int archive_write_data(struct archive *,
+ const void *, size_t);
+#else
+/* Libarchive 2.0 and later return ssize_t here. */
+__LA_DECL __LA_SSIZE_T archive_write_data(struct archive *,
+ const void *, size_t);
+#endif
+
+#if ARCHIVE_VERSION_NUMBER < 3000000
+/* Libarchive 1.x and 2.x use off_t for the argument, but that's not
+ * stable on Linux. */
+__LA_DECL __LA_SSIZE_T archive_write_data_block(struct archive *,
+ const void *, size_t, off_t);
+#else
+/* Libarchive 3.0 uses explicit int64_t to ensure consistent 64-bit support. */
+__LA_DECL __LA_SSIZE_T archive_write_data_block(struct archive *,
+ const void *, size_t, __LA_INT64_T);
#endif
-__LA_DECL __LA_SSIZE_T archive_write_data_block(struct archive *, const void *, size_t, off_t);
__LA_DECL int archive_write_finish_entry(struct archive *);
__LA_DECL int archive_write_close(struct archive *);
-#if ARCHIVE_VERSION_NUMBER >= 2000000
-__LA_DECL int archive_write_finish(struct archive *);
-#else
-/* Temporarily allow library to compile with either 1.x or 2.0 API. */
+#if ARCHIVE_VERSION_NUMBER < 2000000
/* Return value was incorrect in libarchive 1.x. */
__LA_DECL void archive_write_finish(struct archive *);
+#else
+/* Libarchive 2.x and later returns an error if this fails. */
+/* It can fail if the archive wasn't already closed, in which case
+ * archive_write_finish() will implicitly call archive_write_close(). */
+__LA_DECL int archive_write_finish(struct archive *);
#endif
/*-
@@ -589,5 +627,9 @@ __LA_DECL void archive_copy_error(struct archive *dest,
/* This is meaningless outside of this header. */
#undef __LA_DECL
+#undef __LA_GID_T
+#undef __LA_INT64_T
+#undef __LA_SSIZE_T
+#undef __LA_UID_T
#endif /* !ARCHIVE_H_INCLUDED */
OpenPOWER on IntegriCloud