diff lib/config_file.c @ 516:fbb5a02beddb

2004-7-26 Brian Masney <masneyb@gftp.org> * lib/config_file.c lib/local.c lib/ftps.c lib/gftp.h lib/httpcommon.h lib/https.c lib/misc.c lib/protocols.c lib/pty.c lib/rfc2068.c lib/rfc959.c lib/sshv2.c - various fixes found through a static code analysis checker. (some signed/unsigned fixes, removed unneeded casts, removed unneeded variables, more consistency, largefile fixes). Thanks to Derek M Jones for running the static code analysis for me * lib/cache.c - s/remove/del_entry/g * lib/bookmark.c lib/protocols.c (gftp_parse_bookmark) - allow the third parameter of this function to be a NULL pointer
author masneyb
date Tue, 27 Jul 2004 02:46:54 +0000
parents 075f89b4395c
children 990088b18285
line wrap: on
line diff
--- a/lib/config_file.c	Mon Jul 26 09:51:07 2004 +0000
+++ b/lib/config_file.c	Tue Jul 27 02:46:54 2004 +0000
@@ -203,15 +203,15 @@
     {
       len = strlen (buf);
       if (len > 0 && buf[len - 1] == '\n')
-	buf[--len] = '\0';
+        buf[--len] = '\0';
       if (len > 0 && buf[len - 1] == '\r')
-	buf[--len] = '\0';
+        buf[--len] = '\0';
       line++;
 
       if (*buf == '[')
 	{
 	  newentry = g_malloc0 (sizeof (*newentry));
-	  for (; buf[len - 1] == ' ' || buf[len - 1] == ']'; buf[--len] = '\0');
+          for (; buf[len - 1] == ' ' || buf[len - 1] == ']'; buf[--len] = '\0');
 	  newentry->path = g_strdup (buf + 1);
 	  newentry->isfolder = 0;
 	  gftp_add_bookmark (newentry);
@@ -391,17 +391,14 @@
       numargs--;
     }
   va_end (argp);
-  return (1);
+  return (ret);
 }
 
 
 static void *
 gftp_config_read_str (char *buf, int line)
 {
-  char *ret;
-
-  ret = g_strdup (buf);
-  return (ret);
+  return (g_strdup (buf));
 }
 
 
@@ -493,7 +490,7 @@
 }
 
 
-gftp_config_list_vars gftp_config_list[] = {
+static gftp_config_list_vars gftp_config_list[] = {
   {"dont_use_proxy",	gftp_config_read_proxy,	gftp_config_write_proxy, 
    NULL, 0,
    N_("This section specifies which hosts are on the local subnet and won't need to go out the proxy server (if available). Syntax: dont_use_proxy=.domain or dont_use_proxy=network number/netmask")},
@@ -1323,10 +1320,10 @@
       newconfigvar.value = nc_ptr;
       newconfigvar.flags &= ~GFTP_CVARS_FLAGS_DYNMEM;
 
-      ret = gftp_option_types[newconfigvar.otype].compare_function (&newconfigvar, tmpconfigvar);
+      ret = gftp_option_types[tmpconfigvar->otype].compare_function (&newconfigvar, tmpconfigvar);
       if (ret != 0)
         {
-          gftp_option_types[newconfigvar.otype].copy_function (&newconfigvar, tmpconfigvar);
+          gftp_option_types[tmpconfigvar->otype].copy_function (&newconfigvar, tmpconfigvar);
           gftp_configuration_changed = 1;
         }
     }
@@ -1351,7 +1348,7 @@
   newconfigvar.value = nc_ptr;
   newconfigvar.flags &= ~GFTP_CVARS_FLAGS_DYNMEM;
 
-  gftp_option_types[newconfigvar.otype].copy_function (&newconfigvar, cv);
+  gftp_option_types[cv->otype].copy_function (&newconfigvar, cv);
 }
 
 
@@ -1417,7 +1414,7 @@
       memcpy (&newconfigvar.value, &value, sizeof (newconfigvar.value));
       newconfigvar.flags &= ~GFTP_CVARS_FLAGS_DYNMEM;
 
-      ret = gftp_option_types[newconfigvar.otype].compare_function (&newconfigvar, tmpconfigvar);
+      ret = gftp_option_types[tmpconfigvar->otype].compare_function (&newconfigvar, tmpconfigvar);
       if (ret == 0)
         return;