comparison lib/protocols.c @ 895:4ab11f70a7f4

2007-3-15 Brian Masney <masneyb@gftp.org> * lib/sshv2.c lib/gftp.h lib/rfc959.c lib/protocols.c lib/fsp.c lib/local.c lib/rfc2068.c src/uicommon/gftpui.c - removed fd argument to *_get_file(), *_put_file() and gftp_transfer_file().
author masneyb
date Fri, 16 Mar 2007 02:44:07 +0000
parents 1808cebed602
children f716c8dbeaff
comparison
equal deleted inserted replaced
894:14476a8a4d2b 895:4ab11f70a7f4
172 request->disconnect (request); 172 request->disconnect (request);
173 } 173 }
174 174
175 175
176 off_t 176 off_t
177 gftp_get_file (gftp_request * request, const char *filename, int fd, 177 gftp_get_file (gftp_request * request, const char *filename,
178 off_t startsize) 178 off_t startsize)
179 { 179 {
180 g_return_val_if_fail (request != NULL, GFTP_EFATAL); 180 g_return_val_if_fail (request != NULL, GFTP_EFATAL);
181 181
182 request->cached = 0; 182 request->cached = 0;
183 if (request->get_file == NULL) 183 if (request->get_file == NULL)
184 return (GFTP_EFATAL); 184 return (GFTP_EFATAL);
185 185
186 return (request->get_file (request, filename, fd, startsize)); 186 return (request->get_file (request, filename, startsize));
187 } 187 }
188 188
189 189
190 int 190 int
191 gftp_put_file (gftp_request * request, const char *filename, int fd, 191 gftp_put_file (gftp_request * request, const char *filename,
192 off_t startsize, off_t totalsize) 192 off_t startsize, off_t totalsize)
193 { 193 {
194 g_return_val_if_fail (request != NULL, GFTP_EFATAL); 194 g_return_val_if_fail (request != NULL, GFTP_EFATAL);
195 195
196 request->cached = 0; 196 request->cached = 0;
197 if (request->put_file == NULL) 197 if (request->put_file == NULL)
198 return (GFTP_EFATAL); 198 return (GFTP_EFATAL);
199 199
200 return (request->put_file (request, filename, fd, startsize, totalsize)); 200 return (request->put_file (request, filename, startsize, totalsize));
201 } 201 }
202 202
203 203
204 off_t 204 off_t
205 gftp_transfer_file (gftp_request * fromreq, const char *fromfile, 205 gftp_transfer_file (gftp_request * fromreq, const char *fromfile,
206 int fromfd, off_t fromsize, 206 off_t fromsize, gftp_request * toreq, const char *tofile,
207 gftp_request * toreq, const char *tofile, 207 off_t tosize)
208 int tofd, off_t tosize)
209 { 208 {
210 /* Needed for systems that size(float) < size(void *) */ 209 /* Needed for systems that size(float) < size(void *) */
211 union { intptr_t i; float f; } maxkbs; 210 union { intptr_t i; float f; } maxkbs;
212 off_t size; 211 off_t size;
213 int ret; 212 int ret;
233 232
234 fromreq->cached = 0; 233 fromreq->cached = 0;
235 toreq->cached = 0; 234 toreq->cached = 0;
236 235
237 get_file: 236 get_file:
238 size = gftp_get_file (fromreq, fromfile, fromfd, tosize); 237 size = gftp_get_file (fromreq, fromfile, tosize);
239 if (size < 0) 238 if (size < 0)
240 { 239 {
241 if (size == GFTP_ETIMEDOUT) 240 if (size == GFTP_ETIMEDOUT)
242 { 241 {
243 ret = gftp_connect (fromreq); 242 ret = gftp_connect (fromreq);
249 248
250 return (size); 249 return (size);
251 } 250 }
252 251
253 put_file: 252 put_file:
254 ret = gftp_put_file (toreq, tofile, tofd, tosize, size); 253 ret = gftp_put_file (toreq, tofile, tosize, size);
255 if (ret != 0) 254 if (ret != 0)
256 { 255 {
257 if (size == GFTP_ETIMEDOUT) 256 if (size == GFTP_ETIMEDOUT)
258 { 257 {
259 ret = gftp_connect (fromreq); 258 ret = gftp_connect (fromreq);