[Scummvm-cvs-logs] scummvm master -> 4ed136a6c129ad6015286762e2a2ccc4ebbab79f

lordhoto lordhoto at gmail.com
Sat Mar 17 23:52:19 CET 2012


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
55c3350e38 DEVTOOLS: Include necessary headers for compilation.
b520b5db69 JANITORIAL: Simplify stripLine().
4ed136a6c1 DEVTOOLS: Print error message to stderr, not stdout.


Commit: 55c3350e38f1e74b478657624368169556845ad2
    https://github.com/scummvm/scummvm/commit/55c3350e38f1e74b478657624368169556845ad2
Author: Christoph Mallon (christoph.mallon at gmx.de)
Date: 2012-03-17T15:00:55-07:00

Commit Message:
DEVTOOLS: Include necessary headers for compilation.

Changed paths:
    devtools/create_kyradat/create_kyradat.cpp
    devtools/create_kyradat/extract.cpp
    devtools/create_kyradat/games.cpp
    devtools/create_kyradat/tables.cpp
    devtools/create_lure/create_lure_dat.h



diff --git a/devtools/create_kyradat/create_kyradat.cpp b/devtools/create_kyradat/create_kyradat.cpp
index 489be3e..a87bde3 100644
--- a/devtools/create_kyradat/create_kyradat.cpp
+++ b/devtools/create_kyradat/create_kyradat.cpp
@@ -38,6 +38,8 @@
 #include "extract.h"
 
 #include "md5.h"
+#include "common/language.h"
+#include "common/platform.h"
 
 #include <string>
 #include <map>
diff --git a/devtools/create_kyradat/extract.cpp b/devtools/create_kyradat/extract.cpp
index 34308f1..86244fc 100644
--- a/devtools/create_kyradat/extract.cpp
+++ b/devtools/create_kyradat/extract.cpp
@@ -24,6 +24,8 @@
 #define FORBIDDEN_SYMBOL_ALLOW_ALL
 
 #include "extract.h"
+#include "common/language.h"
+#include "common/platform.h"
 
 #include <algorithm>
 
diff --git a/devtools/create_kyradat/games.cpp b/devtools/create_kyradat/games.cpp
index 258d2dd..a2759b1 100644
--- a/devtools/create_kyradat/games.cpp
+++ b/devtools/create_kyradat/games.cpp
@@ -24,6 +24,8 @@
 #define FORBIDDEN_SYMBOL_ALLOW_ALL
 
 #include "create_kyradat.h"
+#include "common/language.h"
+#include "common/platform.h"
 
 // Game tables
 
diff --git a/devtools/create_kyradat/tables.cpp b/devtools/create_kyradat/tables.cpp
index 1b9ca45..1b9f90f 100644
--- a/devtools/create_kyradat/tables.cpp
+++ b/devtools/create_kyradat/tables.cpp
@@ -25,6 +25,8 @@
 
 #include "tables.h"
 #include "create_kyradat.h"
+#include "common/language.h"
+#include "common/platform.h"
 
 #define EXTRACT_END_ENTRY { UNK_LANG, kPlatformUnknown, { 0, 0, { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } } }
 
diff --git a/devtools/create_lure/create_lure_dat.h b/devtools/create_lure/create_lure_dat.h
index 9259a8d..ad49878 100644
--- a/devtools/create_lure/create_lure_dat.h
+++ b/devtools/create_lure/create_lure_dat.h
@@ -24,6 +24,7 @@
 #define CREATE_LURE_DAT_H
 
 #include "common/endian.h"
+#include "common/language.h"
 #include "common/util.h"
 
 #define VERSION_MAJOR 1


Commit: b520b5db6900c7fa23d5b4b2160643984bba5f49
    https://github.com/scummvm/scummvm/commit/b520b5db6900c7fa23d5b4b2160643984bba5f49
Author: Christoph Mallon (christoph.mallon at gmx.de)
Date: 2012-03-17T15:00:57-07:00

