summaryrefslogtreecommitdiff
authorzecke <zecke>2004-09-10 11:18:45 (UTC)
committer zecke <zecke>2004-09-10 11:18:45 (UTC)
commiteadf5111822801f02c71930e707ae5758a97712c (patch) (unidiff)
tree5ce4ead36bbe0a3854ad7a18e09066af41a26b42
parentd66bae289ee2c3c359fa959764ac2e814a179f69 (diff)
downloadopie-eadf5111822801f02c71930e707ae5758a97712c.zip
opie-eadf5111822801f02c71930e707ae5758a97712c.tar.gz
opie-eadf5111822801f02c71930e707ae5758a97712c.tar.bz2
Fix some warnings of rsync
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--rsync/buf.c2
-rw-r--r--rsync/job.c1
2 files changed, 3 insertions, 0 deletions
diff --git a/rsync/buf.c b/rsync/buf.c
index 2814583..c978fff 100644
--- a/rsync/buf.c
+++ b/rsync/buf.c
@@ -75,48 +75,49 @@ rs_filebuf_t *rs_filebuf_new(FILE *f, size_t buf_len)
75 pf->buf_len = buf_len; 75 pf->buf_len = buf_len;
76 pf->f = f; 76 pf->f = f;
77 77
78 return pf; 78 return pf;
79} 79}
80 80
81 81
82void rs_filebuf_free(rs_filebuf_t *fb) 82void 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 */
96rs_result rs_infilebuf_fill(rs_job_t *job, rs_buffers_t *buf, 96rs_result rs_infilebuf_fill(rs_job_t *job, rs_buffers_t *buf,
97 void *opaque) 97 void *opaque)
98{ 98{
99 job=job;
99 int len; 100 int len;
100 rs_filebuf_t *fb = (rs_filebuf_t *) opaque; 101 rs_filebuf_t *fb = (rs_filebuf_t *) opaque;
101 FILE *f = fb->f; 102 FILE *f = fb->f;
102 103
103 /* This is only allowed if either the buf has no input buffer 104 /* This is only allowed if either the buf has no input buffer
104 * yet, or that buffer could possibly be BUF. */ 105 * yet, or that buffer could possibly be BUF. */
105 if (buf->next_in != NULL) { 106 if (buf->next_in != NULL) {
106 assert(buf->avail_in <= fb->buf_len); 107 assert(buf->avail_in <= fb->buf_len);
107 assert(buf->next_in >= fb->buf); 108 assert(buf->next_in >= fb->buf);
108 assert(buf->next_in <= fb->buf + fb->buf_len); 109 assert(buf->next_in <= fb->buf + fb->buf_len);
109 } else { 110 } else {
110 assert(buf->avail_in == 0); 111 assert(buf->avail_in == 0);
111 } 112 }
112 113
113 if (buf->eof_in || (buf->eof_in = feof(f))) { 114 if (buf->eof_in || (buf->eof_in = feof(f))) {
114 rs_trace("seen end of file on input"); 115 rs_trace("seen end of file on input");
115 buf->eof_in = 1; 116 buf->eof_in = 1;
116 return RS_DONE; 117 return RS_DONE;
117 } 118 }
118 119
119 if (buf->avail_in) 120 if (buf->avail_in)
120 /* Still some data remaining. Perhaps we should read 121 /* Still some data remaining. Perhaps we should read
121 anyhow? */ 122 anyhow? */
122 return RS_DONE; 123 return RS_DONE;
@@ -126,48 +127,49 @@ rs_result rs_infilebuf_fill(rs_job_t *job, rs_buffers_t *buf,
126 if (ferror(f)) { 127 if (ferror(f)) {
127 rs_error("error filling buf from file: %s", 128 rs_error("error filling buf from file: %s",
128 strerror(errno)); 129 strerror(errno));
129 return RS_IO_ERROR; 130 return RS_IO_ERROR;
130 } else { 131 } else {
131 rs_error("no error bit, but got %d return when trying to read", 132 rs_error("no error bit, but got %d return when trying to read",
132 len); 133 len);
133 return RS_IO_ERROR; 134 return RS_IO_ERROR;
134 } 135 }
135 } 136 }
136 buf->avail_in = len; 137 buf->avail_in = len;
137 buf->next_in = fb->buf; 138 buf->next_in = fb->buf;
138 139
139 return RS_DONE; 140 return RS_DONE;
140} 141}
141 142
142 143
143/* 144/*
144 * The buf is already using BUF for an output buffer, and probably 145 * The buf is already using BUF for an output buffer, and probably
145 * contains some buffered output now. Write this out to F, and reset 146 * contains some buffered output now. Write this out to F, and reset
146 * the buffer cursor. 147 * the buffer cursor.
147 */ 148 */
148rs_result rs_outfilebuf_drain(rs_job_t *job, rs_buffers_t *buf, void *opaque) 149rs_result rs_outfilebuf_drain(rs_job_t *job, rs_buffers_t *buf, void *opaque)
149{ 150{
151 job=job;
150 int present; 152 int present;
151 rs_filebuf_t *fb = (rs_filebuf_t *) opaque; 153 rs_filebuf_t *fb = (rs_filebuf_t *) opaque;
152 FILE *f = fb->f; 154 FILE *f = fb->f;
153 155
154 /* This is only allowed if either the buf has no output buffer 156 /* This is only allowed if either the buf has no output buffer
155 * yet, or that buffer could possibly be BUF. */ 157 * yet, or that buffer could possibly be BUF. */
156 if (buf->next_out == NULL) { 158 if (buf->next_out == NULL) {
157 assert(buf->avail_out == 0); 159 assert(buf->avail_out == 0);
158 160
159 buf->next_out = fb->buf; 161 buf->next_out = fb->buf;
160 buf->avail_out = fb->buf_len; 162 buf->avail_out = fb->buf_len;
161 163
162 return RS_DONE; 164 return RS_DONE;
163 } 165 }
164 166
165 assert(buf->avail_out <= fb->buf_len); 167 assert(buf->avail_out <= fb->buf_len);
166 assert(buf->next_out >= fb->buf); 168 assert(buf->next_out >= fb->buf);
167 assert(buf->next_out <= fb->buf + fb->buf_len); 169 assert(buf->next_out <= fb->buf + fb->buf_len);
168 170
169 present = buf->next_out - fb->buf; 171 present = buf->next_out - fb->buf;
170 if (present > 0) { 172 if (present > 0) {
171 int result; 173 int result;
172 174
173 assert(present > 0); 175 assert(present > 0);
diff --git a/rsync/job.c b/rsync/job.c
index 680982d..36f39f0 100644
--- a/rsync/job.c
+++ b/rsync/job.c
@@ -73,48 +73,49 @@ rs_job_t * rs_job_new(char const *job_name, rs_result (*statefn)(rs_job_t *))
73 rs_trace("start %s job", job_name); 73 rs_trace("start %s job", job_name);
74 74
75 return job; 75 return job;
76} 76}
77 77
78 78
79void rs_job_check(rs_job_t *job) 79void rs_job_check(rs_job_t *job)
80{ 80{
81 assert(job->dogtag == rs_job_tag); 81 assert(job->dogtag == rs_job_tag);
82} 82}
83 83
84 84
85rs_result rs_job_free(rs_job_t *job) 85rs_result rs_job_free(rs_job_t *job)
86{ 86{
87 rs_bzero(job, sizeof *job); 87 rs_bzero(job, sizeof *job);
88 free(job); 88 free(job);
89 89
90 return RS_DONE; 90 return RS_DONE;
91} 91}
92 92
93 93
94 94
95static rs_result rs_job_s_complete(rs_job_t *job) 95static rs_result rs_job_s_complete(rs_job_t *job)
96{ 96{
97 job = job;
97 rs_fatal("should not be reached"); 98 rs_fatal("should not be reached");
98 return RS_INTERNAL_ERROR; 99 return RS_INTERNAL_ERROR;
99} 100}
100 101
101 102
102static rs_result rs_job_complete(rs_job_t *job, rs_result result) 103static rs_result rs_job_complete(rs_job_t *job, rs_result result)
103{ 104{
104 rs_job_check(job); 105 rs_job_check(job);
105 106
106 job->statefn = rs_job_s_complete; 107 job->statefn = rs_job_s_complete;
107 job->final_result = result; 108 job->final_result = result;
108 109
109 if (result != RS_DONE) { 110 if (result != RS_DONE) {
110 rs_error("%s job failed: %s", job->job_name, rs_strerror(result)); 111 rs_error("%s job failed: %s", job->job_name, rs_strerror(result));
111 } else { 112 } else {
112 rs_trace("%s job complete", job->job_name); 113 rs_trace("%s job complete", job->job_name);
113 } 114 }
114 115
115 if (result == RS_DONE && !rs_tube_is_idle(job)) 116 if (result == RS_DONE && !rs_tube_is_idle(job))
116 /* Processing is finished, but there is still some data 117 /* Processing is finished, but there is still some data
117 * waiting to get into the output buffer. */ 118 * waiting to get into the output buffer. */
118 return RS_BLOCKED; 119 return RS_BLOCKED;
119 else 120 else
120 return result; 121 return result;