diff lib/protocols.c @ 830:afbe37351940

2006-10-19 Brian Masney <masneyb@gftp.org> WARNING: The CVS version of gFTP is currently broken, especially for international users. This will be fixed in a few days. * src/gtk/gtkui.c src/gtk/gtkui_transfer.c src/gtk/misc-gtk.c lib/gftp.h lib/misc.c lib/protocols.c - removed code that converts the filename to UTF8. This will be handled by the library. Removed utf8_file member from the gftp_file structure. * lib/rfc959.c - convert the file or directory from UTF8 to the proper locale when sending a command to the server. * src/uicommon/gftpui.c src/gtk/menu-items.c lib/misc.c lib/gftp.h (gftp_gen_ls_string) - convert the filename from UTF8 to the proper locale before it is displayed to the user.
author masneyb
date Thu, 19 Oct 2006 11:41:04 +0000
parents 92ba2b1e144a
children f2772ac00751
line wrap: on
line diff
--- a/lib/protocols.c	Sun Oct 15 18:45:06 2006 +0000
+++ b/lib/protocols.c	Thu Oct 19 11:41:04 2006 +0000
@@ -106,8 +106,6 @@
 
   if (file->file)
     g_free (file->file);
-  if (file->utf8_file)
-    g_free (file->utf8_file);
   if (file->user)
     g_free (file->user);
   if (file->group)
@@ -594,7 +592,7 @@
 gftp_get_next_file (gftp_request * request, const char *filespec,
                     gftp_file * fle)
 {
-  char *slashpos, *newfile;
+  char *slashpos, *tmpfile, *utf8;
   int fd, ret;
 
   g_return_val_if_fail (request != NULL, GFTP_EFATAL);
@@ -621,20 +619,28 @@
             }
 
           *slashpos = '\0';
-          newfile = g_strdup (slashpos + 1);
+          tmpfile = g_strdup (slashpos + 1);
 
           if (strcmp (fle->file, request->directory) != 0)
             request->logging_function (gftp_logging_error, request,
                                        _("Warning: Stripping path off of file '%s'. The stripped path (%s) doesn't match the current directory (%s)\n"),
-                                       newfile, fle->file, request->directory,
+                                       tmpfile, fle->file, request->directory,
                                        g_strerror (errno));
           
           g_free (fle->file);
-          fle->file = newfile;
+          fle->file = tmpfile;
         }
 
       if (ret >= 0 && fle->file != NULL)
-        fle->utf8_file = gftp_string_to_utf8 (request, fle->file);
+        {
+          utf8 = gftp_string_to_utf8 (request, fle->file);
+          if (utf8 != NULL)
+            {
+              tmpfile = fle->file;
+              fle->file = utf8;
+              g_free (tmpfile);
+            }
+        }
 
       if (ret >= 0 && !request->cached && request->cachefd > 0 && 
           request->last_dir_entry != NULL)