Commit Message:
JANITORIAL: Simplify stripLine().

Simply use pointers to the source and destination chars instead of multiple indices.

Changed paths:
    devtools/create_translations/po_parser.cpp



diff --git a/devtools/create_translations/po_parser.cpp b/devtools/create_translations/po_parser.cpp
index bc49da4..cba0557 100644
--- a/devtools/create_translations/po_parser.cpp
+++ b/devtools/create_translations/po_parser.cpp
@@ -337,47 +337,34 @@ PoMessageEntryList *parsePoFile(const char *file, PoMessageList& messages) {
 	return list;
 }
 
-char *stripLine(char *line) {
+char *stripLine(char *const line) {
 	// This function modifies line in place and return it.
 	// Keep only the text between the first two unprotected quotes.
 	// It also look for literal special characters (e.g. preceded by '\n', '\\', '\"', '\'', '\t')
 	// and replace them by the special character so that strcmp() can match them at run time.
 	// Look for the first quote
-	int start = 0;
-	int len = strlen(line);
-	while (start < len && line[start++] != '"') {}
+	char const *src = line;
+	while (*src != '\0' && *src++ != '"') {}
 	// shift characters until we reach the end of the string or an unprotected quote
-	int i = 0, j = 0;
-	while (start + i + j < len && line[start + i + j] != '"') {
-		if (line[start + i + j] == '\\') {
-			switch (line[start + i + j + 1]) {
-			case 'n':
-				line[i++] = '\n';
-				break;
-			case 't':
-				line[i++] = '\t';
-				break;
-			case '\"':
-				line[i++] = '\"';
-				break;
-			case '\'':
-				line[i++] = '\'';
-				break;
-			case '\\':
-				line[i++] = '\\';
-				break;
+	char *dst = line;
+	while (*src != '\0' && *src != '"') {
+		char c = *src++;
+		if (c == '\\') {
+			switch (c = *src++) {
+			case  'n': c = '\n'; break;
+			case  't': c = '\t'; break;
+			case '\"': c = '\"'; break;
+			case '\'': c = '\''; break;
+			case '\\': c = '\\'; break;
 			default:
 				// Just skip
-				fprintf(stdout, "Unsupported special character \"%c%c\" in string. Please contact ScummVM developers.\n", line[start + i + j], line[start + i + j + 1]);
-				++j;
+				fprintf(stdout, "Unsupported special character \"\\%c\" in string. Please contact ScummVM developers.\n", c);
+				continue;
 			}
-			++j;
-		} else {
-			line[i] = line[start + i + j];
-			++i;
 		}
+		*dst++ = c;
 	}
-	line[i] = '\0';
+	*dst = '\0';
 	return line;
 }
 


Commit: 4ed136a6c129ad6015286762e2a2ccc4ebbab79f
    https://github.com/scummvm/scummvm/commit/4ed136a6c129ad6015286762e2a2ccc4ebbab79f
Author: Christoph Mallon (christoph.mallon at gmx.de)
Date: 2012-03-17T15:00:57-07:00

Commit Message:
DEVTOOLS: Print error message to stderr, not stdout.

Changed paths:
    devtools/create_translations/po_parser.cpp



diff --git a/devtools/create_translations/po_parser.cpp b/devtools/create_translations/po_parser.cpp
index cba0557..e8d7d7a 100644
--- a/devtools/create_translations/po_parser.cpp
+++ b/devtools/create_translations/po_parser.cpp
@@ -358,7 +358,7 @@ char *stripLine(char *const line) {
 			case '\\': c = '\\'; break;
 			default:
 				// Just skip
-				fprintf(stdout, "Unsupported special character \"\\%c\" in string. Please contact ScummVM developers.\n", c);
+				fprintf(stderr, "Unsupported special character \"\\%c\" in string. Please contact ScummVM developers.\n", c);
 				continue;
 			}
 		}






More information about the Scummvm-git-logs mailing list