# HG changeset patch # User Matti Hamalainen # Date 1149080405 0 # Node ID 933b9ea5923e56e0dd984dddc58a0452768b03d2 # Parent c4e5604a82577172ab2d888da980758576632deb Cleanups. diff -r c4e5604a8257 -r 933b9ea5923e src/xs_support.c --- a/src/xs_support.c Wed May 31 12:59:04 2006 +0000 +++ b/src/xs_support.c Wed May 31 13:00:05 2006 +0000 @@ -27,20 +27,20 @@ /* Bigendian file reading functions */ -guint16 xs_rd_be16(FILE * f) +guint16 xs_rd_be16(FILE *f) { return (((guint16) fgetc(f)) << 8) | ((guint16) fgetc(f)); } -guint32 xs_rd_be32(FILE * 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) +size_t xs_rd_str(FILE *f, gchar *s, size_t l) { return fread(s, sizeof(gchar), l, f); } @@ -48,7 +48,7 @@ /* Copy a string */ -gchar *xs_strncpy(gchar * pDest, gchar * pSource, size_t n) +gchar *xs_strncpy(gchar *pDest, gchar *pSource, size_t n) { gchar *s, *d; size_t i; @@ -81,7 +81,7 @@ /* Copy a given string over in *ppResult. */ -gint xs_pstrcpy(gchar ** ppResult, const gchar * pStr) +gint xs_pstrcpy(gchar **ppResult, const gchar *pStr) { /* Check the string pointers */ if (!ppResult || !pStr) @@ -103,7 +103,7 @@ /* Concatenates a given string into string pointed by *ppResult. */ -gint xs_pstrcat(gchar ** ppResult, const gchar * pStr) +gint xs_pstrcat(gchar **ppResult, const gchar *pStr) { /* Check the string pointers */ if (!ppResult || !pStr) @@ -128,7 +128,7 @@ /* Concatenate a given string up to given dest size or \n. * If size max is reached, change the end to "..." */ -void xs_pnstrcat(gchar * pDest, size_t iSize, gchar * pStr) +void xs_pnstrcat(gchar *pDest, size_t iSize, gchar *pStr) { size_t i, n; gchar *s, *d; @@ -166,7 +166,7 @@ /* Locate character in string */ -gchar *xs_strrchr(gchar * pcStr, gchar ch) +gchar *xs_strrchr(gchar *pcStr, gchar ch) { gchar *lastPos = NULL; @@ -180,21 +180,21 @@ } -void xs_findnext(gchar * pcStr, guint * piPos) +void xs_findnext(gchar *pcStr, guint *piPos) { while (pcStr[*piPos] && isspace(pcStr[*piPos])) (*piPos)++; } -void xs_findeol(gchar * pcStr, guint * piPos) +void xs_findeol(gchar *pcStr, guint *piPos) { while (pcStr[*piPos] && (pcStr[*piPos] != '\n') && (pcStr[*piPos] != '\r')) (*piPos)++; } -void xs_findnum(gchar * pcStr, guint * piPos) +void xs_findnum(gchar *pcStr, guint *piPos) { while (pcStr[*piPos] && isdigit(pcStr[*piPos])) (*piPos)++; diff -r c4e5604a8257 -r 933b9ea5923e src/xs_support.h --- a/src/xs_support.h Wed May 31 12:59:04 2006 +0000 +++ b/src/xs_support.h Wed May 31 13:00:05 2006 +0000 @@ -20,6 +20,10 @@ #include #endif +#ifndef HAVE_FSEEKO +#define fseeko fseek +#define ftello ftell +#endif /* * Functions @@ -27,6 +31,7 @@ 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 *);