diff src/gtk/options_dialog.c @ 219:b9584a877daf

2003-7-9 Brian Masney <masneyb@gftp.org> * lib/sshv2.c - if we are logging in to the server, and the message size is too big from the server, assume that an error message follows and log the ASCII text to the log window * src/gtk/options_dialog.c - make sure the value is set properly for the textcomboedt option types (the FTP proxy server type uses this) * lib/rfc2068.c - HTTP proxy bug fixes. Also, moved rfc2068_connect() call to rfc2068_send_command() and removed it from the now unneeded places. Also, fix in call to HEAD command * src/text/gftp-text.c - fixed NULL pointer deference in changing directory * docs/sample.gftp/gftprc - enable require SSH user/pass by default
author masneyb
date Wed, 09 Jul 2003 23:25:57 +0000
parents de6a2e8e51cb
children a85a097bbb02
line wrap: on
line diff
--- a/src/gtk/options_dialog.c	Wed Jul 09 23:25:56 2003 +0000
+++ b/src/gtk/options_dialog.c	Wed Jul 09 23:25:57 2003 +0000
@@ -286,6 +286,7 @@
 
   ret = g_strdup ("");
   len = 0;
+
   for (stpos = str; 
        (endpos = strstr (stpos, "%n")) != NULL;
        stpos = endpos + 2)
@@ -301,6 +302,13 @@
       *endpos = savechar;
     }
 
+  if (stpos != NULL && *stpos != '\0')
+    {
+      len += strlen (stpos);
+      ret = g_realloc (ret, len + 1);
+      strcat (ret, stpos);
+    }
+
   return (ret);
 }
 
@@ -313,6 +321,7 @@
 
   ret = g_strdup ("");
   len = 0;
+
   for (stpos = str; 
        (endpos = strchr (stpos, '\n')) != NULL;
        stpos = endpos + 1)
@@ -328,6 +337,13 @@
       *endpos = savechar;
     }
 
+  if (stpos != NULL && *stpos != '\0')
+    {
+      len += strlen (stpos);
+      ret = g_realloc (ret, len + 1);
+      strcat (ret, stpos);
+    }
+
   return (ret);
 }
 
@@ -463,13 +479,11 @@
     {
       wcstombs (tmp, (wchar_t *) GTK_TEXT (widdata->text)->text.wc, sizeof (tmp));
       newstr = tmp;
-      freeit = 0;
     }
   else
-    {
-      newstr = (char *) GTK_TEXT (widdata->text)->text.ch; 
-      freeit = 0;
-    }
+    newstr = (char *) GTK_TEXT (widdata->text)->text.ch; 
+
+  freeit = 0;
 #else
   textbuf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widdata->text));
   len = gtk_text_buffer_get_char_count (textbuf);