# HG changeset patch # User Matti Hamalainen # Date 1352147952 -7200 # Node ID 61a527ac3baa9af70ae9ed629fcc1fd79d962ae7 # Parent 03c5cde1dfbbf9223254dd15aed158c4be660ffe Cleanups, remove useless function. diff -r 03c5cde1dfbb -r 61a527ac3baa src/xmms-sid.c --- a/src/xmms-sid.c Mon Nov 05 22:38:41 2012 +0200 +++ b/src/xmms-sid.c Mon Nov 05 22:39:12 2012 +0200 @@ -200,7 +200,7 @@ } /* Detect just by checking filename extension */ - ext = xs_strrchr(filename, '.'); + ext = strrchr(filename, '.'); if (ext) { ext++; switch (xs_cfg.playerEngine) { diff -r 03c5cde1dfbb -r 61a527ac3baa src/xs_slsup.c --- a/src/xs_slsup.c Mon Nov 05 22:38:41 2012 +0200 +++ b/src/xs_slsup.c Mon Nov 05 22:39:12 2012 +0200 @@ -100,8 +100,8 @@ if (xs_cfg.stilDBEnable && xs_stildb_db) { if (xs_cfg.hvscPath) { /* Remove postfixed directory separator from HVSC-path */ - tmpFilename = xs_strrchr(xs_cfg.hvscPath, '/'); - if (tmpFilename && (tmpFilename[1] == 0)) + tmpFilename = strrchr(xs_cfg.hvscPath, '/'); + if (tmpFilename && tmpFilename[1] == 0) tmpFilename[0] = 0; /* Remove HVSC location-prefix from filename */ diff -r 03c5cde1dfbb -r 61a527ac3baa src/xs_support.c --- a/src/xs_support.c Mon Nov 05 22:38:41 2012 +0200 +++ b/src/xs_support.c Mon Nov 05 22:39:12 2012 +0200 @@ -32,10 +32,11 @@ guint32 xs_fread_be32(XSFile *f) { - return (((guint32) xs_fgetc(f)) << 24) | + return + (((guint32) xs_fgetc(f)) << 24) | (((guint32) xs_fgetc(f)) << 16) | (((guint32) xs_fgetc(f)) << 8) | - ((guint32) xs_fgetc(f)); + ((guint32) xs_fgetc(f)); } @@ -45,17 +46,21 @@ { XSFile *f; glong seekPos; - - /* Open file, get file size */ + + if (filename == NULL) + return -15; + if ((f = xs_fopen(filename, "rb")) == NULL) return -1; xs_fseek(f, 0, SEEK_END); seekPos = xs_ftell(f); - if (seekPos > 0) { + if (seekPos > 0) + { size_t readSize = seekPos; - if (readSize >= *bufSize || *buf == NULL) { + if (readSize >= *bufSize || *buf == NULL) + { /* Only re-allocate if the required size > current */ if (*buf != NULL) { g_free(*buf); @@ -175,20 +180,6 @@ /* Locate character in string */ -gchar *xs_strrchr(gchar *str, const gchar ch) -{ - gchar *lastPos = NULL; - - while (*str) { - if (*str == ch) - lastPos = str; - str++; - } - - return lastPos; -} - - void xs_findnext(const gchar *str, size_t *pos) { while (str[*pos] && isspace(str[*pos])) diff -r 03c5cde1dfbb -r 61a527ac3baa src/xs_support.h --- a/src/xs_support.h Mon Nov 05 22:38:41 2012 +0200 +++ b/src/xs_support.h Mon Nov 05 22:39:12 2012 +0200 @@ -96,7 +96,6 @@ gint xs_pstrcpy(gchar **, const gchar *); gint xs_pstrcat(gchar **, const gchar *); void xs_pnstrcat(gchar *, size_t, const gchar *); -gchar *xs_strrchr(gchar *, const gchar); void xs_findnext(const gchar *, size_t *); void xs_findeol(const gchar *, size_t *); void xs_findnum(const gchar *, size_t *); diff -r 03c5cde1dfbb -r 61a527ac3baa src/xs_title.c --- a/src/xs_title.c Mon Nov 05 22:38:41 2012 +0200 +++ b/src/xs_title.c Mon Nov 05 22:39:12 2012 +0200 @@ -31,21 +31,21 @@ /* Split the filename into path */ *tmpFilePath = g_strdup(path); - tmpStr = xs_strrchr(*tmpFilePath, '/'); + tmpStr = strrchr(*tmpFilePath, '/'); if (tmpStr) tmpStr[1] = 0; /* Filename */ - *tmpFilename = xs_strrchr(path, '/'); + *tmpFilename = strrchr(path, '/'); if (*tmpFilename) *tmpFilename = g_strdup(*tmpFilename + 1); else *tmpFilename = g_strdup(path); - tmpStr = xs_strrchr(*tmpFilename, '.'); + tmpStr = strrchr(*tmpFilename, '.'); tmpStr[0] = 0; /* Extension */ - *tmpFileExt = xs_strrchr(path, '.'); + *tmpFileExt = strrchr(path, '.'); }