Mercurial > hg > xmms-sid
diff src/xs_support.c @ 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 | df4cb5115322 |
children | 608f31f6c095 |
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)