changeset 466:00a32ab5887d

Moved some things from xmms-sid.h to xs_support.h; File handling functions for possible portability to Audacious (they already created their own patch for vfs support, though)
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 25 Jan 2007 03:44:01 +0000
parents ba98fdac6307
children 9dafc55c4270
files src/xs_support.c src/xs_support.h
diffstat 2 files changed, 23 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/xs_support.c	Thu Jan 25 03:42:05 2007 +0000
+++ b/src/xs_support.c	Thu Jan 25 03:44:01 2007 +0000
@@ -20,14 +20,13 @@
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
-#include "xmms-sid.h"
 #include "xs_support.h"
 #include <ctype.h>
 
 
 /* File handling
  */
-t_xs_file *xs_fopen(gchar *path, const gchar *mode)
+t_xs_file *xs_fopen(const gchar *path, const gchar *mode)
 {
 	return fopen(path, mode);
 }
@@ -66,9 +65,15 @@
 }
 
 
-gint xs_fgets(gchar *s, gint l, t_xs_file *f)
+gint xs_feof(t_xs_file *f)
 {
-	return fgets(s, l, f);
+	return feof(f);
+}
+
+
+gint xs_ferror(t_xs_file *f)
+{
+	return ferror(f);
 }
 
 
--- a/src/xs_support.h	Thu Jan 25 03:42:05 2007 +0000
+++ b/src/xs_support.h	Thu Jan 25 03:44:01 2007 +0000
@@ -5,9 +5,19 @@
 extern "C" {
 #endif
 
-#include "xmms-sid.h"
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
 #include <stdio.h>
 
+#ifdef HAVE_ASSERT_H
+#include <assert.h>
+#else
+#define assert(x) /* stub */
+#endif
+
 #ifdef HAVE_STRING_H
 #include <string.h>
 #else
@@ -31,14 +41,14 @@
 
 /* Functions
  */
-t_xs_file *xs_fopen(gchar *, const gchar *);
+t_xs_file *xs_fopen(const gchar *, const gchar *);
 gint	xs_fclose(t_xs_file *);
 gint	xs_fgetc(t_xs_file *);
 guint16 xs_fread_be16(t_xs_file *);
 guint32 xs_fread_be32(t_xs_file *);
 size_t	xs_fread(void *, size_t, size_t, t_xs_file *);
-gint	xs_fgets(gchar *, gint, t_xs_file *);
-
+gint	xs_feof(t_xs_file *);
+gint	xs_ferror(t_xs_file *);
 
 gchar	*xs_strncpy(gchar *, gchar *, size_t);
 gint	xs_pstrcpy(gchar **, const gchar *);