diff Plugins/Container/m3u/m3u.c @ 1617:3de4bd38fe4f trunk

[svn] generic vfs_gets and m3u updated to use vfs
author lu_zero
date Tue, 05 Sep 2006 08:09:14 -0700
parents 3a60eafe91c7
children 07143b97314d
line wrap: on
line diff
--- a/Plugins/Container/m3u/m3u.c	Mon Sep 04 22:36:30 2006 -0700
+++ b/Plugins/Container/m3u/m3u.c	Tue Sep 05 08:09:14 2006 -0700
@@ -31,6 +31,7 @@
 #include <sys/stat.h>
 #include <sys/errno.h>
 
+#include "libaudacious/vfs.h"
 #include "audacious/main.h"
 #include "audacious/util.h"
 #include "audacious/playlist.h"
@@ -74,22 +75,22 @@
 static void
 playlist_load_m3u(const gchar * filename, gint pos)
 {
-    FILE *file;
+    VFSFile *file;
     gchar *line;
     gchar *ext_info = NULL, *ext_title = NULL;
     gsize line_len = 1024;
     gint ext_len = -1;
     gboolean is_extm3u = FALSE;
 
-    if (!(file = fopen(filename, "r")))
+    if ((file = vfs_fopen(filename, "rb")) == NULL)
         return;
 
     line = g_malloc(line_len);
-    while (fgets(line, line_len, file)) {
+    while (vfs_fgets(line, line_len, file)) {
         while (strlen(line) == line_len - 1 && line[strlen(line) - 1] != '\n') {
             line_len += 1024;
             line = g_realloc(line, line_len);
-            fgets(&line[strlen(line)], 1024, file);
+            vfs_fgets(&line[strlen(line)], 1024, file);
         }
 
         while (line[strlen(line) - 1] == '\r' ||
@@ -130,7 +131,7 @@
             pos++;
     }
 
-    fclose(file);
+    vfs_fclose(file);
     g_free(line);
 }