changeset 151:2f15b3000dbc

2003-4-27 Brian Masney <masneyb@gftp.org> * lib/config_file.c (gftp_config_file_read_float) - use strtod instead of strtof(). ANSI C describes strtod, and C99 describes strtof(). Some older systems don't have strtof() * lib/gftp.h - if HAVE_OPENPTY is defined, include pty.h. Fix for GFTP_GET_AI_FAMILY when request or request->hostp is NULL. Added free_hostp boolean to struct gftp_request * lib/misc.c src/gtk/delete_dialog.c src/gtk/transfer.c - added copy_local_options parameter. Add a pointer to newreq->hostp from the source request structure * lib/protocols.c - honor free_hostp * lib/rfc959.c - fix for IPV4/IPV6 detection * src/gtk/misc-gtk.c src/gtk/options_dialog.c - fixed compiler errors when compiling against GTK+ 1.2 * src/gtk/transfer.c - lookup option one_transfer instead of do_one_transfer_at_a_time
author masneyb
date Mon, 28 Apr 2003 02:07:19 +0000
parents 662aa96e417c
children 80547e9d0cdf
files ChangeLog lib/config_file.c lib/gftp.h lib/misc.c lib/protocols.c lib/rfc959.c src/gtk/delete_dialog.c src/gtk/misc-gtk.c src/gtk/options_dialog.c src/gtk/transfer.c
diffstat 10 files changed, 61 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Apr 27 14:35:53 2003 +0000
+++ b/ChangeLog	Mon Apr 28 02:07:19 2003 +0000
@@ -1,3 +1,26 @@
+2003-4-27 Brian Masney <masneyb@gftp.org>
+	* lib/config_file.c (gftp_config_file_read_float) - use strtod instead
+	of strtof(). ANSI C describes strtod, and C99 describes strtof(). Some
+	older systems don't have strtof() 
+
+	* lib/gftp.h - if HAVE_OPENPTY is defined, include pty.h. Fix for
+	GFTP_GET_AI_FAMILY when request or request->hostp is NULL. Added
+	free_hostp boolean to struct gftp_request
+
+	* lib/misc.c src/gtk/delete_dialog.c src/gtk/transfer.c - added 
+	copy_local_options parameter. Add a pointer to newreq->hostp from the 
+	source request structure
+
+	* lib/protocols.c - honor free_hostp 
+
+	* lib/rfc959.c - fix for IPV4/IPV6 detection
+
+	* src/gtk/misc-gtk.c src/gtk/options_dialog.c - fixed compiler errors
+	when compiling against GTK+ 1.2
+
+	* src/gtk/transfer.c - lookup option one_transfer instead of 
+	do_one_transfer_at_a_time
+
 2003-04-27  Christian Rose  <menthos@menthos.com>
 
 	* lib/rfc959.c: Fix bug #111090 by adding
@@ -795,7 +818,7 @@
 
 	* cvsclean - added this script
 
-	* *.[ch] - added $Id: ChangeLog,v 1.75 2003/04/27 14:34:15 menthos Exp $ tags
+	* *.[ch] - added $Id: ChangeLog,v 1.76 2003/04/28 02:07:17 masneyb Exp $ tags
 
 	* debian/* - updated files from Debian maintainer
 
--- a/lib/config_file.c	Sun Apr 27 14:35:53 2003 +0000
+++ b/lib/config_file.c	Mon Apr 28 02:07:19 2003 +0000
@@ -905,7 +905,7 @@
 {
   float f;
 
-  f = strtof (str, NULL);
+  f = strtod (str, NULL);
   memcpy (&cv->value, &f, sizeof (cv->value));
   return (0);
 }
--- a/lib/gftp.h	Sun Apr 27 14:35:53 2003 +0000
+++ b/lib/gftp.h	Mon Apr 28 02:07:19 2003 +0000
@@ -80,9 +80,13 @@
 #define AF_LOCAL AF_UNIX
 #endif
 
+#ifdef HAVE_OPENPTY
+#include <pty.h>
+#endif
+
 #ifdef HAVE_GETADDRINFO
 #define HAVE_IPV6
-#define GFTP_GET_AI_FAMILY(request)	(request->hostp->ai_family)
+#define GFTP_GET_AI_FAMILY(request)	(request != NULL && request->hostp != NULL ? request->hostp->ai_family : -1)
 #else
 #define GFTP_GET_AI_FAMILY(request)	AF_INET
 #endif
@@ -308,7 +312,9 @@
 
   int server_type;		/* The type of server we are connected to.
                                    See GFTP_DIRTYPE_* above */
