r15068 - gnucash/trunk/src/gnome-utils - Fix gnc_history_generate_label to search for the correct dir separator

Andreas Köhler andi5 at cvs.gnucash.org
Wed Nov 1 15:45:36 EST 2006


Author: andi5
Date: 2006-11-01 15:45:35 -0500 (Wed, 01 Nov 2006)
New Revision: 15068
Trac: http://svn.gnucash.org/trac/changeset/15068

Modified:
   gnucash/trunk/src/gnome-utils/gnc-plugin-file-history.c
Log:
Fix gnc_history_generate_label to search for the correct dir separator
and not to crash when there is none.


Modified: gnucash/trunk/src/gnome-utils/gnc-plugin-file-history.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-plugin-file-history.c	2006-11-01 19:36:06 UTC (rev 15067)
+++ gnucash/trunk/src/gnome-utils/gnc-plugin-file-history.c	2006-11-01 20:45:35 UTC (rev 15068)
@@ -251,17 +251,19 @@
 	  dst += g_sprintf(result, "_%d ", (index + 1) % 10);
 
 	/* Find the filename portion of the path */
-	src = g_utf8_strrchr(filename, -1, '/');
-	src = g_utf8_next_char(src);
+	src = g_utf8_strrchr(filename, -1, G_DIR_SEPARATOR);
+	if (src) {
+	  src = g_utf8_next_char(src);
 
-	/* Fix up any underline characters so they aren't mistaken as
-	 * command accelerator keys. */
-	for ( ; *src; src = g_utf8_next_char(src)) {
-	  unichar = g_utf8_get_char(src);
-	  dst += g_unichar_to_utf8 (unichar, dst);
+	  /* Fix up any underline characters so they aren't mistaken as
+	   * command accelerator keys. */
+	  for ( ; *src; src = g_utf8_next_char(src)) {
+	    unichar = g_utf8_get_char(src);
+	    dst += g_unichar_to_utf8 (unichar, dst);
 
-	  if (unichar == '_')
-	    dst += g_unichar_to_utf8 ('_', dst);
+	    if (unichar == '_')
+	      dst += g_unichar_to_utf8 ('_', dst);
+	  }
 	}
 
 	*dst = '\0';



More information about the gnucash-changes mailing list