Change the client skipper API to use off_t instead of size_t/ssize_t; but

wrap this within #if/#else/#endif so that it will only take effect once
ARCHIVE_API_VERSION is increased (which should happen on HEAD some time
between now and when RELENG_7 is branched).
This commit is contained in:
Colin Percival 2007-01-05 10:48:18 +00:00
parent 03d0aa10bc
commit a0b84e7498
6 changed files with 46 additions and 0 deletions

View File

@ -112,8 +112,13 @@ struct archive_entry;
typedef 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_API_VERSION < 2
typedef ssize_t archive_skip_callback(struct archive *, void *_client_data,
size_t request);
#else
typedef off_t archive_skip_callback(struct archive *, void *_client_data,
off_t request);
#endif
/* Returns size actually written, zero on EOF, -1 on error. */
typedef ssize_t archive_write_callback(struct archive *, void *_client_data,
const void *_buffer, size_t _length);

View File

@ -321,8 +321,13 @@ The callback functions must match the following prototypes:
.Ft typedef ssize_t
.Fn archive_read_callback "struct archive *" "void *client_data" "const void **buffer"
.It
.\" #if ARCHIVE_API_VERSION < 2
.Ft typedef int
.Fn archive_skip_callback "struct archive *" "void *client_data" "size_t request"
.\" #else
.\" .Ft typedef off_t
.\" .Fn archive_skip_callback "struct archive *" "void *client_data" "off_t request"
.\" #endif
.It
.Ft typedef int
.Fn archive_open_callback "struct archive *" "void *client_data"

View File

@ -54,7 +54,11 @@ struct read_fd_data {
static int file_close(struct archive *, void *);
static int file_open(struct archive *, void *);
static ssize_t file_read(struct archive *, void *, const void **buff);
#if ARCHIVE_API_VERSION < 2
static ssize_t file_skip(struct archive *, void *, size_t request);
#else
static off_t file_skip(struct archive *, void *, off_t request);
#endif
int
archive_read_open_fd(struct archive *a, int fd, size_t block_size)
@ -107,8 +111,13 @@ file_read(struct archive *a, void *client_data, const void **buff)
return (bytes_read);
}
#if ARCHIVE_API_VERSION < 2
static ssize_t
file_skip(struct archive *a, void *client_data, size_t request)
#else
static off_t
file_skip(struct archive *a, void *client_data, off_t request)
#endif
{
struct read_fd_data *mine = (struct read_fd_data *)client_data;
off_t old_offset, new_offset;

View File

@ -57,7 +57,11 @@ struct read_FILE_data {
static int file_close(struct archive *, void *);
static int file_open(struct archive *, void *);
static ssize_t file_read(struct archive *, void *, const void **buff);
#if ARCHIVE_API_VERSION < 2
static ssize_t file_skip(struct archive *, void *, size_t request);
#else
static off_t file_skip(struct archive *, void *, off_t request);
#endif
int
archive_read_open_FILE(struct archive *a, FILE *f)
@ -112,8 +116,13 @@ file_read(struct archive *a, void *client_data, const void **buff)
return (bytes_read);
}
#if ARCHIVE_API_VERSION < 2
static ssize_t
file_skip(struct archive *a, void *client_data, size_t request)
#else
static off_t
file_skip(struct archive *a, void *client_data, off_t request)
#endif
{
struct read_FILE_data *mine = (struct read_FILE_data *)client_data;

View File

@ -59,7 +59,11 @@ struct read_file_data {
static int file_close(struct archive *, void *);
static int file_open(struct archive *, void *);
static ssize_t file_read(struct archive *, void *, const void **buff);
#if ARCHIVE_API_VERSION < 2
static ssize_t file_skip(struct archive *, void *, size_t request);
#else
static off_t file_skip(struct archive *, void *, off_t request);
#endif
int
archive_read_open_file(struct archive *a, const char *filename,
@ -151,8 +155,13 @@ file_read(struct archive *a, void *client_data, const void **buff)
return (bytes_read);
}
#if ARCHIVE_API_VERSION < 2
static ssize_t
file_skip(struct archive *a, void *client_data, size_t request)
#else
static off_t
file_skip(struct archive *a, void *client_data, off_t request)
#endif
{
struct read_file_data *mine = (struct read_file_data *)client_data;
off_t old_offset, new_offset;

View File

@ -48,7 +48,11 @@ struct read_memory_data {
static int memory_read_close(struct archive *, void *);
static int memory_read_open(struct archive *, void *);
#if ARCHIVE_API_VERSION < 2
static ssize_t memory_read_skip(struct archive *, void *, size_t request);
#else
static off_t memory_read_skip(struct archive *, void *, off_t request);
#endif
static ssize_t memory_read(struct archive *, void *, const void **buff);
int
@ -119,8 +123,13 @@ memory_read(struct archive *a, void *client_data, const void **buff)
* necessary in order to better exercise internal code when used
* as a test harness.
*/
#if ARCHIVE_API_VERSION < 2
static ssize_t
memory_read_skip(struct archive *a, void *client_data, size_t skip)
#else
static off_t
memory_read_skip(struct archive *a, void *client_data, off_t skip)
#endif
{
struct read_memory_data *mine = (struct read_memory_data *)client_data;