diff options
Diffstat (limited to 'libsparse/include/sparse/sparse.h')
-rw-r--r-- | libsparse/include/sparse/sparse.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libsparse/include/sparse/sparse.h b/libsparse/include/sparse/sparse.h index 356f65fd0..1b91ead5c 100644 --- a/libsparse/include/sparse/sparse.h +++ b/libsparse/include/sparse/sparse.h @@ -18,6 +18,7 @@ #define _LIBSPARSE_SPARSE_H_ #include <stdbool.h> +#include <stddef.h> #include <stdint.h> #ifdef __cplusplus @@ -26,6 +27,11 @@ extern "C" { struct sparse_file; +// The callbacks in sparse_file_callback() and sparse_file_foreach_chunk() take +// size_t as the length type (was `int` in past). This allows clients to keep +// their codes compatibile with both versions as needed. +#define SPARSE_CALLBACK_USES_SIZE_T + /** * sparse_file_new - create a new sparse file cookie * @@ -201,7 +207,7 @@ unsigned int sparse_file_block_size(struct sparse_file *s); * Returns 0 on success, negative errno on error. */ int sparse_file_callback(struct sparse_file *s, bool sparse, bool crc, - int (*write)(void *priv, const void *data, int len), void *priv); + int (*write)(void *priv, const void *data, size_t len), void *priv); /** * sparse_file_foreach_chunk - call a callback for data blocks in sparse file @@ -218,7 +224,7 @@ int sparse_file_callback(struct sparse_file *s, bool sparse, bool crc, * Returns 0 on success, negative errno on error. */ int sparse_file_foreach_chunk(struct sparse_file *s, bool sparse, bool crc, - int (*write)(void *priv, const void *data, int len, unsigned int block, + int (*write)(void *priv, const void *data, size_t len, unsigned int block, unsigned int nr_blocks), void *priv); /** |