]> git.sesse.net Git - vlc/blobdiff - modules/misc/xml/xtag.c
Another bunch of useless test.
[vlc] / modules / misc / xml / xtag.c
index 416f59e3042c8f989759adbb47f2dcc68949ecbc..7cab50b62a1fe70c822d25c24ed6ea5f98e0eb9b 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <vlc/vlc.h>
 
 #include "vlc_xml.h"
@@ -34,7 +38,6 @@
 
 #include <ctype.h>
 #include <stdarg.h>
-#include <stdio.h>
 
 #undef XTAG_DEBUG
 
@@ -110,8 +113,10 @@ static void CatalogAdd( xml_t *, const char *, const char *, const char * );
 
 static XTag *xtag_new_parse( const char *, int );
 static char *xtag_get_name( XTag * );
+#if 0
 static char *xtag_get_pcdata( XTag * );
 static char *xtag_get_attribute( XTag *, char * );
+#endif
 static XTag *xtag_first_child( XTag *, char * );
 static XTag *xtag_next_child( XTag *, char * );
 static XTag *xtag_free( XTag * );
@@ -138,6 +143,7 @@ static int Open( vlc_object_t *p_this )
  *****************************************************************************/
 static void Close( vlc_object_t *p_this )
 {
+    VLC_UNUSED(p_this);
     return;
 }
 
@@ -146,12 +152,15 @@ static void Close( vlc_object_t *p_this )
  *****************************************************************************/
 static void CatalogLoad( xml_t *p_xml, const char *psz_filename )
 {
+    VLC_UNUSED(psz_filename);
     msg_Dbg( p_xml, "catalog support not implemented" );
 }
 
 static void CatalogAdd( xml_t *p_xml, const char *psz_arg1,
                           const char *psz_arg2, const char *psz_filename )
 {
+    VLC_UNUSED(p_xml); VLC_UNUSED(psz_arg1); VLC_UNUSED(psz_arg2);
+    VLC_UNUSED(psz_filename);
 }
 
 /*****************************************************************************
@@ -176,7 +185,8 @@ static xml_reader_t *ReaderCreate( xml_t *p_xml, stream_t *s )
         i_pos += i_size;
         i_buffer += i_size;
         p_new = realloc( p_buffer, i_buffer );
-        if (!p_new) {
+        if( !p_new )
+        {
             msg_Err( p_xml, "out of memory" );
             free( p_buffer );
             return NULL;
@@ -228,6 +238,7 @@ static void ReaderDelete( xml_reader_t *p_reader )
 
 static int ReaderUseDTD ( xml_reader_t *p_reader, vlc_bool_t b_use )
 {
+    VLC_UNUSED(p_reader); VLC_UNUSED(b_use);
     return VLC_EGENERIC;
 }
 
@@ -346,7 +357,7 @@ static XList *xlist_append( XList *list, void *data )
         if( last->next == NULL ) break;
 
     if( last ) last->next = l;
-    l->prev = last; 
+    l->prev = last;
     return list;
 }
 
@@ -555,7 +566,7 @@ static XTag *xtag_parse_tag( XTagParser *parser )
     char *name;
     char *pcdata;
     char *s;
-        int xi;
+     int xi;
 
     if( !parser->valid ) return NULL;
 
@@ -563,7 +574,7 @@ static XTag *xtag_parse_tag( XTagParser *parser )
 
     /* if this starts a comment tag, skip until end */
     if( (parser->end - parser->start) > 7 &&
-                 xtag_cin( s[0], X_OPENTAG ) && xtag_cin( s[1], X_EMARK ) &&
+          xtag_cin( s[0], X_OPENTAG ) && xtag_cin( s[1], X_EMARK ) &&
         xtag_cin( s[2], X_DASH ) && xtag_cin( s[3], X_DASH ) )
     {
         parser->start = s = &s[4];
@@ -582,7 +593,7 @@ static XTag *xtag_parse_tag( XTagParser *parser )
 
     /* ignore processing instructions '<?' ... '?>' */
     if( (parser->end - parser->start) > 4 &&
-                 xtag_cin( s[0], X_OPENTAG ) && xtag_cin( s[1], X_QMARK ) )
+          xtag_cin( s[0], X_OPENTAG ) && xtag_cin( s[1], X_QMARK ) )
     {
         parser->start = s = &s[2];
         while ((xi = xtag_index( parser, X_QMARK )) >= 0) {
@@ -597,7 +608,7 @@ static XTag *xtag_parse_tag( XTagParser *parser )
 
     /* ignore doctype  '<!DOCTYPE' ... '>' */
     if ( (parser->end - parser->start) > 8 &&
-                       !strncmp( s, "<!DOCTYPE", 9 ) ) {
+            !strncmp( s, "<!DOCTYPE", 9 ) ) {
         xi = xtag_index( parser, X_CLOSETAG );
         if ( xi > 0 ) {
             parser->start = s = &s[xi+1];
@@ -627,8 +638,8 @@ static XTag *xtag_parse_tag( XTagParser *parser )
         return NULL;
 
     /* parse CDATA content */
-    if ( (parser->end - parser->start) > 8 && 
-                       !strncmp( s, "<![CDATA[", 9 ) ) {
+    if ( (parser->end - parser->start) > 8 &&
+            !strncmp( s, "<![CDATA[", 9 ) ) {
         parser->start = s = &s[9];
         while (parser->end - s > 2) {
             if (strncmp( s, "]]>", 3 ) == 0) {
@@ -734,15 +745,15 @@ static XTag *xtag_free( XTag *xtag )
 
     if( xtag == NULL ) return NULL;
 
-    if( xtag->name ) free( xtag->name );
-    if( xtag->pcdata ) free( xtag->pcdata );
+    free( xtag->name );
+    free( xtag->pcdata );
 
     for( l = xtag->attributes; l; l = l->next )
     {
         if( (attr = (XAttribute *)l->data) != NULL )
         {
-            if( attr->name ) free( attr->name );
-            if( attr->value ) free( attr->value );
+            free( attr->name );
+            free( attr->value );
             free( attr );
         }
     }
@@ -774,7 +785,7 @@ static XTag *xtag_new_parse( const char *s, int n )
     {
 #ifdef XTAG_DEBUG
         printf ("empty buffer");
-#endif        
+#endif
         return NULL;
     }
     else parser.end = (char *)&s[n];
@@ -833,6 +844,7 @@ static char *xtag_get_name( XTag *xtag )
     return xtag ? xtag->name : NULL;
 }
 
+#if 0
 static char *xtag_get_pcdata( XTag *xtag )
 {
     XList *l;
@@ -869,6 +881,7 @@ static char *xtag_get_attribute( XTag *xtag, char *attribute )
 
     return NULL;
 }
+#endif
 
 static XTag *xtag_first_child( XTag *xtag, char *name )
 {
@@ -947,7 +960,7 @@ static int xtag_snprints( char *buf, int n, ... )
     int len, to_copy, total = 0;
 
     va_start( ap, n );
-  
     for( s = va_arg( ap, char * ); s; s = va_arg( ap, char *) )
     {
         len = strlen (s);
@@ -1001,7 +1014,7 @@ static int xtag_snprint( char *buf, int n, XTag *xtag )
         for( l = xtag->attributes; l; l = l->next )
         {
             attr = (XAttribute *)l->data;
-      
             nn = xtag_snprints( buf, n, " ", attr->name, "=\"", attr->value,
                                 "\"", NULL);
             FORWARD( nn );