diff playtree.c @ 29263:0f1b5b68af32

whitespace cosmetics: Remove all trailing whitespace.
author diego
date Wed, 13 May 2009 02:58:57 +0000
parents aac3629b180d
children 0d05687720a9
line wrap: on
line diff
--- a/playtree.c	Tue May 12 19:25:35 2009 +0000
+++ b/playtree.c	Wed May 13 02:58:57 2009 +0000
@@ -37,7 +37,7 @@
   assert(pt != NULL);
 #endif
 
-  if(children) {    
+  if(children) {
     for(iter = pt->child; iter != NULL; ) {
       play_tree_t* nxt=iter->next;
       play_tree_free(iter,1);
@@ -78,7 +78,7 @@
     play_tree_free(iter, children);
     iter = nxt;
   }
-    
+
 
 }
 
@@ -130,7 +130,7 @@
 
 void
 play_tree_insert_entry(play_tree_t* pt, play_tree_t* entry) {
-  
+
 #ifdef MP_DEBUG
   assert(pt != NULL);
   assert(entry != NULL);
@@ -144,12 +144,12 @@
 #endif
     entry->next = pt->next;
     entry->next->prev = entry;
-  } else 
+  } else
     entry->next = NULL;
   pt->next = entry;
 
 }
-    
+
 void
 play_tree_remove(play_tree_t* pt, int free_it, int with_children) {
 
@@ -166,7 +166,7 @@
     pt->prev->next = pt->next;
     pt->next->prev = pt->prev;
   } // End of list
-  else if(pt->prev) { 
+  else if(pt->prev) {
 #ifdef MP_DEBUG
     assert(pt->prev->next == pt);
 #endif
@@ -182,7 +182,7 @@
       assert(pt->parent->child == pt);
 #endif
       pt->parent->child = pt->next;
-    } 
+    }
   } // The only one
   else if(pt->parent) {
 #ifdef MP_DEBUG
@@ -210,7 +210,7 @@
   // Attention in using this function!
   for(iter = pt->child ; iter != NULL ; iter = iter->next)
     iter->parent = NULL;
-  
+
   // Go back to first one
   for(iter = child ; iter->prev != NULL ; iter = iter->prev)
     /* NOTHING */;
@@ -244,8 +244,8 @@
   } else
     parent->child = pt;
 
