comparison src/xs_length.c @ 778:54a7afbf251e

Improve error messages in songlength database parser.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 06 Nov 2012 12:11:49 +0200
parents 15f0c8e11338
children 80139f0ac82a
comparison
equal deleted inserted replaced
777:15f0c8e11338 778:54a7afbf251e
219 /* Check the length of the hash */ 219 /* Check the length of the hash */
220 gint hashLen; 220 gint hashLen;
221 for (hashLen = 0; inLine[linePos] && isxdigit(inLine[linePos]); hashLen++, linePos++); 221 for (hashLen = 0; inLine[linePos] && isxdigit(inLine[linePos]); hashLen++, linePos++);
222 222
223 if (hashLen != XS_MD5HASH_LENGTH_CH) { 223 if (hashLen != XS_MD5HASH_LENGTH_CH) {
224 xs_error("Invalid MD5-hash in SongLengthDB file '%s' line #%d!\n", 224 xs_error("Invalid MD5-hash in SongLengthDB file '%s' line #%d:\n%s\n",
225 dbFilename, lineNum); 225 dbFilename, lineNum, inLine);
226 } else { 226 } else {
227 /* Parse and add node to db */ 227 /* Parse and add node to db */
228 if ((tmnode = xs_sldb_read_entry(inLine)) != NULL) { 228 if ((tmnode = xs_sldb_read_entry(inLine)) != NULL) {
229 xs_sldb_node_insert(db, tmnode); 229 xs_sldb_node_insert(db, tmnode);
230 } else { 230 } else {
231 xs_error("Invalid entry in SongLengthDB file '%s' line #%d!\n", 231 xs_error("Invalid entry in SongLengthDB file '%s' line #%d:\n%s\n",
232 dbFilename, lineNum); 232 dbFilename, lineNum, inLine);
233 } 233 }
234 } 234 }
235 } else if ((inLine[linePos] != ';') && (inLine[linePos] != '[') && (inLine[linePos] != 0)) { 235 } else if (inLine[linePos] != ';' && inLine[linePos] != '[' && inLine[linePos] != 0) {
236 xs_error("Invalid line in SongLengthDB file '%s' line #%d\n", 236 xs_error("Invalid line in SongLengthDB file '%s' line #%d:\n%s\n",
237 dbFilename, lineNum); 237 dbFilename, lineNum, inLine);
238 } 238 }
239 239
240 } 240 }
241 241
242 /* Close the file */ 242 /* Close the file */