#include "sparse_file.h"
#include "sparse_format.h"
-#if defined(__APPLE__) && defined(__MACH__)
-#define lseek64 lseek
-#define off64_t off_t
-#endif
-
#define SPARSE_HEADER_MAJOR_VER 1
#define SPARSE_HEADER_LEN (sizeof(sparse_header_t))
#define CHUNK_HEADER_LEN (sizeof(chunk_header_t))
len -= chunk;
}
} else {
- lseek64(fd, len, SEEK_CUR);
+ lseek(fd, len, SEEK_CUR);
}
return 0;
return 0;
}
-static int process_chunk(struct sparse_file *s, int fd, off64_t offset,
+static int process_chunk(struct sparse_file *s, int fd, off_t offset,
unsigned int chunk_hdr_sz, chunk_header_t *chunk_header,
unsigned int cur_block, uint32_t *crc_ptr)
{
uint32_t crc32 = 0;
uint32_t *crc_ptr = 0;
unsigned int cur_block = 0;
- off64_t offset;
+ off_t offset;
if (!copybuf) {
copybuf = malloc(COPY_BUF_SIZE);
/* Skip the remaining bytes in a header that is longer than
* we expected.
*/
- lseek64(fd, sparse_header.file_hdr_sz - SPARSE_HEADER_LEN, SEEK_CUR);
+ lseek(fd, sparse_header.file_hdr_sz - SPARSE_HEADER_LEN, SEEK_CUR);
}
for (i = 0; i < sparse_header.total_chunks; i++) {
/* Skip the remaining bytes in a header that is longer than
* we expected.
*/
- lseek64(fd, sparse_header.chunk_hdr_sz - CHUNK_HEADER_LEN, SEEK_CUR);
+ lseek(fd, sparse_header.chunk_hdr_sz - CHUNK_HEADER_LEN, SEEK_CUR);
}
- offset = lseek64(fd, 0, SEEK_CUR);
+ offset = lseek(fd, 0, SEEK_CUR);
ret = process_chunk(s, fd, offset, sparse_header.chunk_hdr_sz, &chunk_header,
cur_block, crc_ptr);
return NULL;
}
- ret = lseek64(fd, 0, SEEK_SET);
+ ret = lseek(fd, 0, SEEK_SET);
if (ret < 0) {
verbose_error(verbose, ret, "seeking");
sparse_file_destroy(s);
return s;
}
- len = lseek64(fd, 0, SEEK_END);
+ len = lseek(fd, 0, SEEK_END);
if (len < 0) {
return NULL;
}
- lseek64(fd, 0, SEEK_SET);
+ lseek(fd, 0, SEEK_SET);
s = sparse_file_new(4096, len);
if (!s) {