diff src/ui_fileops.c @ 1386:4da6d326919c

Add debug versions of path_to_utf8() and path_from_utf8() which allows to report the caller file and line, this is enabled with --enable-debug-flags (and developer mode too).
author zas_
date Fri, 06 Mar 2009 15:04:35 +0000
parents 721ffb823d6e
children a3d3208b0c50
line wrap: on
line diff
--- a/src/ui_fileops.c	Fri Mar 06 14:53:32 2009 +0000
+++ b/src/ui_fileops.c	Fri Mar 06 15:04:35 2009 +0000
@@ -127,7 +127,11 @@
 	g_string_free(string, TRUE);
 }
 
+#if GQ_DEBUG_PATH_UTF8
+gchar *path_to_utf8_debug(const gchar *path, const gchar *file, gint line)
+#else
 gchar *path_to_utf8(const gchar *path)
+#endif
 {
 	gchar *utf8;
 	GError *error = NULL;
@@ -137,7 +141,11 @@
 	utf8 = g_filename_to_utf8(path, -1, NULL, NULL, &error);
 	if (error)
 		{
+#if GQ_DEBUG_PATH_UTF8
+		log_printf("%s:%d: Unable to convert filename to UTF-8:\n%s\n%s\n", file, line, path, error->message);
+#else
 		log_printf("Unable to convert filename to UTF-8:\n%s\n%s\n", path, error->message);
+#endif
 		g_error_free(error);
 		encoding_dialog(path);
 		}
@@ -150,7 +158,11 @@
 	return utf8;
 }
 
+#if GQ_DEBUG_PATH_UTF8
+gchar *path_from_utf8_debug(const gchar *utf8, const gchar *file, gint line)
+#else
 gchar *path_from_utf8(const gchar *utf8)
+#endif
 {
 	gchar *path;
 	GError *error = NULL;
@@ -160,7 +172,11 @@
 	path = g_filename_from_utf8(utf8, -1, NULL, NULL, &error);
 	if (error)
 		{
+#if GQ_DEBUG_PATH_UTF8
+		log_printf("%s:%d: Unable to convert filename to locale from UTF-8:\n%s\n%s\n", file, line, utf8, error->message);
+#else
 		log_printf("Unable to convert filename to locale from UTF-8:\n%s\n%s\n", utf8, error->message);
+#endif
 		g_error_free(error);
 		}
 	if (!path)