Mercurial > hg > xmms-sid
diff src/xs_stil.c @ 473:f1a997715ef5
Cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 25 Jan 2007 07:21:05 +0000 |
parents | a1224c1f8670 |
children | 81756f412b43 |
line wrap: on
line diff
--- a/src/xs_stil.c Thu Jan 25 05:58:05 2007 +0000 +++ b/src/xs_stil.c Thu Jan 25 07:21:05 2007 +0000 @@ -35,7 +35,7 @@ if (!pNode) return FALSE; /* Re-allocate subTune structure if needed */ - if (nsubTunes >= pNode->nsubTunes) { + if (nsubTunes > pNode->nsubTunes) { pNode->subTunes = (t_xs_stil_subnode **) g_realloc(pNode->subTunes, (nsubTunes + 1) * sizeof(t_xs_stil_subnode **)); @@ -80,6 +80,7 @@ g_free(pSub->pName); g_free(pSub->pAuthor); g_free(pSub->pInfo); + g_free(pSub->pTitle); g_free(pSub); } @@ -211,10 +212,11 @@ linePos++; if (inLine[linePos] == '#') { linePos++; - if (inLine[linePos]) { + if (isdigit(inLine[linePos])) { + size_t savePos = linePos; xs_findnum(inLine, &linePos); inLine[linePos] = 0; - subEntry = atol(&inLine[2]); + subEntry = atol(&inLine[savePos]); /* Sanity check */ if (subEntry < 1) { @@ -223,10 +225,15 @@ subEntry, tmpNode->pcFilename); subEntry = 0; } + } else { + XS_STILDB_ERR(lineNum, inLine, + "Syntax error, expected subEntry number.\n"); + subEntry = 0; } } else { XS_STILDB_ERR(lineNum, inLine, - "Syntax error, expected subEntry number.\n"); + "Syntax error, expected '#' before subEntry number.\n"); + subEntry = 0; } break; @@ -260,18 +267,18 @@ } /* Some other type */ - if (strncmp(inLine, " NAME:", 8) == 0) { + if (strncmp(inLine, " 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) { + XS_STILDB_MULTI; + g_free(tmpNode->subTunes[subEntry]->pTitle); + tmpNode->subTunes[subEntry]->pTitle = g_strdup(&inLine[9]); } else if (strncmp(inLine, " AUTHOR:", 8) == 0) { XS_STILDB_MULTI; g_free(tmpNode->subTunes[subEntry]->pAuthor); tmpNode->subTunes[subEntry]->pAuthor = g_strdup(&inLine[9]); - } else if (strncmp(inLine, " TITLE:", 8) == 0) { - XS_STILDB_MULTI; - isMulti = TRUE; - xs_pstrcat(&(tmpNode->subTunes[subEntry]->pInfo), &inLine[2]); } else if (strncmp(inLine, " ARTIST:", 8) == 0) { XS_STILDB_MULTI; isMulti = TRUE;