changeset 2213:137187e7a379

make use of AUDDBG() for debug print out.
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Thu, 06 Dec 2007 22:52:00 +0900
parents a13b8f308dce
children 9a869d4bb0d3
files src/tta/libtta.c src/xspf/xspf.c
diffstat 2 files changed, 20 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/src/tta/libtta.c	Thu Dec 06 04:39:14 2007 +0300
+++ b/src/tta/libtta.c	Thu Dec 06 22:52:00 2007 +0900
@@ -28,6 +28,8 @@
  * information.
  */
 
+/* #define AUD_DEBUG 1 */
+
 #include "config.h"
 
 #include <stdio.h>
@@ -695,18 +697,14 @@
                 tp++;
             }
             if(is_num) {
-#ifdef DEBUG
-                printf("is_num!\n");
-#endif
+                AUDDBG("is_num!\n");
                 tmp = g_malloc0(BYTES(end - ptr + 1));
                 memcpy(tmp, ptr, BYTES(end - ptr));
                 *(tmp + (end - ptr)) = 0; //terminate
                 ptr += end - ptr;
 
                 genre = (id3_ucs4_t *)id3_genre_name((const id3_ucs4_t *)tmp);
-#ifdef DEBUG
-                printf("genre length = %d\n", tta_ucs4len(genre));
-#endif
+                AUDDBG("genre length = %d\n", tta_ucs4len(genre));
                 g_free(tmp);
                 tmp = NULL;
 
@@ -718,10 +716,8 @@
                 *(ret + ret_len) = 0; //terminate
             }
             else { // plain text
-#ifdef DEBUG
-                printf("plain!\n");
-                printf("ret_len = %d\n", ret_len);
-#endif
+                AUDDBG("plain!\n");
+                AUDDBG("ret_len = %d\n", ret_len);
                 memcpy(ret + BYTES(ret_len), ptr, BYTES(end - ptr));
                 ret_len = ret_len + (end - ptr);
                 *(ret + ret_len) = 0; //terminate
@@ -796,9 +792,7 @@
     }
     g_free(string);
     string = NULL;
-#ifdef DEBUG
-    g_print("string = %s\n", rtn);
-#endif
+    AUDDBG("string = %s\n", rtn);
 
     return rtn;
 }
--- a/src/xspf/xspf.c	Thu Dec 06 04:39:14 2007 +0300
+++ b/src/xspf/xspf.c	Thu Dec 06 22:52:00 2007 +0900
@@ -18,6 +18,9 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
+
+/* #define AUD_DEBUG 1 */
+
 #include <config.h>
 
 #include <glib.h>
@@ -78,14 +81,6 @@
 
 static const gint xspf_nentries = (sizeof(xspf_entries) / sizeof(xspf_entry_t));
 
-/* we need encoding conversion */
-#ifdef DEBUG
-#  define XSDEBUG(...) { g_print("xspf[%s:%d]: ", __FUNCTION__, (int) __LINE__); g_print(__VA_ARGS__); }
-#else
-#  define XSDEBUG(...) /* stub */
-#endif
-
-
 static gboolean is_uri(gchar *uri)
 {
     if (strstr(uri, "://"))
@@ -203,8 +198,8 @@
 
         aud_tuple_associate_string(tuple, FIELD_FILE_EXT, NULL, strrchr(realfn, '.'));
 
-        XSDEBUG("tuple->file_name = %s\n", aud_tuple_get_string(tuple, FIELD_FILE_NAME, NULL));
-        XSDEBUG("tuple->file_path = %s\n", aud_tuple_get_string(tuple, FIELD_FILE_PATH, NULL));
+        AUDDBG("tuple->file_name = %s\n", aud_tuple_get_string(tuple, FIELD_FILE_NAME, NULL));
+        AUDDBG("tuple->file_path = %s\n", aud_tuple_get_string(tuple, FIELD_FILE_PATH, NULL));
 
         /* add file to playlist */
         aud_playlist_load_ins_file_tuple(playlist, location, filename, pos, tuple);
@@ -259,7 +254,7 @@
 
     g_return_if_fail(filename != NULL);
 
-    XSDEBUG("filename='%s', pos=%d\n", filename, pos);
+    AUDDBG("filename='%s', pos=%d\n", filename, pos);
 
     doc = xmlRecoverFile(filename);
     if (doc == NULL)
@@ -273,7 +268,7 @@
             
             base = (gchar *)xmlNodeGetBase(doc, nptr);
 
-            XSDEBUG("base @1 = %s\n", base);
+            AUDDBG("base = %s\n", base);
             
             // if filename is specified as a base, ignore it.
             tmp = xmlURIUnescapeString(base, -1, NULL);
@@ -285,7 +280,7 @@
                 g_free(tmp);
             }
             
-            XSDEBUG("base @2 = %s\n", base);
+            AUDDBG("base = %s\n", base);
             
             for (nptr2 = nptr->children; nptr2 != NULL; nptr2 = nptr2->next) {
 
@@ -359,7 +354,7 @@
     gchar *base = NULL;
     Playlist *playlist = aud_playlist_get_active();
 
-    XSDEBUG("filename='%s', pos=%d\n", filename, pos);
+    AUDDBG("filename='%s', pos=%d\n", filename, pos);
 
     doc = xmlNewDoc((xmlChar *)"1.0");
     doc->charset = XML_CHAR_ENCODING_UTF8;
@@ -407,7 +402,7 @@
                 g_free(base);
                 base = tmp;
                 baselen = tmplen;
-                XSDEBUG("base='%s', baselen=%d\n", base, baselen);
+                AUDDBG("base='%s', baselen=%d\n", base, baselen);
             } else
                 g_free(tmp);
         }
@@ -424,7 +419,7 @@
             }
 
             if (!is_uri(base)) {
-                XSDEBUG("base is not uri. something is wrong.\n");
+                AUDDBG("base is not uri. something is wrong.\n");
                 tmp = g_strdup_printf("file://%s", base);
                 xmlSetProp(rootnode, (xmlChar *)"xml:base", (xmlChar *)tmp);
                 g_free(tmp);
@@ -471,14 +466,14 @@
         location = xmlNewNode(NULL, (xmlChar *)"location");
 
         if (is_uri(entry->filename)) {   /* uri */
-            XSDEBUG("filename is uri\n");
+            AUDDBG("filename is uri\n");
             filename = g_strdup(entry->filename + baselen); // entry->filename is always uri now.
         } else {                  /* local file (obsolete) */
             gchar *tmp = (gchar *) xspf_path_to_uri((const xmlChar *)entry->filename + baselen);
             if (base) { /* relative */
                 filename = g_strdup_printf("%s", tmp);
             } else {
-                XSDEBUG("absolute and local (obsolete)\n");
+                AUDDBG("absolute and local (obsolete)\n");
                 filename = g_filename_to_uri(tmp, NULL, NULL);
             }
             g_free(tmp);