-}  
-  
+}
+
 
 void
 play_tree_add_file(play_tree_t* pt,char* file) {
@@ -258,7 +258,7 @@
   assert(file != NULL);
 #endif
 
-  if(pt->entry_type != PLAY_TREE_ENTRY_NODE && 
+  if(pt->entry_type != PLAY_TREE_ENTRY_NODE &&
      pt->entry_type != PLAY_TREE_ENTRY_FILE)
     return;
 
@@ -437,7 +437,7 @@
 
 //////////////////////////////////// ITERATOR //////////////////////////////////////
 
-static void 
+static void
 play_tree_iter_push_params(play_tree_iter_t* iter) {
   int n;
   play_tree_t* pt;
@@ -456,12 +456,12 @@
   if(pt->params == NULL)
     return;
 
-  
+
   for(n = 0; pt->params[n].name != NULL ; n++) {
     int e;
     if((e = m_config_set_option(iter->config,pt->params[n].name,pt->params[n].value)) < 0) {
       mp_msg(MSGT_PLAYTREE,MSGL_ERR,"Error %d while setting option '%s' with value '%s'\n",e,
-	     pt->params[n].name,pt->params[n].value);      
+	     pt->params[n].name,pt->params[n].value);
     }
   }
 
@@ -478,7 +478,7 @@
   assert(pt != NULL);
   assert(config != NULL);
 #endif
-  
+
   if( ! play_tree_is_valid(pt))
     return NULL;
 
@@ -490,7 +490,7 @@
   iter->root = pt;
   iter->tree = NULL;
   iter->config = config;
- 
+
   if(pt->parent)
     iter->loop = pt->parent->loop;
 
@@ -529,7 +529,7 @@
     if(!(i->flags & PLAY_TREE_RND_PLAYED)) count++;
 
   if(!count) return NULL;
-  
+
   r = (int)((float)(count) * rand() / (RAND_MAX + 1.0));
 
   for(i = head ; i  ; i=i->next) {
@@ -548,7 +548,7 @@
 
   if ( !iter ) return PLAY_TREE_ITER_ENTRY;
   if ( !iter->root ) return PLAY_TREE_ITER_ENTRY;
-  
+
 #ifdef MP_DEBUG
   assert(iter != NULL);
   assert(iter->root != NULL);
@@ -587,7 +587,7 @@
     d = i ? i : -1;
   } else
     pt = iter->tree;
-  
+
   if(pt == NULL) { // No next
     // Must we loop?
     if (iter->mode == PLAY_TREE_ITER_RND) {
@@ -598,7 +598,7 @@
       // try again
       return play_tree_iter_step(iter, 0, with_nodes);
     } else
-    if(iter->tree->parent && iter->tree->parent->loop != 0 && ((d > 0 && iter->loop != 0) || ( d < 0 && (iter->loop < 0 || iter->loop < iter->tree->parent->loop) ) ) ) { 
+    if(iter->tree->parent && iter->tree->parent->loop != 0 && ((d > 0 && iter->loop != 0) || ( d < 0 && (iter->loop < 0 || iter->loop < iter->tree->parent->loop) ) ) ) {
       if(d > 0) { // Go back to the first one
 	for(pt = iter->tree ; pt->prev != NULL; pt = pt->prev)
 	  /* NOTHNG */;
@@ -619,7 +619,7 @@
   // Is there any valid child?
   if(pt->child && play_tree_is_valid(pt->child)) {
     iter->tree = pt;
-    if(with_nodes) { // Stop on the node      
+    if(with_nodes) { // Stop on the node
       return PLAY_TREE_ITER_NODE;
     } else      // Or follow it
       return play_tree_iter_down_step(iter,d,with_nodes);
@@ -639,7 +639,7 @@
 #endif
 
   iter->tree = pt;
-    
+
   for(d = 0 ; iter->tree->files[d] != NULL ; d++)
     /* NOTHING */;
   iter->num_files = d;
@@ -686,7 +686,7 @@
   assert(iter->tree != NULL);
   //printf("PT : Go UP\n");
 #endif
-  
+
   iter->file = -1;
   if(iter->tree->parent == iter->root->parent)
     return PLAY_TREE_ITER_END;
@@ -720,7 +720,7 @@
 
   return play_tree_iter_step(iter,d,with_nodes);
 }
-  
+
 int
 play_tree_iter_down_step(play_tree_iter_t* iter, int d,int with_nodes) {
 
@@ -818,7 +818,7 @@
     iter = iter->next;
     play_tree_cleanup(tmp);
   }
-    
+
   return pt;
 
 }
@@ -860,12 +860,12 @@
 #ifdef MP_DEBUG
   assert(*ppt!=NULL);
 #endif
-  
+
   *ppt=play_tree_cleanup(*ppt);
-  
+
   if(*ppt) {
     r = play_tree_iter_new(*ppt,config);
-    if (r && play_tree_iter_step(r,0,0) != PLAY_TREE_ITER_ENTRY) 
+    if (r && play_tree_iter_step(r,0,0) != PLAY_TREE_ITER_ENTRY)
     {
       play_tree_iter_free(r);
       r = NULL;
@@ -891,9 +891,9 @@
 
   if (iter==NULL)
     return NULL;
-  
+
   r = play_tree_iter_get_file(iter,d);
-  
+
   while (!r && d!=0)
   {
     if (play_tree_iter_step(iter,d,0) != PLAY_TREE_ITER_ENTRY)
@@ -934,7 +934,7 @@
 #ifdef MP_DEBUG
   assert(entry!=NULL);
 #endif
- 
+
   play_tree_add_file(entry, filename);
   if (pt)
     play_tree_append_entry(pt, entry);