[vlc-devel] commit: Fix compilation warning (const variables) ( Rémi Duraffort )

git version control git at videolan.org
Sun Nov 30 16:50:33 CET 2008


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Sun Nov 30 16:50:06 2008 +0100| [8eb251e543d7e02c8942e1ff831231de440be790] | committer: Rémi Duraffort 

Fix compilation warning (const variables)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8eb251e543d7e02c8942e1ff831231de440be790
---

 modules/codec/cmml/cmml.c |    8 ++--
 modules/codec/cmml/xtag.c |   74 +++++++++++++++++++++++---------------------
 modules/codec/cmml/xtag.h |    4 +-
 3 files changed, 45 insertions(+), 41 deletions(-)

diff --git a/modules/codec/cmml/cmml.c b/modules/codec/cmml/cmml.c
index 69763a5..e5d7b8b 100644
--- a/modules/codec/cmml/cmml.c
+++ b/modules/codec/cmml/cmml.c
@@ -267,8 +267,8 @@ static void ParseText( decoder_t *p_dec, block_t *p_block )
         val.p_address = psz_tmp;
         if( var_Set( p_dec, "psz-current-anchor-url", val ) != VLC_SUCCESS )
         {
-            (void) var_Create( p_dec, "psz-current-anchor-url",
-                               VLC_VAR_ADDRESS|VLC_VAR_DOINHERIT );
+            var_Create( p_dec, "psz-current-anchor-url",
+                        VLC_VAR_ADDRESS | VLC_VAR_DOINHERIT );
             msg_Dbg( p_dec, "creating psz-current-anchor-url" );
             if( var_Set( p_dec, "psz-current-anchor-url", val ) != VLC_SUCCESS )
                 msg_Dbg( p_dec, "var_Set of psz-current-anchor-url failed" );
@@ -282,8 +282,8 @@ static void ParseText( decoder_t *p_dec, block_t *p_block )
         val.p_address = psz_tmp;
         if( var_Set( p_dec, "psz-current-anchor-description", val ) != VLC_SUCCESS )
         {
-            (void) var_Create( p_dec, "psz-current-anchor-description",
-                               VLC_VAR_ADDRESS|VLC_VAR_DOINHERIT );
+            var_Create( p_dec, "psz-current-anchor-description",
+                        VLC_VAR_ADDRESS | VLC_VAR_DOINHERIT );
             msg_Dbg( p_dec, "creating psz-current-anchor-description" );
             if( var_Set( p_dec, "psz-current-anchor-description", val ) != VLC_SUCCESS )
                 msg_Dbg( p_dec, "var_Set of psz-current-anchor-description failed" );
diff --git a/modules/codec/cmml/xtag.c b/modules/codec/cmml/xtag.c
index 3cfd13b..1378378 100644
--- a/modules/codec/cmml/xtag.c
+++ b/modules/codec/cmml/xtag.c
@@ -83,8 +83,8 @@ void   xtag_free (XTag * xtag);
 XTag * xtag_new_parse (const char * s, int n);
 char * xtag_get_name (XTag * xtag);
 char * xtag_get_pcdata (XTag * xtag);
-char * xtag_get_attribute (XTag * xtag, char * attribute);
-XTag * xtag_first_child (XTag * xtag, char * name);
+char * xtag_get_attribute (XTag * xtag, const char* attribute);
+XTag * xtag_first_child (XTag * xtag, const char * name);
 XTag * xtag_next_child (XTag * xtag, char * name);
 int    xtag_snprint (char * buf, int n, XTag * xtag);
 
@@ -521,51 +521,55 @@ xtag_get_pcdata (XTag * xtag)
   return NULL;
 }
 
-char *
-xtag_get_attribute (XTag * xtag, char * attribute)
+char* xtag_get_attribute (XTag * xtag, const char * attribute)
 {
-  XList * l;
-  XAttribute * attr;
-
-  if (xtag == NULL) return NULL;
-
-  for (l = xtag->attributes; l; l = l->next) {
-    if ((attr = (XAttribute *)l->data) != NULL) {
-      if (attr->name && attribute && !strcmp (attr->name, attribute))
-        return attr->value;
+    XList * l;
+    XAttribute * attr;
+
+    if( !xtag )
+        return NULL;
+
+    for( l = xtag->attributes; l; l = l->next )
+    {
+        if( ( attr = (XAttribute *)l->data ) != NULL )
+        {
+            if( attr->name && attribute && !strcmp( attr->name, attribute ) )
+                return attr->value;
+        }
     }
-  }
-
-  return NULL;
+    return NULL;
 }
 
-XTag *
-xtag_first_child (XTag * xtag, char * name)
+XTag* xtag_first_child (XTag * xtag, const char * name)
 {
-  XList * l;
-  XTag * child;
+    XList * l;
+    XTag * child;
 
-  if (xtag == NULL) return NULL;
+    if( !xtag )
+        return NULL;
 
-  if ((l = xtag->children) == NULL) return NULL;
+    if( ( l = xtag->children ) == NULL )
+        return NULL;
 
-  if (name == NULL) {
-    xtag->current_child = l;
-    return (XTag *)l->data;
-  }
+    if( !name )
+    {
+        xtag->current_child = l;
+        return (XTag *)l->data;
+    }
 
-  for (; l; l = l->next) {
-    child = (XTag *)l->data;
+    for( ; l; l = l->next )
+    {
+        child = (XTag *)l->data;
 
-    if (child->name && name && !strcmp(child->name, name)) {
-      xtag->current_child = l;
-      return child;
+        if( child->name && name && !strcmp( child->name, name ) )
+        {
+            xtag->current_child = l;
+            return child;
+        }
     }
-  }
 
-  xtag->current_child = NULL;
-
-  return NULL;
+    xtag->current_child = NULL;
+    return NULL;
 }
 
 XTag *
diff --git a/modules/codec/cmml/xtag.h b/modules/codec/cmml/xtag.h
index 0c99969..e9579af 100644
--- a/modules/codec/cmml/xtag.h
+++ b/modules/codec/cmml/xtag.h
@@ -36,9 +36,9 @@ char * xtag_get_name (XTag * xtag);
 
 char * xtag_get_pcdata (XTag * xtag);
 
-char * xtag_get_attribute (XTag * xtag, char * attribute);
+char * xtag_get_attribute (XTag * xtag, const char * attribute);
 
-XTag * xtag_first_child (XTag * xtag, char * name);
+XTag * xtag_first_child (XTag * xtag, const char * name);
 
 XTag * xtag_next_child (XTag * xtag, char * name);
 




More information about the vlc-devel mailing list