# HG changeset patch # User Matti Hamalainen # Date 1056241024 0 # Node ID 6a3ce7260ae17a42871c9e9360d066cc670f80ed # Parent e3708b2bbc5f493311b6a3ed89093f9ef323f3a8 Changed some standard functions to glib ones diff -r e3708b2bbc5f -r 6a3ce7260ae1 src/xmms-sid.cc --- a/src/xmms-sid.cc Sat Jun 21 22:11:02 2003 +0000 +++ b/src/xmms-sid.cc Sun Jun 22 00:17:04 2003 +0000 @@ -64,10 +64,12 @@ typedef struct SidTuneInfo t_xs_tuneinfo; #endif + static GtkWidget *xs_ctrlwin = NULL; static pthread_t xs_decode_thread; struct t_xs_cfg xs_cfg; + struct { gboolean isError, isPlaying, allowNext; gint currSong, nSongs; @@ -195,20 +197,21 @@ delete testTune; return TRUE; #endif + #ifdef HAVE_SIDPLAY2 #endif } /* Detect just by checking filename extension */ - pcExt = strrchr(fileName, '.'); + pcExt = xs_strrchr(fileName, '.'); if (pcExt) { pcExt++; - if (!strcasecmp(pcExt, "psid")) return TRUE; - if (!strcasecmp(pcExt, "sid")) return TRUE; - if (!strcasecmp(pcExt, "dat")) return TRUE; - if (!strcasecmp(pcExt, "inf")) return TRUE; - if (!strcasecmp(pcExt, "info")) return TRUE; + if (!g_strcasecmp(pcExt, "psid")) return TRUE; + if (!g_strcasecmp(pcExt, "sid")) return TRUE; + if (!g_strcasecmp(pcExt, "dat")) return TRUE; + if (!g_strcasecmp(pcExt, "inf")) return TRUE; + if (!g_strcasecmp(pcExt, "info")) return TRUE; } return FALSE; diff -r e3708b2bbc5f -r 6a3ce7260ae1 src/xs_length.c --- a/src/xs_length.c Sat Jun 21 22:11:02 2003 +0000 +++ b/src/xs_length.c Sun Jun 22 00:17:04 2003 +0000 @@ -45,7 +45,7 @@ t_xs_dbentry *pResult; /* Allocate memory for new node */ - pResult = (t_xs_dbentry *) calloc(1, sizeof(t_xs_dbentry)); + pResult = (t_xs_dbentry *) g_malloc0(sizeof(t_xs_dbentry)); if (pResult == NULL) return NULL; return pResult; @@ -325,13 +325,9 @@ if (xs_cfg.songlenDBPath == NULL) return -10; -fprintf(stderr, "reading '%s'\n", xs_cfg.songlenDBPath); - if (xs_db_read(xs_cfg.songlenDBPath, &xs_database) < 0) return -9; -fprintf(stderr, "read_done, now size DB for index\n"); - /* Get size of db */ pCurr = xs_database; xs_dbnodes = 0; @@ -344,9 +340,8 @@ /* Check number of nodes */ if (xs_dbnodes > 0) { -fprintf(stderr, "allocating %i nodes...\n", xs_dbnodes); /* Allocate memory for index-table */ - xs_dbindex = (t_xs_dbentry **) malloc(sizeof(t_xs_dbentry *) * xs_dbnodes); + xs_dbindex = (t_xs_dbentry **) g_malloc(sizeof(t_xs_dbentry *) * xs_dbnodes); if (xs_dbindex == NULL) return -6; /* Get node-pointers to table */ @@ -358,7 +353,6 @@ pCurr = pCurr->pNext; } -fprintf(stderr, "sorting!\n"); /* Sort the indexes */ qsort(xs_dbindex, xs_dbnodes, sizeof(t_xs_dbentry *), xs_db_cmp); } @@ -487,7 +481,7 @@ fseek(inFile, psidH.dataOffset, SEEK_SET); /* Allocate memory */ - songData = (guint8 *) malloc(sizeof(guint8) * songDataLen); + songData = (guint8 *) g_malloc(sizeof(guint8) * songDataLen); if (songData == NULL) { fclose(inFile); @@ -575,8 +569,9 @@ } } } - -// XSDEBUG("fname='%s', sub=%i, res=%i\n", fileName, subTune, iResult); +#if 0 + XSDEBUG("fname='%s', sub=%i, res=%i\n", fileName, subTune, iResult); +#endif return iResult; } diff -r e3708b2bbc5f -r 6a3ce7260ae1 src/xs_support.c --- a/src/xs_support.c Sat Jun 21 22:11:02 2003 +0000 +++ b/src/xs_support.c Sun Jun 22 00:17:04 2003 +0000 @@ -83,6 +83,20 @@ } +gchar *xs_strrchr(gchar *pcStr, gchar ch) +{ + gchar *lastPos = NULL; + + while (*pcStr) + { + if (*pcStr == ch) lastPos = pcStr; + pcStr++; + } + + return lastPos; +} + + inline void xs_findnext(gchar *pcStr, gint *piPos) { /* Terminating NULL-character is not whitespace! */ diff -r e3708b2bbc5f -r 6a3ce7260ae1 src/xs_support.h --- a/src/xs_support.h Sat Jun 21 22:11:02 2003 +0000 +++ b/src/xs_support.h Sun Jun 22 00:17:04 2003 +0000 @@ -13,10 +13,10 @@ gint xs_strcalloc(gchar **, const gchar *); gint xs_strcat(gchar **, const gchar *); gint xs_strpcat(gchar **, gint *, const gchar *); +gchar *xs_strrchr(gchar *, gchar); inline void xs_findnext(gchar *, gint *); inline void xs_findnum(gchar *, gint *); - #ifdef __cplusplus } #endif