The following commit has been merged in the master branch: commit 4546c3b92d4d7d57ee9f7580d87270b791441f97 Author: Guillem Jover <guil...@debian.org> Date: Thu Nov 4 00:53:35 2010 +0100
libdpkg: Remove stream I/O support from the buffer API diff --git a/lib/dpkg/buffer.c b/lib/dpkg/buffer.c index 34f8f13..40af5be 100644 --- a/lib/dpkg/buffer.c +++ b/lib/dpkg/buffer.c @@ -29,7 +29,6 @@ #include <string.h> #include <unistd.h> #include <stdlib.h> -#include <stdio.h> #include <dpkg/i18n.h> #include <dpkg/dpkg.h> @@ -112,13 +111,6 @@ buffer_write(struct buffer_data *data, const void *buf, off_t length) break; case BUFFER_WRITE_NULL: break; - case BUFFER_WRITE_STREAM: - ret = fwrite(buf, 1, length, (FILE *)data->arg.ptr); - if (feof((FILE *)data->arg.ptr)) - return -1; - if (ferror((FILE *)data->arg.ptr)) - return -1; - break; case BUFFER_WRITE_MD5: MD5Update(&(((struct buffer_write_md5ctx *)data->arg.ptr)->ctx), buf, length); break; @@ -139,13 +131,6 @@ buffer_read(struct buffer_data *data, void *buf, off_t length) case BUFFER_READ_FD: ret = read(data->arg.i, buf, length); break; - case BUFFER_READ_STREAM: - ret = fread(buf, 1, length, (FILE *)data->arg.ptr); - if (feof((FILE *)data->arg.ptr)) - return ret; - if (ferror((FILE *)data->arg.ptr)) - return -1; - break; default: internerr("unknown data type '%i' in buffer_read\n", data->type); diff --git a/lib/dpkg/buffer.h b/lib/dpkg/buffer.h index 4321bbd..1d50671 100644 --- a/lib/dpkg/buffer.h +++ b/lib/dpkg/buffer.h @@ -34,11 +34,9 @@ DPKG_BEGIN_DECLS #define BUFFER_WRITE_VBUF 1 #define BUFFER_WRITE_FD 2 #define BUFFER_WRITE_NULL 3 -#define BUFFER_WRITE_STREAM 4 #define BUFFER_WRITE_MD5 5 #define BUFFER_READ_FD 0 -#define BUFFER_READ_STREAM 1 struct buffer_data { union { @@ -71,17 +69,6 @@ struct buffer_data { NULL, BUFFER_WRITE_NULL, \ limit, __VA_ARGS__); \ } -# define stream_null_copy(file, limit, ...) \ - if (fseek(file, limit, SEEK_CUR) == -1) { \ - if (errno != EBADF) \ - ohshite(__VA_ARGS__); \ - buffer_copy_PtrPtr(file, BUFFER_READ_STREAM, \ - NULL, BUFFER_WRITE_NULL, \ - limit, __VA_ARGS__); \ - } -# define stream_fd_copy(file, fd, limit, ...) \ - buffer_copy_PtrInt(file, BUFFER_READ_STREAM, fd, BUFFER_WRITE_FD, \ - limit, __VA_ARGS__) off_t buffer_copy_PtrInt(void *p, int typeIn, int i, int typeOut, off_t limit, const char *desc, -- dpkg's main repository -- To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org