summaryrefslogtreecommitdiff
authorschurig <schurig>2004-09-10 12:48:25 (UTC)
committer schurig <schurig>2004-09-10 12:48:25 (UTC)
commitf9fb882141b4a519ae958e6332fb5a8ef717d88c (patch) (side-by-side diff)
treea97e359f73a0afc98d4a58ba057676cf8da94f13
parent85928a3781d9a91b58ea414c0d7982459cc21920 (diff)
downloadopie-f9fb882141b4a519ae958e6332fb5a8ef717d88c.zip
opie-f9fb882141b4a519ae958e6332fb5a8ef717d88c.tar.gz
opie-f9fb882141b4a519ae958e6332fb5a8ef717d88c.tar.bz2
In old ANSI-C you can't have expressions before variable declarations
(C++ allows this)
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--rsync/buf.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/rsync/buf.c b/rsync/buf.c
index c978fff..fdd67ee 100644
--- a/rsync/buf.c
+++ b/rsync/buf.c
@@ -75,105 +75,107 @@ rs_filebuf_t *rs_filebuf_new(FILE *f, size_t buf_len)
pf->buf_len = buf_len;
pf->f = f;
return pf;
}
void rs_filebuf_free(rs_filebuf_t *fb)
{
if ( fb->buf )
free ( fb->buf );
rs_bzero(fb, sizeof *fb);
free(fb);
}
/*
* If the stream has no more data available, read some from F into
* BUF, and let the stream use that. On return, SEEN_EOF is true if
* the end of file has passed into the stream.
*/
rs_result rs_infilebuf_fill(rs_job_t *job, rs_buffers_t *buf,
void *opaque)
{
- job=job;
int len;
rs_filebuf_t *fb = (rs_filebuf_t *) opaque;
FILE *f = fb->f;
+ job=job; // fix unused warning
+
/* This is only allowed if either the buf has no input buffer
* yet, or that buffer could possibly be BUF. */
if (buf->next_in != NULL) {
assert(buf->avail_in <= fb->buf_len);
assert(buf->next_in >= fb->buf);
assert(buf->next_in <= fb->buf + fb->buf_len);
} else {
assert(buf->avail_in == 0);
}
if (buf->eof_in || (buf->eof_in = feof(f))) {
rs_trace("seen end of file on input");
buf->eof_in = 1;
return RS_DONE;
}
if (buf->avail_in)
/* Still some data remaining. Perhaps we should read
anyhow? */
return RS_DONE;
len = fread(fb->buf, 1, fb->buf_len, f);
if (len < 0) {
if (ferror(f)) {
rs_error("error filling buf from file: %s",
strerror(errno));
return RS_IO_ERROR;
} else {
rs_error("no error bit, but got %d return when trying to read",
len);
return RS_IO_ERROR;
}
}
buf->avail_in = len;
buf->next_in = fb->buf;
return RS_DONE;
}
/*
* The buf is already using BUF for an output buffer, and probably
* contains some buffered output now. Write this out to F, and reset
* the buffer cursor.
*/
rs_result rs_outfilebuf_drain(rs_job_t *job, rs_buffers_t *buf, void *opaque)
{
- job=job;
int present;
rs_filebuf_t *fb = (rs_filebuf_t *) opaque;
FILE *f = fb->f;
+ job=job; // fix unused warning
+
/* This is only allowed if either the buf has no output buffer
* yet, or that buffer could possibly be BUF. */
if (buf->next_out == NULL) {
assert(buf->avail_out == 0);
buf->next_out = fb->buf;
buf->avail_out = fb->buf_len;
return RS_DONE;
}
assert(buf->avail_out <= fb->buf_len);
assert(buf->next_out >= fb->buf);
assert(buf->next_out <= fb->buf + fb->buf_len);
present = buf->next_out - fb->buf;
if (present > 0) {
int result;
assert(present > 0);
result = fwrite(fb->buf, 1, present, f);
if (present != result) {
rs_error("error draining buf to file: %s",