# HG changeset patch # User Matti Hamalainen # Date 1103469903 0 # Node ID 858c09f5901137bc3397d59f2e5c8578bf332561 # Parent 2986069309c6236d3fb7a472bd7e36b9128f11d0 Moved some functions from xs_length.c here. diff -r 2986069309c6 -r 858c09f59011 src/xs_support.c --- 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 + +/* 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) diff -r 2986069309c6 -r 858c09f59011 src/xs_support.h --- 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 #ifdef HAVE_STRING_H #include @@ -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 *);