summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2924415)
raw | patch | inline | side by side (parent: 2924415)
author | Johan Herland <johan@herland.net> | |
Tue, 15 May 2007 12:49:22 +0000 (14:49 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 16 May 2007 04:16:03 +0000 (21:16 -0700) |
This patch fixes all calls to xread() where the return value is not
stored into an ssize_t. The patch should not have any effect whatsoever,
other than putting better/more appropriate type names on variables.
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
stored into an ssize_t. The patch should not have any effect whatsoever,
other than putting better/more appropriate type names on variables.
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
12 files changed:
builtin-apply.c | patch | blob | history | |
builtin-bundle.c | patch | blob | history | |
builtin-fetch--tool.c | patch | blob | history | |
builtin-unpack-objects.c | patch | blob | history | |
combine-diff.c | patch | blob | history | |
copy.c | patch | blob | history | |
diff.c | patch | blob | history | |
imap-send.c | patch | blob | history | |
index-pack.c | patch | blob | history | |
pkt-line.c | patch | blob | history | |
sha1_file.c | patch | blob | history | |
ssh-upload.c | patch | blob | history |
diff --git a/builtin-apply.c b/builtin-apply.c
index 8b8705a6c056f160940566ef2c851a09cbd98532..0399743c4e2288a0812faeea92c07a5f6a13fccc 100644 (file)
--- a/builtin-apply.c
+++ b/builtin-apply.c
void *buffer = xmalloc(alloc);
for (;;) {
- int nr = alloc - size;
+ ssize_t nr = alloc - size;
if (nr < 1024) {
alloc += CHUNKSIZE;
buffer = xrealloc(buffer, alloc);
@@ -1468,7 +1468,7 @@ static int read_old_data(struct stat *st, const char *path, char **buf_p, unsign
return error("unable to open %s", path);
got = 0;
for (;;) {
- int ret = xread(fd, buf + got, size - got);
+ ssize_t ret = xread(fd, buf + got, size - got);
if (ret <= 0)
break;
got += ret;
diff --git a/builtin-bundle.c b/builtin-bundle.c
index d1635a0a6b009ecb6706084828abd0e3928f2b8d..306ad29597dbf9002a44ba509c2e9d7a737b159d 100644 (file)
--- a/builtin-bundle.c
+++ b/builtin-bundle.c
{
int i;
for (i = 0; i < size - 1; i++) {
- int count = xread(fd, buffer + i, 1);
+ ssize_t count = xread(fd, buffer + i, 1);
if (count < 0)
return error("Read error: %s", strerror(errno));
if (count == 0) {
diff --git a/builtin-fetch--tool.c b/builtin-fetch--tool.c
index 2065466f272dba506e6c34f16b12e4726996e0ec..12adb3833cd60771f8e63b2ebaecff3769fa74e2 100644 (file)
--- a/builtin-fetch--tool.c
+++ b/builtin-fetch--tool.c
static char *get_stdin(void)
{
- int offset = 0;
+ size_t offset = 0;
char *data = xmalloc(CHUNK_SIZE);
while (1) {
- int cnt = xread(0, data + offset, CHUNK_SIZE);
+ ssize_t cnt = xread(0, data + offset, CHUNK_SIZE);
if (cnt < 0)
die("error reading standard input: %s",
strerror(errno));
index 2bbda67fabfcc5292313c4ac6c462cd8911d9128..a6ff62fd8c66f075550e01718acf56d90b44d4bb 100644 (file)
--- a/builtin-unpack-objects.c
+++ b/builtin-unpack-objects.c
offset = 0;
}
do {
- int ret = xread(0, buffer + len, sizeof(buffer) - len);
+ ssize_t ret = xread(0, buffer + len, sizeof(buffer) - len);
if (ret <= 0) {
if (!ret)
die("early EOF");
diff --git a/combine-diff.c b/combine-diff.c
index cff9c5dc426cae9bd517614e00739edc4b40d635..ea3ca5f950561a92fdd3be1a4ee4bbd726656118 100644 (file)
--- a/combine-diff.c
+++ b/combine-diff.c
result_size = len;
result = xmalloc(len + 1);
while (sz < len) {
- int done = xread(fd, result+sz, len-sz);
+ ssize_t done = xread(fd, result+sz, len-sz);
if (done == 0)
break;
if (done < 0)
index 08a3d388a4c312fca18558b2b8e5dcf027c7afaf..d340bb253ec35af379c29e71f384e15d6822fb9a 100644 (file)
--- a/copy.c
+++ b/copy.c
int copy_fd(int ifd, int ofd)
{
while (1) {
- int len;
char buffer[8192];
char *buf = buffer;
- len = xread(ifd, buffer, sizeof(buffer));
+ ssize_t len = xread(ifd, buffer, sizeof(buffer));
if (!len)
break;
if (len < 0) {
index 8354e71e0707960f7a1094e288bea0fac83ec6b8..33297aa8a7fd8f1c7f4711a9807b0b497d3de2ae 100644 (file)
--- a/diff.c
+++ b/diff.c
#define INCREMENT 1024
char *buf;
unsigned long size;
- int got;
+ ssize_t got;
size = 0;
buf = NULL;
diff --git a/imap-send.c b/imap-send.c
index 84df2fabb7f91d30f7617dd07202ed916c5f8eb1..4283a4acdaf28a8edc2f595e6137cc396f4988dc 100644 (file)
--- a/imap-send.c
+++ b/imap-send.c
static int
socket_read( Socket_t *sock, char *buf, int len )
{
- int n = xread( sock->fd, buf, len );
+ ssize_t n = xread( sock->fd, buf, len );
if (n <= 0) {
socket_perror( "read", sock, n );
close( sock->fd );
diff --git a/index-pack.c b/index-pack.c
index b9da19f55ba522d8e09c51f9413adf8d799484e9..58c4a9c41dd7a05b86d40e6eeee33ba0a3fb6c4f 100644 (file)
--- a/index-pack.c
+++ b/index-pack.c
die("cannot fill %d bytes", min);
flush();
do {
- int ret = xread(input_fd, input_buffer + input_len,
+ ssize_t ret = xread(input_fd, input_buffer + input_len,
sizeof(input_buffer) - input_len);
if (ret <= 0) {
if (!ret)
diff --git a/pkt-line.c b/pkt-line.c
index b4cb7e2756dcc52c17aebf4c0fc6adc7b415ef3c..b60526869a38bd20f800c275f7b42390c8bea1ee 100644 (file)
--- a/pkt-line.c
+++ b/pkt-line.c
static void safe_read(int fd, void *buffer, unsigned size)
{
- int n = 0;
+ size_t n = 0;
while (n < size) {
- int ret = xread(fd, (char *) buffer + n, size - n);
+ ssize_t ret = xread(fd, (char *) buffer + n, size - n);
if (ret < 0)
die("read error (%s)", strerror(errno));
if (!ret)
diff --git a/sha1_file.c b/sha1_file.c
index 32244d704e1c747780aed461bb78cf4a72199f18..be991ed22acb0c84141474360f345d51ccc594be 100644 (file)
--- a/sha1_file.c
+++ b/sha1_file.c
{
char* buf = *return_buf;
unsigned long size = *return_size;
- int iret;
+ ssize_t iret;
unsigned long off = 0;
do {
diff --git a/ssh-upload.c b/ssh-upload.c
index 2f045727875707198dd1763d75c9e8c7406e9042..498d41e19b5756c82ef8e0ead779f40812f84227 100644 (file)
--- a/ssh-upload.c
+++ b/ssh-upload.c
static void service(int fd_in, int fd_out) {
char type;
- int retval;
+ ssize_t retval;
do {
retval = xread(fd_in, &type, 1);
if (retval < 1) {