comparison src/xs_stil.c @ 330:e0abd282d6b7

Changed struct member name subTune -> subTunes
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 22 Sep 2005 01:44:00 +0000
parents dd201740a720
children b1a858b8cb1a
comparison
equal deleted inserted replaced
329:8fadb3f38445 330:e0abd282d6b7
54 gint i; 54 gint i;
55 55
56 if (pNode) 56 if (pNode)
57 { 57 {
58 /* Free subtune information */ 58 /* Free subtune information */
59 for (i = 0; i < XS_STIL_MAXENTRY; i++) 59 for (i = 0; i <= XS_STIL_MAXENTRY; i++)
60 { 60 {
61 g_free(pNode->subTune[i].pName); 61 g_free(pNode->subTunes[i].pName);
62 g_free(pNode->subTune[i].pAuthor); 62 g_free(pNode->subTunes[i].pAuthor);
63 g_free(pNode->subTune[i].pInfo); 63 g_free(pNode->subTunes[i].pInfo);
64 } 64 }
65 65
66 g_free(pNode->pcFilename); 66 g_free(pNode->pcFilename);
67 g_free(pNode); 67 g_free(pNode);
68 } 68 }
90 } 90 }
91 91
92 92
93 /* Read database (additively) to given db-structure 93 /* Read database (additively) to given db-structure
94 */ 94 */
95 #define XS_STILDB_MULTI if (isMulti) { isMulti = FALSE; xs_pstrcat(&(tmpNode->subTune[subEntry].pInfo), "\n"); } 95 #define XS_STILDB_MULTI if (isMulti) { isMulti = FALSE; xs_pstrcat(&(tmpNode->subTunes[subEntry].pInfo), "\n"); }
96 96
97 97
98 gint xs_stildb_read(t_xs_stildb *db, gchar *dbFilename) 98 gint xs_stildb_read(t_xs_stildb *db, gchar *dbFilename)
99 { 99 {
100 FILE *inFile; 100 FILE *inFile;
163 xs_findnum(inLine, &linePos); 163 xs_findnum(inLine, &linePos);
164 inLine[linePos] = 0; 164 inLine[linePos] = 0;
165 subEntry = atol(&inLine[2]); 165 subEntry = atol(&inLine[2]);
166 166
167 /* Sanity check */ 167 /* Sanity check */
168 if ((subEntry < 1) || (subEntry >= XS_STIL_MAXENTRY)) 168 if ((subEntry < 1) || (subEntry > XS_STIL_MAXENTRY))
169 { 169 {
170 XSERR("Number of subEntry (%i) for '%s' is invalid\n", subEntry, tmpNode->pcFilename); 170 XSERR("Number of subEntry (%i) for '%s' is invalid\n", subEntry, tmpNode->pcFilename);
171 subEntry = 0; 171 subEntry = 0;
172 } 172 }
173 } 173 }
200 /* Some other type */ 200 /* Some other type */
201 if (strncmp(inLine, " NAME:", 8) == 0) 201 if (strncmp(inLine, " NAME:", 8) == 0)
202 { 202 {
203 XS_STILDB_MULTI 203 XS_STILDB_MULTI
204 204
205 g_free(tmpNode->subTune[subEntry].pName); 205 g_free(tmpNode->subTunes[subEntry].pName);
206 tmpNode->subTune[subEntry].pName = g_strdup(&inLine[9]); 206 tmpNode->subTunes[subEntry].pName = g_strdup(&inLine[9]);
207 } else 207 } else
208 if (strncmp(inLine, " AUTHOR:", 8) == 0) 208 if (strncmp(inLine, " AUTHOR:", 8) == 0)
209 { 209 {
210 XS_STILDB_MULTI 210 XS_STILDB_MULTI
211 211
212 g_free(tmpNode->subTune[subEntry].pAuthor); 212 g_free(tmpNode->subTunes[subEntry].pAuthor);
213 tmpNode->subTune[subEntry].pAuthor = g_strdup(&inLine[9]); 213 tmpNode->subTunes[subEntry].pAuthor = g_strdup(&inLine[9]);
214 } else 214 } else
215 if (strncmp(inLine, " TITLE:", 8) == 0) 215 if (strncmp(inLine, " TITLE:", 8) == 0)
216 { 216 {
217 XS_STILDB_MULTI 217 XS_STILDB_MULTI
218 218
219 inLine[eolPos++] = '\n'; 219 inLine[eolPos++] = '\n';
220 inLine[eolPos++] = 0; 220 inLine[eolPos++] = 0;
221 xs_pstrcat(&(tmpNode->subTune[subEntry].pInfo), &inLine[2]); 221 xs_pstrcat(&(tmpNode->subTunes[subEntry].pInfo), &inLine[2]);
222 } else 222 } else
223 if (strncmp(inLine, " ARTIST:", 8) == 0) 223 if (strncmp(inLine, " ARTIST:", 8) == 0)
224 { 224 {
225 XS_STILDB_MULTI 225 XS_STILDB_MULTI
226 226
227 inLine[eolPos++] = '\n'; 227 inLine[eolPos++] = '\n';
228 inLine[eolPos++] = 0; 228 inLine[eolPos++] = 0;
229 xs_pstrcat(&(tmpNode->subTune[subEntry].pInfo), &inLine[1]); 229 xs_pstrcat(&(tmpNode->subTunes[subEntry].pInfo), &inLine[1]);
230 } else 230 } else
231 if (strncmp(inLine, "COMMENT:", 8) == 0) 231 if (strncmp(inLine, "COMMENT:", 8) == 0)
232 { 232 {
233 XS_STILDB_MULTI 233 XS_STILDB_MULTI
234 234
235 isMulti = TRUE; 235 isMulti = TRUE;
236 xs_pstrcat(&(tmpNode->subTune[subEntry].pInfo), inLine); 236 xs_pstrcat(&(tmpNode->subTunes[subEntry].pInfo), inLine);
237 } else 237 } else
238 if (strncmp(inLine, " ", 8) == 0) 238 if (strncmp(inLine, " ", 8) == 0)
239 { 239 {
240 xs_pstrcat(&(tmpNode->subTune[subEntry].pInfo), &inLine[8]); 240 xs_pstrcat(&(tmpNode->subTunes[subEntry].pInfo), &inLine[8]);
241 } 241 }
242 break; 242 break;
243 } 243 }
244 244
245 } /* while */ 245 } /* while */