Mercurial > hg > xmms-sid
changeset 226:858c09f59011
Moved some functions from xs_length.c here.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 19 Dec 2004 15:25:03 +0000 |
parents | 2986069309c6 |
children | 92bad4c7b998 |
files | src/xs_support.c src/xs_support.h |
diffstat | 2 files changed, 29 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/xs_support.c Wed Dec 15 18:47:01 2004 +0000 +++ b/src/xs_support.c Sun Dec 19 15:25:03 2004 +0000 @@ -23,6 +23,31 @@ #include "xs_support.h" #include <ctype.h> + +/* Bigendian file reading functions + */ +guint16 xs_rd_be16(FILE *f) +{ + return (((guint16) fgetc(f)) << 8) | + ((guint16) fgetc(f)); +} + + +guint32 xs_rd_be32(FILE *f) +{ + return (((guint32) fgetc(f)) << 24) | + (((guint32) fgetc(f)) << 16) | + (((guint32) fgetc(f)) << 8) | + ((guint32) fgetc(f)); +} + + +size_t xs_rd_str(FILE *f, gchar *s, size_t l) +{ + return fread(s, sizeof(gchar), l, f); +} + + /* Copy a string */ gchar *xs_strncpy(gchar *pDest, gchar *pSource, size_t n)
--- a/src/xs_support.h Wed Dec 15 18:47:01 2004 +0000 +++ b/src/xs_support.h Sun Dec 19 15:25:03 2004 +0000 @@ -6,6 +6,7 @@ #endif #include "xmms-sid.h" +#include <stdio.h> #ifdef HAVE_STRING_H #include <string.h> @@ -27,6 +28,9 @@ /* * Functions */ +guint16 xs_rd_be16(FILE *); +guint32 xs_rd_be32(FILE *); +size_t xs_rd_str(FILE *, gchar *, size_t); gchar *xs_strncpy(gchar *, gchar *, size_t); gint xs_pstrcpy(gchar **, const gchar *); gint xs_pstrcat(gchar **, const gchar *);