[Scummvm-cvs-logs] scummvm master -> 164604805e00d8b17d0725f605575c7ec8741001

lordhoto lordhoto at gmail.com
Fri Oct 7 00:23:57 CEST 2011


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

Summary:
7f55737f9c COMMON: Remove unused code in config-file.cpp.
164604805e COMMON: Unbreak ConfigFile::renameSection.


Commit: 7f55737f9cc5b74e5ebf825c7c25fcbe561bccfe
    https://github.com/scummvm/scummvm/commit/7f55737f9cc5b74e5ebf825c7c25fcbe561bccfe
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2011-10-06T15:16:21-07:00

Commit Message:
COMMON: Remove unused code in config-file.cpp.

Changed paths:
    common/config-file.cpp



diff --git a/common/config-file.cpp b/common/config-file.cpp
index 1ebd9b5..2bdf598 100644
--- a/common/config-file.cpp
+++ b/common/config-file.cpp
@@ -26,16 +26,8 @@
 #include "common/system.h"
 #include "common/textconsole.h"
 
-#define MAXLINELEN 256
-
 namespace Common {
 
-/**
- * Check whether the given string is a valid section or key name.
- * For that, it must only consist of letters, numbers, dashes and
- * underscores. In particular, white space and "#", "=", "[", "]"
- * are not valid!
- */
 bool ConfigFile::isValidName(const String &name) {
 	const char *p = name.c_str();
 	while (*p && (isalnum(static_cast<unsigned char>(*p)) || *p == '-' || *p == '_' || *p == '.'))


Commit: 164604805e00d8b17d0725f605575c7ec8741001
    https://github.com/scummvm/scummvm/commit/164604805e00d8b17d0725f605575c7ec8741001
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2011-10-06T15:16:21-07:00

Commit Message:
COMMON: Unbreak ConfigFile::renameSection.

It will still not work when the new section name is already taken, but at
at least when it is not taken it should work now.

Changed paths:
    common/config-file.cpp



diff --git a/common/config-file.cpp b/common/config-file.cpp
index 2bdf598..81e0ae6 100644
--- a/common/config-file.cpp
+++ b/common/config-file.cpp
@@ -247,10 +247,15 @@ void ConfigFile::renameSection(const String &oldName, const String &newName) {
 	assert(isValidName(oldName));
 	assert(isValidName(newName));
 
-	//Section *os = getSection(oldName);
-	Section *ns = getSection(newName);
-	if (ns) {
-		ns->name = newName;
+	Section *os = getSection(oldName);
+	const Section *ns = getSection(newName);
+	if (os) {
+		// HACK: For now we just print a warning, for more info see the TODO
+		// below.
+		if (ns)
+			warning("ConfigFile::renameSection: Section name \"%s\" already used", newName.c_str());
+		else
+			os->name = newName;
 	}
 	// TODO: Check here whether there already is a section with the
 	// new name. Not sure how to cope with that case, we could:






More information about the Scummvm-git-logs mailing list