fix limit usage on library file load
authorMaksym Veremeyenko <verem@m1stereo.tv>
Wed, 5 Oct 2011 13:31:08 +0000 (16:31 +0300)
committerMaksym Veremeyenko <verem@m1stereo.tv>
Wed, 5 Oct 2011 13:31:08 +0000 (16:31 +0300)
src/library.c
src/whois.c

index db9ff24..a7a44a4 100644 (file)
@@ -128,7 +128,7 @@ int omnplay_library_load_file(playlist_item_t* items, int *pcount, char* filenam
     /* open and process file */
     if((f = fopen(filename, "rt")))
     {
-        while( !feof(f) && c < (limit -1))
+        while(!feof(f) && c < limit)
         {
             char *s, *sp_r, *sp_b;
 
@@ -158,7 +158,9 @@ int omnplay_library_load_file(playlist_item_t* items, int *pcount, char* filenam
 
                 /* insert item */
                 items[c++] = item;
-            };
+            }
+            else
+                g_warning("omnplay_library_load_file: ignored line [%s]\n", l);
         }
 
         fclose(f);
@@ -171,6 +173,8 @@ int omnplay_library_load_file(playlist_item_t* items, int *pcount, char* filenam
 
     *pcount = c;
 
+    g_warning("omnplay_library_load_file: loaded [%d] items from [%s] file, limit [%d]\n", c, filename, limit);
+
     return r;
 };
 
@@ -206,8 +210,8 @@ static void omnplay_library_save_file(playlist_item_t* item, int count, char* fi
                 frames2tc(item[i].in, 25.0, tc_in),
                 frames2tc(item[i].dur, 25.0, tc_dur),
                 item[i].title);
-
         fclose(f);
+        g_warning("omnplay_library_save_file: written [%d] lines to file [%s]\n", count, filename);
     };
 };
 
index dc4d3f8..844e6e7 100644 (file)
@@ -55,6 +55,8 @@ static int save_list(playlist_item_t* item, int count, char* filename)
                 frames2tc(item[i].dur, 25.0, tc_dur));
 
         fclose(f);
+
+        g_warning("whois.c: save_list: filename=[%s], count=[%d]\n", filename, count);
     }
     else
         r = 1;