]> git.sesse.net Git - vlc/blobdiff - modules/codec/cmml/xtag.c
Removes trailing spaces. Removes tabs.
[vlc] / modules / codec / cmml / xtag.c
index a9c3a4249e9159e73d2e0d174f87c0351637a63f..70fefb20ad7b9d1197d19da78e5ceeae3861114a 100644 (file)
@@ -3,7 +3,7 @@
  *****************************************************************************
  * Copyright (C) 2003-2004 Commonwealth Scientific and Industrial Research
  *                         Organisation (CSIRO) Australia
- * Copyright (C) 2000-2004 VideoLAN
+ * Copyright (C) 2000-2004 the VideoLAN team
  *
  * $Id$
  *
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 #include "config.h"
 
 #include <ctype.h>
-#include <string.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include <xlist.h>
 
@@ -176,7 +176,7 @@ xtag_skip_to (XTagParser * parser, int char_class)
     }
   }
 
-  return;  
+  return;
 }
 #endif
 
@@ -381,7 +381,7 @@ xtag_parse_tag (XTagParser * parser)
     xtag_assert_and_pass (parser, X_SLASH);
     name = xtag_slurp_to (parser, X_WHITESPACE | X_CLOSETAG, X_NONE);
     if (name) {
-      if (strcmp (name, tag->name)) {
+      if (name && tag->name && strcmp (name, tag->name)) {
 #ifdef XTAG_DEBUG
         printf ("got %s expected %s\n", name, tag->name);
 #endif
@@ -525,7 +525,7 @@ xtag_get_attribute (XTag * xtag, char * attribute)
 
   for (l = xtag->attributes; l; l = l->next) {
     if ((attr = (XAttribute *)l->data) != NULL) {
-      if (!strcmp (attr->name, attribute))
+      if (attr->name && attribute && !strcmp (attr->name, attribute))
         return attr->value;
     }
   }
@@ -551,7 +551,7 @@ xtag_first_child (XTag * xtag, char * name)
   for (; l; l = l->next) {
     child = (XTag *)l->data;
 
-    if (!strcmp(child->name, name)) {
+    if (child->name && name && !strcmp(child->name, name)) {
       xtag->current_child = l;
       return child;
     }
@@ -584,7 +584,7 @@ xtag_next_child (XTag * xtag, char * name)
   for (; l; l = l->next) {
     child = (XTag *)l->data;
 
-    if (!strcmp(child->name, name)) {
+    if (child->name && name && !strcmp(child->name, name)) {
       xtag->current_child = l;
       return child;
     }
@@ -609,7 +609,7 @@ 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);
 
@@ -658,19 +658,19 @@ 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);
     }
-    
     if (xtag->children == NULL) {
       nn = xtag_snprints (buf, n, "/>", NULL);
       FORWARD(nn);
 
       return written;
     }
-    
     nn = xtag_snprints (buf, n, ">", NULL);
     FORWARD(nn);
   }