Mercurial > gftp.yaz
changeset 76:fe308e435ed5
2002-12-4 Brian Masney <masneyb@gftp.org>
* lib/protocols.c (gftp_set_data_type) - return 0 if there is no
protocol specific set_data_type function
* src/gtk/transfer.c (gftp_gtk_transfer_files) - ascii/binary automatic
switching fixes
author | masneyb |
---|---|
date | Thu, 05 Dec 2002 00:43:07 +0000 |
parents | 77c77098795a |
children | 100a4b310c60 |
files | ChangeLog lib/protocols.c src/gtk/transfer.c |
diffstat | 3 files changed, 36 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Dec 04 02:36:05 2002 +0000 +++ b/ChangeLog Thu Dec 05 00:43:07 2002 +0000 @@ -1,4 +1,11 @@ -2002-12-333 Brian Masney <masneyb@gftp.org> +2002-12-4 Brian Masney <masneyb@gftp.org> + * lib/protocols.c (gftp_set_data_type) - return 0 if there is no + protocol specific set_data_type function + + * src/gtk/transfer.c (gftp_gtk_transfer_files) - ascii/binary automatic + switching fixes + +2002-12-3 Brian Masney <masneyb@gftp.org> * lib/config_file.c lib/gftp.h lib/protocols.c - removed use_default_dl_types option. This is always enabled by default now. @@ -366,7 +373,7 @@ * cvsclean - added this script - * *.[ch] - added $Id: ChangeLog,v 1.45 2002/12/04 02:36:05 masneyb Exp $ tags + * *.[ch] - added $Id: ChangeLog,v 1.46 2002/12/05 00:43:06 masneyb Exp $ tags * debian/* - updated files from Debian maintainer
--- a/lib/protocols.c Wed Dec 04 02:36:05 2002 +0000 +++ b/lib/protocols.c Thu Dec 05 00:43:07 2002 +0000 @@ -496,7 +496,7 @@ g_return_val_if_fail (request != NULL, -2); if (request->set_data_type == NULL) - return (-2); + return (0); return (request->set_data_type (request, data_type)); }
--- a/src/gtk/transfer.c Wed Dec 04 02:36:05 2002 +0000 +++ b/src/gtk/transfer.c Thu Dec 05 00:43:07 2002 +0000 @@ -727,10 +727,9 @@ void * gftp_gtk_transfer_files (void *data) { - int i, mode, from_data_type, to_data_type; + int i, mode, dl_type, tofd, fromfd, old_from_datatype; gftp_transfer * transfer; char *tempstr, buf[8192]; - int tofd, fromfd; off_t fromsize, total; gftp_file * curfle; ssize_t num_read; @@ -741,13 +740,15 @@ gettimeofday (&transfer->starttime, NULL); memcpy (&transfer->lasttime, &transfer->starttime, sizeof (transfer->lasttime)); + + dl_type = transfer->fromreq->data_type; + old_from_datatype = transfer->fromreq->data_type; + while (transfer->curfle != NULL) { - from_data_type = to_data_type = -1; - pthread_mutex_lock (transfer->structmutex); curfle = transfer->curfle->data; - transfer->current_file_number++; + transfer->current_file_number++; pthread_mutex_unlock (transfer->structmutex); if (curfle->transfer_action == GFTP_TRANS_ACTION_SKIP) @@ -815,21 +816,27 @@ if (GFTP_IS_CONNECTED (transfer->fromreq) && GFTP_IS_CONNECTED (transfer->toreq)) { - if (curfle->ascii) + if (!curfle->ascii && old_from_datatype == GFTP_TYPE_BINARY) + dl_type = GFTP_TYPE_BINARY; + else + dl_type = GFTP_GET_DATA_TYPE (transfer->fromreq) == GFTP_TYPE_ASCII || curfle->ascii ? GFTP_TYPE_ASCII : GFTP_TYPE_BINARY; + + if (dl_type != transfer->fromreq->data_type) { - if (transfer->fromreq->data_type != GFTP_TYPE_ASCII) - { - from_data_type = transfer->fromreq->data_type; - gftp_set_data_type (transfer->fromreq, GFTP_TYPE_ASCII); - } + if (gftp_set_data_type (transfer->fromreq, dl_type) != 0) + gftp_disconnect (transfer->fromreq); + } - if (transfer->toreq->data_type != GFTP_TYPE_ASCII) - { - to_data_type = transfer->toreq->data_type; - gftp_set_data_type (transfer->toreq, GFTP_TYPE_ASCII); - } - } + if (dl_type != transfer->toreq->data_type) + { + if (gftp_set_data_type (transfer->toreq, dl_type) != 0) + gftp_disconnect (transfer->toreq); + } + } + if (GFTP_IS_CONNECTED (transfer->fromreq) && + GFTP_IS_CONNECTED (transfer->toreq)) + { fromsize = gftp_transfer_file (transfer->fromreq, curfle->file, fromfd, curfle->transfer_action == GFTP_TRANS_ACTION_RESUME ? @@ -837,15 +844,6 @@ transfer->toreq, curfle->destfile, tofd, curfle->transfer_action == GFTP_TRANS_ACTION_RESUME ? curfle->startsize : 0); - - if (curfle->ascii) - { - if (from_data_type != -1) - gftp_set_data_type (transfer->fromreq, from_data_type); - - if (to_data_type != -1) - gftp_set_data_type (transfer->toreq, to_data_type); - } } } @@ -891,8 +889,7 @@ total += num_read; gftp_gtk_calc_kbs (transfer, num_read); - if (GFTP_GET_DATA_TYPE (transfer->fromreq) == GFTP_TYPE_ASCII || - curfle->ascii) + if (dl_type == GFTP_TYPE_ASCII) tempstr = gftp_convert_ascii (buf, &num_read, 1); else tempstr = buf; @@ -906,8 +903,7 @@ /* We don't have to free tempstr for a download because new memory is not allocated for it in that case */ - if ((GFTP_GET_DATA_TYPE (transfer->fromreq) == GFTP_TYPE_ASCII || - curfle->ascii) && + if (dl_type == GFTP_TYPE_ASCII && transfer->transfer_direction == GFTP_DIRECTION_UPLOAD) g_free (tempstr); }