Просмотр исходного кода

libdpkg: Remove stream I/O support from the buffer API

Guillem Jover лет назад: 15
Родитель
Сommit
4546c3b92d
2 измененных файлов с 0 добавлено и 28 удалено
  1. 0 15
      lib/dpkg/buffer.c
  2. 0 13
      lib/dpkg/buffer.h

+ 0 - 15
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);

+ 0 - 13
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,