comparison src/xs_length.c @ 449:230a9d79dd84

Type cleanups/fixes.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 17 Jan 2007 01:07:00 +0000
parents faf12767a6f1
children 57836945fa71
comparison
equal deleted inserted replaced
448:699c407447e9 449:230a9d79dd84
61 } 61 }
62 62
63 63
64 /* Parse a time-entry in SLDB format 64 /* Parse a time-entry in SLDB format
65 */ 65 */
66 static gint xs_sldb_gettime(gchar *pcStr, gint *piPos) 66 static gint xs_sldb_gettime(gchar *pcStr, size_t *piPos)
67 { 67 {
68 gint iResult, iTemp; 68 gint iResult, iTemp;
69 69
70 /* Check if it starts with a digit */ 70 /* Check if it starts with a digit */
71 if (isdigit(pcStr[*piPos])) { 71 if (isdigit(pcStr[*piPos])) {
101 101
102 /* Parse one SLDB definition line, return SLDB node 102 /* Parse one SLDB definition line, return SLDB node
103 */ 103 */
104 t_xs_sldb_node * xs_sldb_read_entry(gchar *inLine) 104 t_xs_sldb_node * xs_sldb_read_entry(gchar *inLine)
105 { 105 {
106 gint linePos, savePos, i, tmpLen, l; 106 size_t linePos;
107 gint i;
107 gboolean iOK; 108 gboolean iOK;
108 t_xs_sldb_node *tmpNode; 109 t_xs_sldb_node *tmpNode;
109 110
110 /* Allocate new node */ 111 /* Allocate new node */
111 tmpNode = (t_xs_sldb_node *) g_malloc0(sizeof(t_xs_sldb_node)); 112 tmpNode = (t_xs_sldb_node *) g_malloc0(sizeof(t_xs_sldb_node));
127 if (inLine[linePos] != '=') { 128 if (inLine[linePos] != '=') {
128 xs_error(_("'=' expected on column #%d.\n"), linePos); 129 xs_error(_("'=' expected on column #%d.\n"), linePos);
129 xs_sldb_node_free(tmpNode); 130 xs_sldb_node_free(tmpNode);
130 return NULL; 131 return NULL;
131 } else { 132 } else {
133 size_t tmpLen, savePos;
134
132 /* First playtime is after '=' */ 135 /* First playtime is after '=' */
133 savePos = ++linePos; 136 savePos = ++linePos;
134 tmpLen = strlen(inLine); 137 tmpLen = strlen(inLine);
135 138
136 /* Get number of sub-tune lengths */ 139 /* Get number of sub-tune lengths */
155 /* Read lengths in */ 158 /* Read lengths in */
156 i = 0; 159 i = 0;
157 linePos = savePos; 160 linePos = savePos;
158 iOK = TRUE; 161 iOK = TRUE;
159 while ((linePos < tmpLen) && (i < tmpNode->nLengths) && iOK) { 162 while ((linePos < tmpLen) && (i < tmpNode->nLengths) && iOK) {
163 gint l;
164
160 xs_findnext(inLine, &linePos); 165 xs_findnext(inLine, &linePos);
161 166
162 l = xs_sldb_gettime(inLine, &linePos); 167 l = xs_sldb_gettime(inLine, &linePos);
163 if (l >= 0) 168 if (l >= 0)
164 tmpNode->sLengths[i] = l; 169 tmpNode->sLengths[i] = l;
198 203
199 /* Read and parse the data */ 204 /* Read and parse the data */
200 lineNum = 0; 205 lineNum = 0;
201 206
202 while (!feof(inFile)) { 207 while (!feof(inFile)) {
203 gint linePos; 208 size_t linePos;
204 fgets(inLine, XS_BUF_SIZE, inFile); 209 fgets(inLine, XS_BUF_SIZE, inFile);
205 inLine[XS_BUF_SIZE - 1] = 0; 210 inLine[XS_BUF_SIZE - 1] = 0;
206 linePos = 0; 211 linePos = 0;
207 lineNum++; 212 lineNum++;
208 213