Mercurial > hg > xmms-sid
annotate src/xs_stil.c @ 392:b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
structures. Indentation cleanups, etc.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 31 May 2006 10:02:00 +0000 |
parents | 4611f1194941 |
children | b571000e1f8c |
rev | line source |
---|---|
1 | 1 /* |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
101
diff
changeset
|
2 XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS) |
1 | 3 |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
101
diff
changeset
|
4 STIL-database handling functions |
1 | 5 |
324 | 6 Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org> |
7 (C) Copyright 1999-2005 Tecnic Software productions (TNSP) | |
1 | 8 |
9 This program is free software; you can redistribute it and/or modify | |
10 it under the terms of the GNU General Public License as published by | |
11 the Free Software Foundation; either version 2 of the License, or | |
12 (at your option) any later version. | |
13 | |
14 This program is distributed in the hope that it will be useful, | |
15 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 GNU General Public License for more details. | |
18 | |
19 You should have received a copy of the GNU General Public License | |
20 along with this program; if not, write to the Free Software | |
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
22 */ | |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
23 #include "xs_stil.h" |
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
24 #include "xs_support.h" |
230 | 25 #include "xs_config.h" |
1 | 26 #include <stdio.h> |
223
16e3b2446a73
On some systems stdlib.h has prerequisite of stdio.h, corrected order of
Matti Hamalainen <ccr@tnsp.org>
parents:
214
diff
changeset
|
27 #include <stdlib.h> |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
28 #include <ctype.h> |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
29 #include <stdarg.h> |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
30 |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
101
diff
changeset
|
31 |
227
92bad4c7b998
Improved modularization of STIL and song-length database subsystems.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
32 /* Database handling functions |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
33 */ |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
34 static gboolean xs_stildb_node_realloc(t_xs_stil_node *pNode, gint nsubTunes) |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
35 { |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
36 if (!pNode) return FALSE; |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
37 |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
38 /* Re-allocate subTune structure if needed */ |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
39 if (nsubTunes >= pNode->nsubTunes) { |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
40 pNode->subTunes = |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
41 (t_xs_stil_subnode **) g_realloc(pNode->subTunes, |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
42 (nsubTunes + 1) * sizeof(t_xs_stil_subnode **)); |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
43 |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
44 if (!pNode->subTunes) |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
45 return FALSE; |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
46 |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
47 /* Clear the newly allocated memory */ |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
48 memset(&(pNode->subTunes[pNode->nsubTunes]), 0, |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
49 (nsubTunes + 1 - pNode->nsubTunes) * |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
50 sizeof(t_xs_stil_subnode **)); |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
51 } |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
52 |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
53 /* Allocate memory for subTune */ |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
54 if (!pNode->subTunes[nsubTunes]) { |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
55 pNode->subTunes[nsubTunes] = (t_xs_stil_subnode *) |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
56 g_malloc0(sizeof(t_xs_stil_subnode)); |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
57 |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
58 if (!pNode->subTunes[nsubTunes]) |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
59 return FALSE; |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
60 } |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
61 |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
62 return TRUE; |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
63 } |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
64 |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
65 |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
66 static void xs_stildb_node_free(t_xs_stil_node *pNode) |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
67 { |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
68 gint i; |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
69 t_xs_stil_subnode *pSub; |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
70 |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
71 if (pNode) { |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
72 /* Free subtune information */ |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
73 for (i = 0; i < pNode->nsubTunes; i++) { |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
74 pSub = pNode->subTunes[i]; |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
75 if (pSub) { |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
76 g_free(pSub->pName); |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
77 g_free(pSub->pAuthor); |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
78 g_free(pSub->pInfo); |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
79 |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
80 g_free(pSub); |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
81 } |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
82 } |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
83 |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
84 g_free(pNode->subTunes); |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
85 g_free(pNode->pcFilename); |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
86 g_free(pNode); |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
87 } |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
88 } |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
89 |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
90 |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
91 static t_xs_stil_node *xs_stildb_node_new(gchar *pcFilename) |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
92 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
93 t_xs_stil_node *pResult; |
227
92bad4c7b998
Improved modularization of STIL and song-length database subsystems.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
94 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
95 /* Allocate memory for new node */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
96 pResult = (t_xs_stil_node *) g_malloc0(sizeof(t_xs_stil_node)); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
97 if (!pResult) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
98 return NULL; |
227
92bad4c7b998
Improved modularization of STIL and song-length database subsystems.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
99 |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
100 /* Allocate filename and initial space for one subtune */ |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
101 pResult->pcFilename = g_strdup(pcFilename); |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
102 if (!pResult->pcFilename || !xs_stildb_node_realloc(pResult, 1)) { |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
103 xs_stildb_node_free(pResult); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
104 return NULL; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
105 } |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
106 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
107 return pResult; |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
108 } |
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
109 |
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
110 |
227
92bad4c7b998
Improved modularization of STIL and song-length database subsystems.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
111 /* Insert given node to db linked list |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
112 */ |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
113 static void xs_stildb_node_insert(t_xs_stildb *db, t_xs_stil_node *pNode) |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
114 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
115 assert(db); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
116 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
117 if (db->pNodes) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
118 /* The first node's pPrev points to last node */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
119 LPREV = db->pNodes->pPrev; /* New node's prev = Previous last node */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
120 db->pNodes->pPrev->pNext = pNode; /* Previous last node's next = New node */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
121 db->pNodes->pPrev = pNode; /* New last node = New node */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
122 LNEXT = NULL; /* But next is NULL! */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
123 } else { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
124 db->pNodes = pNode; /* First node ... */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
125 LPREV = pNode; /* ... it's also last */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
126 LNEXT = NULL; /* But next is NULL! */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
127 } |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
128 } |
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
129 |
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
130 |
227
92bad4c7b998
Improved modularization of STIL and song-length database subsystems.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
131 /* Read database (additively) to given db-structure |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
132 */ |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
133 #define XS_STILDB_MULTI \ |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
134 if (isMulti) { \ |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
135 isMulti = FALSE; \ |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
136 xs_pstrcat(&(tmpNode->subTunes[subEntry]->pInfo), "\n");\ |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
137 } |
240
f436e16fa6d9
Fixed cosmetic bug in handling of multi-line fields (COMMENT).
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
138 |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
139 void XS_STILDB_ERR(gint lineNum, gchar *inLine, const char *fmt, ...) |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
140 { |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
141 va_list ap; |
240
f436e16fa6d9
Fixed cosmetic bug in handling of multi-line fields (COMMENT).
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
142 |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
143 va_start(ap, fmt); |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
144 xs_error(fmt, ap); |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
145 va_end(ap); |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
146 |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
147 fprintf(stderr, "#%d: '%s'\n", lineNum, inLine); |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
148 } |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
149 |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
150 gint xs_stildb_read(t_xs_stildb *db, gchar *dbFilename) |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
151 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
152 FILE *inFile; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
153 gchar inLine[XS_BUF_SIZE + 16]; /* Since we add some chars here and there */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
154 guint lineNum, linePos, eolPos; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
155 t_xs_stil_node *tmpNode; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
156 gboolean isError, isMulti; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
157 gint subEntry; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
158 assert(db); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
159 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
160 /* Try to open the file */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
161 if ((inFile = fopen(dbFilename, "ra")) == NULL) { |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
162 xs_error("Could not open STILDB '%s'\n", dbFilename); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
163 return -1; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
164 } |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
165 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
166 /* Read and parse the data */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
167 lineNum = 0; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
168 isError = FALSE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
169 isMulti = FALSE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
170 tmpNode = NULL; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
171 subEntry = 0; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
172 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
173 while (!feof(inFile) && !isError) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
174 fgets(inLine, XS_BUF_SIZE, inFile); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
175 inLine[XS_BUF_SIZE - 1] = 0; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
176 linePos = eolPos = 0; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
177 xs_findeol(inLine, &eolPos); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
178 inLine[eolPos] = 0; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
179 lineNum++; |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
101
diff
changeset
|
180 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
181 switch (inLine[0]) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
182 case '/': |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
183 /* Check if we are already parsing entry */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
184 isMulti = FALSE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
185 if (tmpNode) { |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
186 XS_STILDB_ERR(lineNum, inLine, |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
187 "New entry found before end of current ('%s')!\n", |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
188 tmpNode->pcFilename); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
189 xs_stildb_node_free(tmpNode); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
190 } |
109
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
191 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
192 /* A new node */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
193 subEntry = 0; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
194 tmpNode = xs_stildb_node_new(inLine); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
195 if (!tmpNode) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
196 /* Allocation failed */ |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
197 XS_STILDB_ERR(lineNum, inLine, |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
198 "Could not allocate new STILdb-node!\n"); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
199 isError = TRUE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
200 } |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
201 break; |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
101
diff
changeset
|
202 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
203 case '(': |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
204 /* A new sub-entry */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
205 isMulti = FALSE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
206 linePos++; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
207 if (inLine[linePos] == '#') { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
208 linePos++; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
209 if (inLine[linePos]) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
210 xs_findnum(inLine, &linePos); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
211 inLine[linePos] = 0; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
212 subEntry = atol(&inLine[2]); |
109
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
213 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
214 /* Sanity check */ |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
215 if (subEntry < 1) { |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
216 XS_STILDB_ERR(lineNum, inLine, |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
217 "Number of subEntry (%i) for '%s' is invalid\n", |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
218 subEntry, tmpNode->pcFilename); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
219 subEntry = 0; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
220 } |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
221 } |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
222 } else { |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
223 XS_STILDB_ERR(lineNum, inLine, |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
224 "Syntax error, expected subEntry number.\n"); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
225 } |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
226 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
227 break; |
109
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
228 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
229 case 0: |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
230 case '#': |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
231 case '\n': |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
232 case '\r': |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
233 /* End of entry/field */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
234 isMulti = FALSE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
235 if (tmpNode) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
236 /* Insert to database */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
237 xs_stildb_node_insert(db, tmpNode); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
238 tmpNode = NULL; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
239 } |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
240 break; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
241 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
242 default: |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
243 /* Check if we are parsing an entry */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
244 if (!tmpNode) { |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
245 XS_STILDB_ERR(lineNum, inLine, |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
246 "Entry data encountered outside of entry or syntax error!\n"); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
247 break; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
248 } |
117
453ac1293f6a
Fixed severe bug in xs_strmcat()
Matti Hamalainen <ccr@tnsp.org>
parents:
110
diff
changeset
|
249 |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
250 if (xs_stildb_node_realloc(tmpNode, subEntry)) { |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
251 XS_STILDB_ERR(lineNum, inLine, |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
252 "Could not (re)allocate memory for subEntries!\n"); |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
253 isError = TRUE; |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
254 break; |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
255 } |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
256 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
257 /* Some other type */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
258 if (strncmp(inLine, " NAME:", 8) == 0) { |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
259 XS_STILDB_MULTI; |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
260 g_free(tmpNode->subTunes[subEntry]->pName); |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
261 tmpNode->subTunes[subEntry]->pName = g_strdup(&inLine[9]); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
262 } else if (strncmp(inLine, " AUTHOR:", 8) == 0) { |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
263 XS_STILDB_MULTI; |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
264 g_free(tmpNode->subTunes[subEntry]->pAuthor); |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
265 tmpNode->subTunes[subEntry]->pAuthor = g_strdup(&inLine[9]); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
266 } else if (strncmp(inLine, " TITLE:", 8) == 0) { |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
267 XS_STILDB_MULTI; |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
268 inLine[eolPos++] = '\n'; |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
269 inLine[eolPos++] = 0; |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
270 xs_pstrcat(&(tmpNode->subTunes[subEntry]->pInfo), &inLine[2]); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
271 } else if (strncmp(inLine, " ARTIST:", 8) == 0) { |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
272 XS_STILDB_MULTI; |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
273 inLine[eolPos++] = '\n'; |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
274 inLine[eolPos++] = 0; |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
275 xs_pstrcat(&(tmpNode->subTunes[subEntry]->pInfo), &inLine[1]); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
276 } else if (strncmp(inLine, "COMMENT:", 8) == 0) { |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
277 XS_STILDB_MULTI; |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
278 isMulti = TRUE; |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
279 xs_pstrcat(&(tmpNode->subTunes[subEntry]->pInfo), inLine); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
280 } else if (strncmp(inLine, " ", 8) == 0) { |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
281 if (isMulti) { |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
282 xs_pstrcat(&(tmpNode->subTunes[subEntry]->pInfo), &inLine[8]); |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
283 } else { |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
284 XS_STILDB_ERR(lineNum, inLine, |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
285 "Entry continuation found when isMulti == FALSE.\n"); |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
286 } |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
287 } |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
288 break; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
289 } |
240
f436e16fa6d9
Fixed cosmetic bug in handling of multi-line fields (COMMENT).
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
290 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
291 } /* while */ |
240
f436e16fa6d9
Fixed cosmetic bug in handling of multi-line fields (COMMENT).
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
292 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
293 /* Check if there is one remaining node */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
294 if (tmpNode) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
295 xs_stildb_node_insert(db, tmpNode); |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
296 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
297 /* Close the file */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
298 fclose(inFile); |
109
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
299 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
300 return 0; |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
301 } |
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
302 |
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
303 |
227
92bad4c7b998
Improved modularization of STIL and song-length database subsystems.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
304 /* Compare two nodes |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
305 */ |
227
92bad4c7b998
Improved modularization of STIL and song-length database subsystems.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
306 static gint xs_stildb_cmp(const void *pNode1, const void *pNode2) |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
307 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
308 /* We assume here that we never ever get NULL-pointers or similar */ |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
309 return strcmp( |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
310 (*(t_xs_stil_node **) pNode1)->pcFilename, |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
311 (*(t_xs_stil_node **) pNode2)->pcFilename); |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
312 } |
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
313 |
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
314 |
227
92bad4c7b998
Improved modularization of STIL and song-length database subsystems.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
315 /* (Re)create index |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
316 */ |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
317 gint xs_stildb_index(t_xs_stildb *db) |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
318 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
319 t_xs_stil_node *pCurr; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
320 gint i; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
321 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
322 /* Free old index */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
323 if (db->ppIndex) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
324 g_free(db->ppIndex); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
325 db->ppIndex = NULL; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
326 } |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
327 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
328 /* Get size of db */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
329 pCurr = db->pNodes; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
330 db->n = 0; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
331 while (pCurr) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
332 db->n++; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
333 pCurr = pCurr->pNext; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
334 } |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
335 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
336 /* Check number of nodes */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
337 if (db->n > 0) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
338 /* Allocate memory for index-table */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
339 db->ppIndex = (t_xs_stil_node **) g_malloc(sizeof(t_xs_stil_node *) * db->n); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
340 if (!db->ppIndex) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
341 return -1; |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
342 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
343 /* Get node-pointers to table */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
344 i = 0; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
345 pCurr = db->pNodes; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
346 while (pCurr && (i < db->n)) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
347 db->ppIndex[i++] = pCurr; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
348 pCurr = pCurr->pNext; |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
349 } |
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
350 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
351 /* Sort the indexes */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
352 qsort(db->ppIndex, db->n, sizeof(t_xs_stil_node *), xs_stildb_cmp); |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
353 } |
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
354 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
355 return 0; |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
356 } |
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
357 |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
358 |
227
92bad4c7b998
Improved modularization of STIL and song-length database subsystems.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
359 /* Free a given STIL database |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
360 */ |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
361 void xs_stildb_free(t_xs_stildb *db) |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
362 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
363 t_xs_stil_node *pCurr, *pNext; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
364 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
365 if (!db) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
366 return; |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
367 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
368 /* Free the memory allocated for nodes */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
369 pCurr = db->pNodes; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
370 while (pCurr) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
371 pNext = pCurr->pNext; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
372 xs_stildb_node_free(pCurr); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
373 pCurr = pNext; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
374 } |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
375 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
376 db->pNodes = NULL; |
227
92bad4c7b998
Improved modularization of STIL and song-length database subsystems.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
377 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
378 /* Free memory allocated for index */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
379 if (db->ppIndex) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
380 g_free(db->ppIndex); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
381 db->ppIndex = NULL; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
382 } |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
383 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
384 /* Free structure */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
385 db->n = 0; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
386 g_free(db); |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
387 } |
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
388 |
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
389 |
227
92bad4c7b998
Improved modularization of STIL and song-length database subsystems.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
390 /* Get STIL information node from database |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
391 */ |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
392 static t_xs_stil_node *xs_stildb_get_node(t_xs_stildb *db, gchar *pcFilename) |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
393 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
394 gint iStartNode, iEndNode, iQNode, r, i; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
395 gboolean iFound; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
396 t_xs_stil_node *pResult; |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
397 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
398 /* Check the database pointers */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
399 if (!db || !db->pNodes || !db->ppIndex) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
400 return NULL; |
109
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
401 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
402 /* Look-up via index using binary search */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
403 pResult = NULL; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
404 iStartNode = 0; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
405 iEndNode = (db->n - 1); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
406 iQNode = (iEndNode / 2); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
407 iFound = FALSE; |
109
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
408 |
369
4611f1194941
Make binary search bailout value a #define in xmms-sid.h
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
409 while ((!iFound) && ((iEndNode - iStartNode) > XS_BIN_BAILOUT)) { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
410 r = strcmp(pcFilename, db->ppIndex[iQNode]->pcFilename); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
411 if (r < 0) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
412 /* Hash was in the <- LEFT side */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
413 iEndNode = iQNode; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
414 iQNode = iStartNode + ((iEndNode - iStartNode) / 2); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
415 } else if (r > 0) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
416 /* Hash was in the RIGHT -> side */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
417 iStartNode = iQNode; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
418 iQNode = iStartNode + ((iEndNode - iStartNode) / 2); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
419 } else |
109
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
420 iFound = TRUE; |
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
421 } |
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
422 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
423 /* If not found already */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
424 if (!iFound) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
425 /* Search the are linearly */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
426 iFound = FALSE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
427 i = iStartNode; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
428 while ((i <= iEndNode) && (!iFound)) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
429 if (strcmp(pcFilename, db->ppIndex[i]->pcFilename) == 0) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
430 iFound = TRUE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
431 else |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
432 i++; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
433 } |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
434 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
435 /* Check the result */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
436 if (iFound) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
437 pResult = db->ppIndex[i]; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
438 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
439 } else { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
440 /* Found via binary search */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
441 pResult = db->ppIndex[iQNode]; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
442 } |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
443 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
444 return pResult; |
94
086681f70910
Start of re-write of STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
445 } |
109
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
446 |
227
92bad4c7b998
Improved modularization of STIL and song-length database subsystems.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
447 |
230 | 448 /* |
449 * These should be moved out of this module some day ... | |
227
92bad4c7b998
Improved modularization of STIL and song-length database subsystems.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
450 */ |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
451 static t_xs_stildb *xs_stildb_db = NULL; |
230 | 452 XS_MUTEX(xs_stildb_db); |
453 | |
454 gint xs_stil_init(void) | |
227
92bad4c7b998
Improved modularization of STIL and song-length database subsystems.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
455 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
456 XS_MUTEX_LOCK(xs_cfg); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
457 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
458 if (!xs_cfg.stilDBPath) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
459 XS_MUTEX_UNLOCK(xs_cfg); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
460 return -1; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
461 } |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
462 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
463 XS_MUTEX_LOCK(xs_stildb_db); |
230 | 464 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
465 /* Check if already initialized */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
466 if (xs_stildb_db) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
467 xs_stildb_free(xs_stildb_db); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
468 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
469 /* Allocate database */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
470 xs_stildb_db = (t_xs_stildb *) g_malloc0(sizeof(t_xs_stildb)); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
471 if (!xs_stildb_db) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
472 XS_MUTEX_UNLOCK(xs_cfg); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
473 XS_MUTEX_UNLOCK(xs_stildb_db); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
474 return -2; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
475 } |
230 | 476 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
477 /* Read the database */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
478 if (xs_stildb_read(xs_stildb_db, xs_cfg.stilDBPath) != 0) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
479 xs_stildb_free(xs_stildb_db); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
480 xs_stildb_db = NULL; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
481 XS_MUTEX_UNLOCK(xs_cfg); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
482 XS_MUTEX_UNLOCK(xs_stildb_db); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
483 return -3; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
484 } |
230 | 485 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
486 /* Create index */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
487 if (xs_stildb_index(xs_stildb_db) != 0) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
488 xs_stildb_free(xs_stildb_db); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
489 xs_stildb_db = NULL; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
490 XS_MUTEX_UNLOCK(xs_cfg); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
491 XS_MUTEX_UNLOCK(xs_stildb_db); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
492 return -4; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
493 } |
230 | 494 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
495 XS_MUTEX_UNLOCK(xs_cfg); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
496 XS_MUTEX_UNLOCK(xs_stildb_db); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
497 return 0; |
230 | 498 } |
499 | |
500 | |
501 void xs_stil_close(void) | |
502 { | |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
503 XS_MUTEX_LOCK(xs_stildb_db); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
504 xs_stildb_free(xs_stildb_db); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
505 xs_stildb_db = NULL; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
506 XS_MUTEX_UNLOCK(xs_stildb_db); |
230 | 507 } |
508 | |
509 | |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
510 t_xs_stil_node *xs_stil_get(gchar *pcFilename) |
230 | 511 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
512 t_xs_stil_node *pResult; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
513 gchar *tmpFilename; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
514 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
515 XS_MUTEX_LOCK(xs_stildb_db); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
516 XS_MUTEX_LOCK(xs_cfg); |
227
92bad4c7b998
Improved modularization of STIL and song-length database subsystems.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
517 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
518 if (xs_cfg.stilDBEnable && xs_stildb_db) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
519 if (xs_cfg.hvscPath) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
520 /* Remove postfixed directory separator from HVSC-path */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
521 tmpFilename = xs_strrchr(xs_cfg.hvscPath, '/'); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
522 if (tmpFilename && (tmpFilename[1] == 0)) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
523 tmpFilename[0] = 0; |
230 | 524 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
525 /* Remove HVSC location-prefix from filename */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
526 tmpFilename = strstr(pcFilename, xs_cfg.hvscPath); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
527 if (tmpFilename) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
528 tmpFilename += strlen(xs_cfg.hvscPath); |
232
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
529 else |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
530 tmpFilename = pcFilename; |
232
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
531 } else |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
532 tmpFilename = pcFilename; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
533 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
534 pResult = xs_stildb_get_node(xs_stildb_db, tmpFilename); |
230 | 535 } else |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
536 pResult = NULL; |
227
92bad4c7b998
Improved modularization of STIL and song-length database subsystems.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
537 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
538 XS_MUTEX_UNLOCK(xs_stildb_db); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
539 XS_MUTEX_UNLOCK(xs_cfg); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
540 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
330
diff
changeset
|
541 return pResult; |
227
92bad4c7b998
Improved modularization of STIL and song-length database subsystems.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
542 } |