r16296 - gnucash/trunk/src/import-export/ofx - Fix an ofx import memory leak and a non-ascii-path problem on win32.
Andreas Köhler
andi5 at cvs.gnucash.org
Wed Jul 11 16:51:56 EDT 2007
Author: andi5
Date: 2007-07-11 16:51:54 -0400 (Wed, 11 Jul 2007)
New Revision: 16296
Trac: http://svn.gnucash.org/trac/changeset/16296
Modified:
gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c
Log:
Fix an ofx import memory leak and a non-ascii-path problem on win32.
On Win32, the import file path needs to be converted to the system
codepage for libofx. Also, free it afterwards.
Modified: gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c
===================================================================
--- gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c 2007-07-10 20:51:14 UTC (rev 16295)
+++ gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c 2007-07-11 20:51:54 UTC (rev 16296)
@@ -636,7 +636,7 @@
extern int ofx_ERROR_msg;
extern int ofx_INFO_msg;
extern int ofx_STATUS_msg;
- const char *selected_filename;
+ char *selected_filename;
char *default_dir;
LibofxContextPtr libofx_context = libofx_get_new_context();
@@ -658,6 +658,10 @@
if(selected_filename!=NULL)
{
+#ifdef G_OS_WIN32
+ gchar *conv_name;
+#endif
+
/* Remember the directory as the default. */
default_dir = g_path_get_dirname(selected_filename);
gnc_set_default_directory(GCONF_SECTION, default_dir);
@@ -677,9 +681,15 @@
ofx_set_security_cb(libofx_context, ofx_proc_security_cb, 0);
/*ofx_set_status_cb(libofx_context, ofx_proc_status_cb, 0);*/
+#ifdef G_OS_WIN32
+ conv_name = g_win32_locale_filename_from_utf8(selected_filename);
+ g_free(selected_filename);
+ selected_filename = conv_name;
+#endif
DEBUG("Opening selected file");
- libofx_proc_file(libofx_context, selected_filename, AUTODETECT);
+ libofx_proc_file(libofx_context, selected_filename, AUTODETECT);
+ g_free(selected_filename);
}
}
More information about the gnucash-changes
mailing list