author | schurig <schurig> | 2004-09-10 12:48:25 (UTC) |
---|---|---|
committer | schurig <schurig> | 2004-09-10 12:48:25 (UTC) |
commit | f9fb882141b4a519ae958e6332fb5a8ef717d88c (patch) (unidiff) | |
tree | a97e359f73a0afc98d4a58ba057676cf8da94f13 /rsync/buf.c | |
parent | 85928a3781d9a91b58ea414c0d7982459cc21920 (diff) | |
download | opie-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)
-rw-r--r-- | rsync/buf.c | 6 |
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 | |||
@@ -83,36 +83,37 @@ void rs_filebuf_free(rs_filebuf_t *fb) | |||
83 | { | 83 | { |
84 | if ( fb->buf ) | 84 | if ( fb->buf ) |
85 | free ( fb->buf ); | 85 | free ( fb->buf ); |
86 | rs_bzero(fb, sizeof *fb); | 86 | rs_bzero(fb, sizeof *fb); |
87 | free(fb); | 87 | free(fb); |
88 | } | 88 | } |
89 | 89 | ||
90 | 90 | ||
91 | /* | 91 | /* |
92 | * If the stream has no more data available, read some from F into | 92 | * If the stream has no more data available, read some from F into |
93 | * BUF, and let the stream use that. On return, SEEN_EOF is true if | 93 | * BUF, and let the stream use that. On return, SEEN_EOF is true if |
94 | * the end of file has passed into the stream. | 94 | * the end of file has passed into the stream. |
95 | */ | 95 | */ |
96 | rs_result rs_infilebuf_fill(rs_job_t *job, rs_buffers_t *buf, | 96 | rs_result rs_infilebuf_fill(rs_job_t *job, rs_buffers_t *buf, |
97 | void *opaque) | 97 | void *opaque) |
98 | { | 98 | { |
99 | job=job; | ||
100 | int len; | 99 | int len; |
101 | rs_filebuf_t *fb = (rs_filebuf_t *) opaque; | 100 | rs_filebuf_t *fb = (rs_filebuf_t *) opaque; |
102 | FILE *f = fb->f; | 101 | FILE *f = fb->f; |
102 | |||
103 | job=job; // fix unused warning | ||
103 | 104 | ||
104 | /* This is only allowed if either the buf has no input buffer | 105 | /* This is only allowed if either the buf has no input buffer |
105 | * yet, or that buffer could possibly be BUF. */ | 106 | * yet, or that buffer could possibly be BUF. */ |
106 | if (buf->next_in != NULL) { | 107 | if (buf->next_in != NULL) { |
107 | assert(buf->avail_in <= fb->buf_len); | 108 | assert(buf->avail_in <= fb->buf_len); |
108 | assert(buf->next_in >= fb->buf); | 109 | assert(buf->next_in >= fb->buf); |
109 | assert(buf->next_in <= fb->buf + fb->buf_len); | 110 | assert(buf->next_in <= fb->buf + fb->buf_len); |
110 | } else { | 111 | } else { |
111 | assert(buf->avail_in == 0); | 112 | assert(buf->avail_in == 0); |
112 | } | 113 | } |
113 | 114 | ||
114 | if (buf->eof_in || (buf->eof_in = feof(f))) { | 115 | if (buf->eof_in || (buf->eof_in = feof(f))) { |
115 | rs_trace("seen end of file on input"); | 116 | rs_trace("seen end of file on input"); |
116 | buf->eof_in = 1; | 117 | buf->eof_in = 1; |
117 | return RS_DONE; | 118 | return RS_DONE; |
118 | } | 119 | } |
@@ -135,37 +136,38 @@ rs_result rs_infilebuf_fill(rs_job_t *job, rs_buffers_t *buf, | |||
135 | } | 136 | } |
136 | } | 137 | } |
137 | buf->avail_in = len; | 138 | buf->avail_in = len; |
138 | buf->next_in = fb->buf; | 139 | buf->next_in = fb->buf; |
139 | 140 | ||
140 | return RS_DONE; | 141 | return RS_DONE; |
141 | } | 142 | } |
142 | 143 | ||
143 | 144 | ||
144 | /* | 145 | /* |
145 | * The buf is already using BUF for an output buffer, and probably | 146 | * The buf is already using BUF for an output buffer, and probably |
146 | * contains some buffered output now. Write this out to F, and reset | 147 | * contains some buffered output now. Write this out to F, and reset |
147 | * the buffer cursor. | 148 | * the buffer cursor. |
148 | */ | 149 | */ |
149 | rs_result rs_outfilebuf_drain(rs_job_t *job, rs_buffers_t *buf, void *opaque) | 150 | rs_result rs_outfilebuf_drain(rs_job_t *job, rs_buffers_t *buf, void *opaque) |
150 | { | 151 | { |
151 | job=job; | ||
152 | int present; | 152 | int present; |
153 | rs_filebuf_t *fb = (rs_filebuf_t *) opaque; | 153 | rs_filebuf_t *fb = (rs_filebuf_t *) opaque; |
154 | FILE *f = fb->f; | 154 | FILE *f = fb->f; |
155 | 155 | ||
156 | job=job; // fix unused warning | ||
157 | |||
156 | /* This is only allowed if either the buf has no output buffer | 158 | /* This is only allowed if either the buf has no output buffer |
157 | * yet, or that buffer could possibly be BUF. */ | 159 | * yet, or that buffer could possibly be BUF. */ |
158 | if (buf->next_out == NULL) { | 160 | if (buf->next_out == NULL) { |
159 | assert(buf->avail_out == 0); | 161 | assert(buf->avail_out == 0); |
160 | 162 | ||
161 | buf->next_out = fb->buf; | 163 | buf->next_out = fb->buf; |
162 | buf->avail_out = fb->buf_len; | 164 | buf->avail_out = fb->buf_len; |
163 | 165 | ||
164 | return RS_DONE; | 166 | return RS_DONE; |
165 | } | 167 | } |
166 | 168 | ||
167 | assert(buf->avail_out <= fb->buf_len); | 169 | assert(buf->avail_out <= fb->buf_len); |
168 | assert(buf->next_out >= fb->buf); | 170 | assert(buf->next_out >= fb->buf); |
169 | assert(buf->next_out <= fb->buf + fb->buf_len); | 171 | assert(buf->next_out <= fb->buf + fb->buf_len); |
170 | 172 | ||
171 | present = buf->next_out - fb->buf; | 173 | present = buf->next_out - fb->buf; |