diff src/gtk/transfer.c @ 58:c01d91c10f6c

2002-11-20 Brian Masney <masneyb@gftp.org> * lib/protocols.c lib/gftp.h - added gftp_get_line(), gftp_read(), gftp_write(), gftp_writefmt(), and gftp_set_sockblocking() functions. Added struct_gftp_getline_buffer for gftp_get_line function() * lib/cache.c lib/gftp.h lib/local.c lib/misc.c lib/protocols.c lib/rfc2068.c lib/rfc959.c lib/ssh.c lib/sshv2.c - *_get_file() returns off_t instead of long. *_{get,put}_next_file_chunk returns ssize_t instead of size_t. Added *_set_config_options function to gftp_request structure and protocol files. Use the new network functions documented above. Convert usage of ANSI C IO (FILE *) to standard BSD sockets so that I can use timeouts properly with select * lib/misc.c (ssh_start_login_sequence) - use gftp_set_sockblock(), gftp_read() and gftp_write() functions * lib/protocols.c - move some protocol specific code to the protocol specific files * lib/local.c - log succesful messages to gftp_logging_misc instead of gftp_logging_error * lib/cache.c - log some more error conditions to the user * lib/rfc959.c - added rfc959_getcwd(). In, rfc959_accept_active_connection(), set set socket to blocking mode before calling accept() * src/text/gftk-text.c - If we get no files in gftp_text_ls(), return instead of segfaulting * src/gtk/gftp-gtk.c - expand the port field in the toolbar to be 45 pixels wide * src/text/gftp-text.c src/gtk/misc-gtk.c src/gtk/transfer.c src/gtk/view_dialog.c - changes for conversion of request->{sock,data} from ANSI C IO (FILE *) to standard BSD sockets
author masneyb
date Thu, 21 Nov 2002 00:33:51 +0000
parents a12bcbc2fce4
children 618423504fe0
line wrap: on
line diff
--- a/src/gtk/transfer.c	Tue Nov 12 00:04:44 2002 +0000
+++ b/src/gtk/transfer.c	Thu Nov 21 00:33:51 2002 +0000
@@ -41,7 +41,6 @@
 
   if (socketpair (AF_UNIX, SOCK_STREAM, 0, request->wakeup_main_thread) == 0)
     {
-      /* FIXME - depreciated in GDK 2.0 */
       handler = gdk_input_add (request->wakeup_main_thread[0], 
                                GDK_INPUT_READ, wakeup_main_thread, request);
     }
@@ -60,7 +59,6 @@
 {
   if (request->wakeup_main_thread[0] > 0 && request->wakeup_main_thread[1] > 0)
     {
-      /* FIXME - depreciated in GDK 2.0 */
       gdk_input_remove (handler);
       close (request->wakeup_main_thread[0]);
       close (request->wakeup_main_thread[1]);
@@ -733,7 +731,7 @@
 {
   gftp_transfer * transfer;
   char *tempstr, buf[8192];
-  FILE * tofd, * fromfd;
+  int tofd, fromfd;
   off_t fromsize, total;
   gftp_file * curfle; 
   ssize_t num_read;
@@ -794,18 +792,18 @@
               if (transfer->transfer_direction == GFTP_DIRECTION_DOWNLOAD)
                 {
                   tofd = curfle->fd;
-                  fromfd = NULL;
+                  fromfd = -1;
                 }
               else
                 {
-                  tofd = NULL;
+                  tofd = -1;
                   fromfd = curfle->fd;
                 }
             }
           else
             {
-              tofd = NULL;
-              fromfd = NULL;
+              tofd = -1;
+              fromfd = -1;
             }
 
           if (curfle->size == 0)
@@ -840,9 +838,9 @@
           if (curfle->is_fd)
             {
               if (transfer->transfer_direction == GFTP_DIRECTION_DOWNLOAD)
-                transfer->toreq->datafd = NULL;
+                transfer->toreq->datafd = -1;
               else
-                transfer->fromreq->datafd = NULL;
+                transfer->fromreq->datafd = -1;
             }
 
           pthread_mutex_lock (transfer->structmutex);
@@ -917,9 +915,9 @@
           if (curfle->is_fd)
             {
               if (transfer->transfer_direction == GFTP_DIRECTION_DOWNLOAD)
-                transfer->toreq->datafd = NULL;
+                transfer->toreq->datafd = -1;
               else
-                transfer->fromreq->datafd = NULL;
+                transfer->fromreq->datafd = -1;
             }
 
           if (gftp_end_transfer (transfer->fromreq) != 0)
@@ -1239,7 +1237,7 @@
       tempfle = tdata->updfle->data;
 
       if (tempfle->is_fd)
-        fd = fileno (tempfle->fd);
+        fd = tempfle->fd;
       else
         fd = 0;
 
@@ -1251,8 +1249,8 @@
 
           if (tempfle->is_fd)
             {
-              fclose (tempfle->fd);
-              tempfle->fd = NULL;
+              close (tempfle->fd);
+              tempfle->fd = -1;
             }
         }
       else if (tempfle->done_edit)
@@ -1263,8 +1261,8 @@
 
           if (tempfle->is_fd)
             {
-              fclose (tempfle->fd);
-              tempfle->fd = NULL;
+              close (tempfle->fd);
+              tempfle->fd = -1;
             }
         }
       else if (tempfle->done_rm)
@@ -1409,8 +1407,8 @@
     {
       fromreq = tdata->fromwdata != NULL ? ((gftp_window_data *) tdata->fromwdata)->request : NULL;
       if (!tdata->fromreq->stopable && tdata->fromwdata &&
-          ((fromreq->sockfd == NULL && fromreq->cached) ||
-           fromreq->always_connected) && tdata->fromreq->sockfd != NULL &&
+          ((fromreq->sockfd < 0 && fromreq->cached) ||
+           fromreq->always_connected) && tdata->fromreq->sockfd > 0 &&
           compare_request (tdata->fromreq, fromreq, 0))
 	{
           swap_socks (((gftp_window_data *) tdata->towdata)->request, 
@@ -1464,7 +1462,7 @@
   if (!tdata->fromreq->stopable)
     {
       if (tdata->fromwdata && 
-          ((gftp_window_data *) tdata->fromwdata)->request->sockfd != NULL && 
+          ((gftp_window_data *) tdata->fromwdata)->request->sockfd > 0 && 
           !((gftp_window_data *) tdata->fromwdata)->request->stopable &&
           compare_request (tdata->fromreq, ((gftp_window_data *) tdata->fromwdata)->request, 0))
 	{