Revision: 1482
          http://geeqie.svn.sourceforge.net/geeqie/?rev=1482&view=rev
Author:   zas_
Date:     2009-03-06 15:04:35 +0000 (Fri, 06 Mar 2009)

Log Message:
-----------
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).

Modified Paths:
--------------
    trunk/configure.in
    trunk/src/ui_fileops.c
    trunk/src/ui_fileops.h

Modified: trunk/configure.in
===================================================================
--- trunk/configure.in  2009-03-06 14:53:32 UTC (rev 1481)
+++ trunk/configure.in  2009-03-06 15:04:35 UTC (rev 1482)
@@ -73,7 +73,7 @@
     CXXFLAGS="${CXXFLAGS} -Wall"
     CFLAGS="${CFLAGS} -Wstrict-prototypes -Wall"
   fi
-  __COMMONFLAGS="-g -O0 -Wextra -Wunused-value -Wunused-variable 
-Wunused-function -Wunused-label -Wcomment -Wmissing-braces -Wparentheses 
-Wreturn-type -Wswitch -Wstrict-aliasing -Wno-unused-parameter -Wformat 
-Wformat-security"
+  __COMMONFLAGS="-g -O0 -Wextra -Wunused-value -Wunused-variable 
-Wunused-function -Wunused-label -Wcomment -Wmissing-braces -Wparentheses 
-Wreturn-type -Wswitch -Wstrict-aliasing -Wno-unused-parameter -Wformat 
-Wformat-security -DGQ_DEBUG_PATH_UTF8=1"
   CXXFLAGS="${CXXFLAGS} ${__COMMONFLAGS}"
   CFLAGS="${CFLAGS} ${__COMMONFLAGS} -Wimplicit-int 
-Werror-implicit-function-declaration"
   __IS_DEBUG_FLAGS=yes

Modified: trunk/src/ui_fileops.c
===================================================================
--- trunk/src/ui_fileops.c      2009-03-06 14:53:32 UTC (rev 1481)
+++ trunk/src/ui_fileops.c      2009-03-06 15:04:35 UTC (rev 1482)
@@ -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)

Modified: trunk/src/ui_fileops.h
===================================================================
--- trunk/src/ui_fileops.h      2009-03-06 14:53:32 UTC (rev 1481)
+++ trunk/src/ui_fileops.h      2009-03-06 15:04:35 UTC (rev 1482)
@@ -31,8 +31,15 @@
                g_free(msg); \
        } while (0)
 
+#if GQ_DEBUG_PATH_UTF8
+#define path_to_utf8(path) path_to_utf8_debug(path, __FILE__, __LINE__)
+#define path_from_utf8(utf8) path_from_utf8_debug(utf8, __FILE__, __LINE__)
+gchar *path_to_utf8_debug(const gchar *path, const gchar *file, gint line);
+gchar *path_from_utf8_debug(const gchar *utf8, const gchar *file, gint line);
+#else
 gchar *path_to_utf8(const gchar *path);
-gchar *path_from_utf8(const gchar *path);
+gchar *path_from_utf8(const gchar *utf8);
+#endif
 
 const gchar *xdg_data_home_get(void);
 const gchar *xdg_config_home_get(void);


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn

Reply via email to