[Scummvm-git-logs] scummvm master -> 7998025b98c6f6945756ba2fa2300646a38d4526

orgads noreply at scummvm.org
Tue Jan 18 07:24:47 UTC 2022


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

Summary:
7998025b98 CREATE_PROJECT: Centralize toUpper


Commit: 7998025b98c6f6945756ba2fa2300646a38d4526
    https://github.com/scummvm/scummvm/commit/7998025b98c6f6945756ba2fa2300646a38d4526
Author: Orgad Shaneh (orgads at gmail.com)
Date: 2022-01-18T09:24:29+02:00

Commit Message:
CREATE_PROJECT: Centralize toUpper

Changed paths:
    devtools/create_project/cmake.cpp
    devtools/create_project/create_project.cpp
    devtools/create_project/create_project.h
    devtools/create_project/xcode.cpp


diff --git a/devtools/create_project/cmake.cpp b/devtools/create_project/cmake.cpp
index c421d699c2d..35d91573920 100644
--- a/devtools/create_project/cmake.cpp
+++ b/devtools/create_project/cmake.cpp
@@ -29,12 +29,6 @@
 
 namespace CreateProjectTool {
 
-static std::string toUpper(const std::string &str) {
-	std::string res;
-	std::transform(str.begin(), str.end(), std::back_inserter(res), toupper);
-	return res;
-}
-
 CMakeProvider::CMakeProvider(StringList &global_warnings, std::map<std::string, StringList> &project_warnings, const int version)
 	: ProjectProvider(global_warnings, project_warnings, version) {
 }
diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp
index 4e945a71692..88b19439fed 100644
--- a/devtools/create_project/create_project.cpp
+++ b/devtools/create_project/create_project.cpp
@@ -928,11 +928,8 @@ StringList getEngineDefines(const EngineDescList &engines) {
 	StringList result;
 
 	for (EngineDescList::const_iterator i = engines.begin(); i != engines.end(); ++i) {
-		if (i->enable) {
-			std::string define = "ENABLE_" + i->name;
-			std::transform(define.begin(), define.end(), define.begin(), toupper);
-			result.push_back(define);
-		}
+		if (i->enable)
+			result.push_back("ENABLE_" + CreateProjectTool::toUpper(i->name));
 	}
 
 	return result;
@@ -1331,6 +1328,12 @@ std::string toString(int num) {
 	return os.str();
 }
 
+std::string toUpper(const std::string &str) {
+	std::string res;
+	std::transform(str.begin(), str.end(), std::back_inserter(res), toupper);
+	return res;
+}
+
 /**
  * Checks whether the give file in the specified directory is present in the given
  * file list.
@@ -2033,11 +2036,8 @@ void ProjectProvider::createModuleList(const std::string &moduleDir, const Strin
 	if (forDetection) {
 		std::string::size_type p = moduleRootDir.find('/');
 		std::string engineName = moduleRootDir.substr(p + 1);
-		std::string engineNameUpper;
+		std::string engineNameUpper = toUpper(engineName);
 
-		for (std::string::const_iterator i = engineName.begin(); i != engineName.end(); ++i) {
-			engineNameUpper += toupper(*i);
-		}
 		for (;;) {
 			std::getline(moduleMk, line);
 
@@ -2152,8 +2152,7 @@ void ProjectProvider::createEnginePluginsTable(const BuildSetup &setup) {
 		}
 
 		// Make the engine name all uppercase.
-		std::string engineName;
-		std::transform(i->name.begin(), i->name.end(), std::back_inserter(engineName), toupper);
+		const std::string engineName = toUpper(i->name);
 
 		enginePluginsTable << "#if PLUGIN_ENABLED_STATIC(" << engineName << ")\n"
 		                   << "LINK_PLUGIN(" << engineName << ")\n"
diff --git a/devtools/create_project/create_project.h b/devtools/create_project/create_project.h
index af2450bb021..69d7ff90823 100644
--- a/devtools/create_project/create_project.h
+++ b/devtools/create_project/create_project.h
@@ -433,6 +433,14 @@ bool producesObjectFile(const std::string &fileName);
 */
 std::string toString(int num);
 
+/**
+* Convert a string to uppercase
+*
+* @param str the source string
+* @return The string transformed to uppercase
+*/
+std::string toUpper(const std::string &str);
+
 /**
  * Returns a list of all files and directories in the specified
  * path.
diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp
index bd9b56062f0..f7da3283c17 100644
--- a/devtools/create_project/xcode.cpp
+++ b/devtools/create_project/xcode.cpp
@@ -1304,13 +1304,12 @@ std::string XcodeProvider::md5(std::string key) {
 #endif
 
 std::string XcodeProvider::newHash() const {
-	std::string hash = createUUID();
+	std::string hash = toUpper(createUUID());
 
 	// Remove { and - from UUID and resize to 96-bits uppercase hex string
 	hash.erase(remove_if(hash.begin(), hash.end(), isSeparator), hash.end());
 
 	hash.resize(24);
-	std::transform(hash.begin(), hash.end(), hash.begin(), toupper);
 
 	return hash;
 }




More information about the Scummvm-git-logs mailing list