-  unsigned int use_proxy : 1,
+  unsigned int free_hostp : 1, 		/* Should we free the hostp structure 
+					   in gftp_destroy_request() */
+               use_proxy : 1,
                always_connected : 1,
                need_hostport : 1,
                need_userpass : 1,
@@ -615,7 +621,8 @@
 void gftp_copy_local_options 		( gftp_request * dest, 
 					  gftp_request * source );
 
-gftp_request * copy_request 		( gftp_request * req );
+gftp_request * copy_request 		( gftp_request * req,
+					  int copy_local_options );
 
 GList * gftp_sort_filelist 		( GList * filelist, 
 					  int column, 
--- a/lib/misc.c	Sun Apr 27 14:35:53 2003 +0000
+++ b/lib/misc.c	Mon Apr 28 02:07:19 2003 +0000
@@ -581,7 +581,7 @@
 
 
 gftp_request * 
-copy_request (gftp_request * req)
+copy_request (gftp_request * req, int copy_local_options)
 {
   gftp_request * newreq;
 
@@ -600,7 +600,11 @@
   newreq->port = req->port;
   newreq->use_proxy = req->use_proxy;
   newreq->logging_function = req->logging_function;
-  gftp_copy_local_options (newreq, req);
+  newreq->free_hostp = 0;
+  newreq->hostp = req->hostp;
+
+  if (copy_local_options)
+    gftp_copy_local_options (newreq, req);
 
   req->init (newreq);
 
--- a/lib/protocols.c	Sun Apr 27 14:35:53 2003 +0000
+++ b/lib/protocols.c	Mon Apr 28 02:07:19 2003 +0000
@@ -123,7 +123,7 @@
   g_return_if_fail (request != NULL);
 
 #if defined (HAVE_GETADDRINFO) && defined (HAVE_GAI_STRERROR)
-  if (request->hostp)
+  if (request->free_hostp && request->hostp != NULL)
     freeaddrinfo (request->hostp);
 #endif
   request->hostp = NULL;
@@ -773,6 +773,7 @@
 
   request->hostp = NULL;
 #if defined (HAVE_GETADDRINFO) && defined (HAVE_GAI_STRERROR)
+  request->free_hostp = 1;
   memset (&hints, 0, sizeof (hints));
   hints.ai_flags = AI_CANONNAME;
   hints.ai_family = PF_UNSPEC;
@@ -1573,6 +1574,7 @@
   else if (request->use_proxy == 1)
     request->hostp = NULL;
 
+  request->free_hostp = 1;
   memset (&hints, 0, sizeof (hints));
   hints.ai_flags = AI_CANONNAME;
   hints.ai_family = PF_UNSPEC;
--- a/lib/rfc959.c	Sun Apr 27 14:35:53 2003 +0000
+++ b/lib/rfc959.c	Mon Apr 28 02:07:19 2003 +0000
@@ -848,18 +848,13 @@
   g_return_val_if_fail (request->protonum == GFTP_FTP_NUM, GFTP_EFATAL);
   g_return_val_if_fail (request->sockfd > 0, GFTP_EFATAL);
 
-  if (GFTP_GET_AI_FAMILY(request) == AF_INET)
-    return (rfc959_ipv4_data_connection_new (request));
 #ifdef HAVE_IPV6
-  else
+  if (GFTP_GET_AI_FAMILY(request) == AF_INET6)
     return (rfc959_ipv6_data_connection_new (request));
-#else /* Shouldn't happen */
   else
-    {
-      request->logging_function (gftp_logging_error, request->user_data,
-				 _("Error: IPV6 support was not completely compiled in\n"));
-      return (GFTP_EFATAL);
-    }
+    return (rfc959_ipv4_data_connection_new (request));
+#else
+  return (rfc959_ipv4_data_connection_new (request));
 #endif
 }
 
--- a/src/gtk/delete_dialog.c	Sun Apr 27 14:35:53 2003 +0000
+++ b/src/gtk/delete_dialog.c	Mon Apr 28 02:07:19 2003 +0000
@@ -185,7 +185,7 @@
     return;
 
   transfer = g_malloc0 (sizeof (*transfer));
-  transfer->fromreq = copy_request (wdata->request);
+  transfer->fromreq = copy_request (wdata->request, 0);
   transfer->fromwdata = wdata;
   transfer->transfer_direction = GFTP_DIRECTION_DOWNLOAD;
 
--- a/src/gtk/misc-gtk.c	Sun Apr 27 14:35:53 2003 +0000
+++ b/src/gtk/misc-gtk.c	Mon Apr 28 02:07:19 2003 +0000
@@ -109,16 +109,16 @@
   switch (level)
     {
       case gftp_logging_send:
-        color = &send_color;
+        gftp_lookup_global_option ("send_color", &color);
         break;
       case gftp_logging_recv:
-        color = &recv_color;
+        gftp_lookup_global_option ("recv_color", &color);
         break;
       case gftp_logging_error:
-        color = &error_color;
+        gftp_lookup_global_option ("error_color", &color);
         break;
       default:
-        color = &misc_color;
+        gftp_lookup_global_option ("misc_color", &color);
         break;
     }
 
--- a/src/gtk/options_dialog.c	Sun Apr 27 14:35:53 2003 +0000
+++ b/src/gtk/options_dialog.c	Mon Apr 28 02:07:19 2003 +0000
@@ -1152,6 +1152,9 @@
   gftp_config_vars * cv;
   GList * templist;
   int i;
+#if GTK_MAJOR_VERSION == 1
+  GtkWidget * tempwid;
+#endif
 
   memset (&option_data, 0, sizeof (option_data));
   _setup_option (gftp_option_type_text, &option_data, 
--- a/src/gtk/transfer.c	Sun Apr 27 14:35:53 2003 +0000
+++ b/src/gtk/transfer.c	Mon Apr 28 02:07:19 2003 +0000
@@ -422,8 +422,8 @@
     return;
 
   transfer = g_malloc0 (sizeof (*transfer));
-  transfer->fromreq = copy_request (fromwdata->request);
-  transfer->toreq = copy_request (towdata->request);
+  transfer->fromreq = copy_request (fromwdata->request, 0);
+  transfer->toreq = copy_request (towdata->request, 0);
   transfer->transfer_direction = fromwdata == &window2 ? 
                            GFTP_DIRECTION_DOWNLOAD : GFTP_DIRECTION_UPLOAD;
   transfer->fromwdata = fromwdata;
@@ -862,8 +862,8 @@
       tdata = gftp_tdata_new ();
       if (copy_req)
         {
-          tdata->fromreq = copy_request (fromreq);
-          tdata->toreq = copy_request (toreq); 
+          tdata->fromreq = copy_request (fromreq, 0);
+          tdata->toreq = copy_request (toreq, 0); 
         }
       else
         {
@@ -1427,7 +1427,7 @@
 
 	  if (tdata->curfle != NULL)
 	    {
-              gftp_lookup_global_option ("do_one_transfer_at_a_time", 
+              gftp_lookup_global_option ("one_transfer", 
                                          &do_one_transfer_at_a_time);
               start_file_transfers = 1; /* FIXME */