diff src/xs_length.c @ 424:faf12767a6f1

Preparing for internationalization.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 31 Dec 2006 21:43:04 +0000
parents d2e6682d3ef8
children 230a9d79dd84
line wrap: on
line diff
--- a/src/xs_length.c	Sat Dec 30 07:40:05 2006 +0000
+++ b/src/xs_length.c	Sun Dec 31 21:43:04 2006 +0000
@@ -110,7 +110,7 @@
 	/* Allocate new node */
 	tmpNode = (t_xs_sldb_node *) g_malloc0(sizeof(t_xs_sldb_node));
 	if (!tmpNode) {
-		xs_error("Error allocating new node. Fatal error.\n");
+		xs_error(_("Error allocating new node. Fatal error.\n"));
 		return NULL;
 	}
 
@@ -125,7 +125,7 @@
 	/* Get playtimes */
 	if (inLine[linePos] != 0) {
 		if (inLine[linePos] != '=') {
-			xs_error("'=' expected on column #%d.\n", linePos);
+			xs_error(_("'=' expected on column #%d.\n"), linePos);
 			xs_sldb_node_free(tmpNode);
 			return NULL;
 		} else {
@@ -147,7 +147,7 @@
 			/* Allocate memory for lengths */
 			tmpNode->sLengths = (gint *) g_malloc0(tmpNode->nLengths * sizeof(gint));
 			if (!tmpNode->sLengths) {
-				xs_error("Could not allocate memory for node.\n");
+				xs_error(_("Could not allocate memory for node.\n"));
 				xs_sldb_node_free(tmpNode);
 				return NULL;
 			}
@@ -192,7 +192,7 @@
 
 	/* Try to open the file */
 	if ((inFile = fopen(dbFilename, "ra")) == NULL) {
-		xs_error("Could not open SongLengthDB '%s'\n", dbFilename);
+		xs_error(_("Could not open SongLengthDB '%s'\n"), dbFilename);
 		return -1;
 	}
 
@@ -205,6 +205,8 @@
 		inLine[XS_BUF_SIZE - 1] = 0;
 		linePos = 0;
 		lineNum++;
+		
+		xs_findnext(inLine, &linePos);
 
 		/* Check if it is datafield */
 		if (isxdigit(inLine[linePos])) {
@@ -213,19 +215,19 @@
 			for (hashLen = 0; inLine[linePos] && isxdigit(inLine[linePos]); hashLen++, linePos++);
 
 			if (hashLen != XS_MD5HASH_LENGTH_CH) {
-				xs_error("Invalid MD5-hash in SongLengthDB file '%s' line #%d!\n",
+				xs_error(_("Invalid MD5-hash in SongLengthDB file '%s' line #%d!\n"),
 					dbFilename, lineNum);
 			} else {
 				/* Parse and add node to db */
 				if ((tmpNode = xs_sldb_read_entry(inLine)) != NULL) {
 					xs_sldb_node_insert(db, tmpNode);
 				} else {
-					xs_error("Invalid entry in SongLengthDB file '%s' line #%d!\n",
+					xs_error(_("Invalid entry in SongLengthDB file '%s' line #%d!\n"),
 						dbFilename, lineNum);
 				}
 			}
-		} else if ((inLine[linePos] != ';') && (inLine[linePos] != '[')) {
-			xs_error("Invalid line in SongLengthDB file '%s' line #%d\n",
+		} else if ((inLine[linePos] != ';') && (inLine[linePos] != '[') && (inLine[linePos] != 0)) {
+			xs_error(_("Invalid line in SongLengthDB file '%s' line #%d\n"),
 				dbFilename, lineNum);
 		}