# HG changeset patch # User Matti Hamalainen # Date 1172496842 0 # Node ID 4333288a0168f4f2926cfa0e91e68374abe656bc # Parent 0810886950191b90d61b6f61e8cf6efddcacb5b9 Some changes to accomodate for Audacious differences. diff -r 081088695019 -r 4333288a0168 src/xs_stil.c --- a/src/xs_stil.c Fri Feb 23 06:02:01 2007 +0000 +++ b/src/xs_stil.c Mon Feb 26 13:34:02 2007 +0000 @@ -160,6 +160,7 @@ t_xs_stil_node *tmpNode; gboolean isError, isMulti; gint subEntry; + gchar *tmpLine = inLine; assert(db); /* Try to open the file */ @@ -183,12 +184,12 @@ inLine[eolPos] = 0; lineNum++; - switch (inLine[0]) { + switch (tmpLine[0]) { case '/': /* Check if we are already parsing entry */ isMulti = FALSE; if (tmpNode) { - XS_STILDB_ERR(lineNum, inLine, + XS_STILDB_ERR(lineNum, tmpLine, "New entry found before end of current ('%s')!\n", tmpNode->pcFilename); xs_stildb_node_free(tmpNode); @@ -196,10 +197,10 @@ /* A new node */ subEntry = 0; - tmpNode = xs_stildb_node_new(inLine); + tmpNode = xs_stildb_node_new(tmpLine); if (!tmpNode) { /* Allocation failed */ - XS_STILDB_ERR(lineNum, inLine, + XS_STILDB_ERR(lineNum, tmpLine, "Could not allocate new STILdb-node!\n"); isError = TRUE; } @@ -209,28 +210,28 @@ /* A new sub-entry */ isMulti = FALSE; linePos++; - if (inLine[linePos] == '#') { + if (tmpLine[linePos] == '#') { linePos++; - if (isdigit(inLine[linePos])) { + if (isdigit(tmpLine[linePos])) { size_t savePos = linePos; - xs_findnum(inLine, &linePos); - inLine[linePos] = 0; - subEntry = atol(&inLine[savePos]); + xs_findnum(tmpLine, &linePos); + tmpLine[linePos] = 0; + subEntry = atol(&tmpLine[savePos]); /* Sanity check */ if (subEntry < 1) { - XS_STILDB_ERR(lineNum, inLine, + XS_STILDB_ERR(lineNum, tmpLine, "Number of subEntry (%i) for '%s' is invalid\n", subEntry, tmpNode->pcFilename); subEntry = 0; } } else { - XS_STILDB_ERR(lineNum, inLine, + XS_STILDB_ERR(lineNum, tmpLine, "Syntax error, expected subEntry number.\n"); subEntry = 0; } } else { - XS_STILDB_ERR(lineNum, inLine, + XS_STILDB_ERR(lineNum, tmpLine, "Syntax error, expected '#' before subEntry number.\n"); subEntry = 0; } @@ -253,44 +254,44 @@ default: /* Check if we are parsing an entry */ if (!tmpNode) { - XS_STILDB_ERR(lineNum, inLine, + XS_STILDB_ERR(lineNum, tmpLine, "Entry data encountered outside of entry or syntax error!\n"); break; } if (!xs_stildb_node_realloc(tmpNode, subEntry)) { - XS_STILDB_ERR(lineNum, inLine, + XS_STILDB_ERR(lineNum, tmpLine, "Could not (re)allocate memory for subEntries!\n"); isError = TRUE; break; } /* Some other type */ - if (strncmp(inLine, " NAME:", 8) == 0) { + if (strncmp(tmpLine, " NAME:", 8) == 0) { XS_STILDB_MULTI; g_free(tmpNode->subTunes[subEntry]->pName); - tmpNode->subTunes[subEntry]->pName = g_strdup(&inLine[9]); - } else if (strncmp(inLine, " TITLE:", 8) == 0) { + tmpNode->subTunes[subEntry]->pName = g_strdup(&tmpLine[9]); + } else if (strncmp(tmpLine, " TITLE:", 8) == 0) { XS_STILDB_MULTI; g_free(tmpNode->subTunes[subEntry]->pTitle); - tmpNode->subTunes[subEntry]->pTitle = g_strdup(&inLine[9]); - } else if (strncmp(inLine, " AUTHOR:", 8) == 0) { + tmpNode->subTunes[subEntry]->pTitle = g_strdup(&tmpLine[9]); + } else if (strncmp(tmpLine, " AUTHOR:", 8) == 0) { XS_STILDB_MULTI; g_free(tmpNode->subTunes[subEntry]->pAuthor); - tmpNode->subTunes[subEntry]->pAuthor = g_strdup(&inLine[9]); - } else if (strncmp(inLine, " ARTIST:", 8) == 0) { + tmpNode->subTunes[subEntry]->pAuthor = g_strdup(&tmpLine[9]); + } else if (strncmp(tmpLine, " ARTIST:", 8) == 0) { XS_STILDB_MULTI; isMulti = TRUE; - xs_pstrcat(&(tmpNode->subTunes[subEntry]->pInfo), &inLine[1]); - } else if (strncmp(inLine, "COMMENT:", 8) == 0) { + xs_pstrcat(&(tmpNode->subTunes[subEntry]->pInfo), &tmpLine[1]); + } else if (strncmp(tmpLine, "COMMENT:", 8) == 0) { XS_STILDB_MULTI; isMulti = TRUE; - xs_pstrcat(&(tmpNode->subTunes[subEntry]->pInfo), inLine); - } else if (strncmp(inLine, " ", 8) == 0) { + xs_pstrcat(&(tmpNode->subTunes[subEntry]->pInfo), tmpLine); + } else if (strncmp(tmpLine, " ", 8) == 0) { if (isMulti) { - xs_pstrcat(&(tmpNode->subTunes[subEntry]->pInfo), &inLine[8]); + xs_pstrcat(&(tmpNode->subTunes[subEntry]->pInfo), &tmpLine[8]); } else { - XS_STILDB_ERR(lineNum, inLine, + XS_STILDB_ERR(lineNum, tmpLine, "Entry continuation found when isMulti == FALSE.\n"); } }