Make read_in_full() and write_in_full() consistent with xread() and xwrite()
xread() and xwrite() return ssize_t values as their native POSIX counterparts read(2) and write(2). To be consistent, read_in_full() and write_in_full() should also return ssize_t values. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Heikki Orsila committed
Apr 27, 2008 at 21:21 UTC
0104ca09e3abf48ab26fd0599c4b686fcff60ffc
4 files changed
+8
-6
cache.h
+2
-2
@@ -726,8 +726,8 @@ extern const char *git_log_output_encoding;
726
extern void maybe_flush_or_die(FILE *, const char *);
727
extern int copy_fd(int ifd, int ofd);
728
extern int copy_file(const char *dst, const char *src, int mode);
729
-extern int read_in_full(int fd, void *buf, size_t count);
730
-extern int write_in_full(int fd, const void *buf, size_t count);
729
+extern ssize_t read_in_full(int fd, void *buf, size_t count);
730
+extern ssize_t write_in_full(int fd, const void *buf, size_t count);
731
extern void write_or_die(int fd, const void *buf, size_t count);
732
extern int write_or_whine(int fd, const void *buf, size_t count, const char *msg);
733
extern int write_or_whine_pipe(int fd, const void *buf, size_t count, const char *msg);
path.c
+2
-1
@@ -91,7 +91,8 @@ int validate_headref(const char *path)
91
struct stat st;
92
char *buf, buffer[256];
93
unsigned char sha1[20];
94
- int len, fd;
94
+ int fd;
95
+ ssize_t len;
96
97
if (lstat(path, &st) < 0)
98
return -1;
refs.c
+2
-1
@@ -368,7 +368,8 @@ int resolve_gitlink_ref(const char *path, const char *refname, unsigned char *re
368
369
const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int *flag)
370
{
371
- int depth = MAXDEPTH, len;
371
+ int depth = MAXDEPTH;
372
+ ssize_t len;
373
char buffer[256];
374
static char ref_buffer[256];
375
write_or_die.c
+2
-2
@@ -40,7 +40,7 @@ void maybe_flush_or_die(FILE *f, const char *desc)
40
}
41
}
42
43
-int read_in_full(int fd, void *buf, size_t count)
43
+ssize_t read_in_full(int fd, void *buf, size_t count)
44
{
45
char *p = buf;
46
ssize_t total = 0;
@@ -57,7 +57,7 @@ int read_in_full(int fd, void *buf, size_t count)
57
return total;
58
}
59
60
-int write_in_full(int fd, const void *buf, size_t count)
60
+ssize_t write_in_full(int fd, const void *buf, size_t count)
61
{
62
const char *p = buf;
63
ssize_t total = 0;