Mercurial > hg > xmms-sid
diff src/xs_support.c @ 452:aec9f4beb401
New file reading functions.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 24 Jan 2007 21:57:04 +0000 |
parents | 33c3bb80d2a5 |
children | 00a32ab5887d |
line wrap: on
line diff
--- a/src/xs_support.c Wed Jan 17 23:38:03 2007 +0000 +++ b/src/xs_support.c Wed Jan 24 21:57:04 2007 +0000 @@ -25,24 +25,50 @@ #include <ctype.h> -/* Bigendian file reading functions +/* File handling */ -guint16 xs_rd_be16(FILE *f) +t_xs_file *xs_fopen(gchar *path, const gchar *mode) +{ + return fopen(path, mode); +} + + +gint xs_fclose(t_xs_file *f) +{ + return fclose(f); +} + + +gint xs_fgetc(t_xs_file *f) +{ + return fgetc(f); +} + + +guint16 xs_fread_be16(t_xs_file *f) { return (((guint16) fgetc(f)) << 8) | ((guint16) fgetc(f)); } -guint32 xs_rd_be32(FILE *f) +guint32 xs_fread_be32(t_xs_file *f) { return (((guint32) fgetc(f)) << 24) | - (((guint32) fgetc(f)) << 16) | (((guint32) fgetc(f)) << 8) | ((guint32) fgetc(f)); + (((guint32) fgetc(f)) << 16) | + (((guint32) fgetc(f)) << 8) | + ((guint32) fgetc(f)); } -size_t xs_rd_str(FILE *f, gchar *s, size_t l) +size_t xs_fread(void *p, size_t s, size_t n, t_xs_file *f) { - return fread(s, sizeof(gchar), l, f); + return fread(p, s, n, f); +} + + +gint xs_fgets(gchar *s, gint l, t_xs_file *f) +{ + return fgets(s, l, f); }