[Scummvm-git-logs] scummvm master -> b01f927bc33e7c50fb1ab245c1c82f7c2731c28f

mduggan noreply at scummvm.org
Mon Nov 22 13:30:22 UTC 2021


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:
b01f927bc3 ULTIMA8: Remove unused ArgvToString function.


Commit: b01f927bc33e7c50fb1ab245c1c82f7c2731c28f
    https://github.com/scummvm/scummvm/commit/b01f927bc33e7c50fb1ab245c1c82f7c2731c28f
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-11-22T22:29:52+09:00

Commit Message:
ULTIMA8: Remove unused ArgvToString function.

Changed paths:
    engines/ultima/ultima8/misc/util.cpp
    engines/ultima/ultima8/misc/util.h
    test/engines/ultima/ultima8/misc/util.h


diff --git a/engines/ultima/ultima8/misc/util.cpp b/engines/ultima/ultima8/misc/util.cpp
index 79a2fa7943..59df07b806 100644
--- a/engines/ultima/ultima8/misc/util.cpp
+++ b/engines/ultima/ultima8/misc/util.cpp
@@ -89,42 +89,6 @@ template<class T> void StringToArgv(const T &args, Common::Array<T> &argv) {
 
 template void StringToArgv<Common::String>(const Common::String &args, Common::Array<Common::String> &argv);
 
-template<class T> void ArgvToString(const Std::vector<T> &argv, T &args) {
-	// Clear the string
-	args.clear();
-
-	typename Std::vector<T>::const_iterator i;
-	typename T::const_iterator j;
-	int ch;
-
-	for (i = argv.begin(); i != argv.end(); ++i) {
-		for (j = i->begin(); j != i->end(); ++j) {
-			ch = *j;
-
-			// No quoting, only escaping
-
-			// Handle \, ", ', \n, \r, \t., ' '
-			if (ch == '\\' || ch == '\"' || ch == '\'' || ch == ' ') {
-				args += '\\';
-			} else if (ch == '\n') {
-				args += '\\';
-				ch = 'n';
-			} else if (ch == '\r') {
-				args += '\\';
-				ch = 'r';
-			} else if (ch == '\t') {
-				args += '\\';
-				ch = 't';
-			}
-
-			args += ch;
-		}
-		args += ' ';
-	}
-}
-
-template void ArgvToString<Common::String>(const Std::vector<Common::String> &argv, Common::String &args);
-
 template<class T> void TrimSpaces(T &str) {
 	if (str.empty()) return;
 
diff --git a/engines/ultima/ultima8/misc/util.h b/engines/ultima/ultima8/misc/util.h
index 7c74b17e84..ef8c929e78 100644
--- a/engines/ultima/ultima8/misc/util.h
+++ b/engines/ultima/ultima8/misc/util.h
@@ -29,8 +29,6 @@ namespace Ultima {
 namespace Ultima8 {
 
 template<class T> void StringToArgv(const T &args, Common::Array<T> &argv);
-template<class T> void ArgvToString(const Common::Array<T> &argv, T &args);
-
 
 template<class T> void TrimSpaces(T &str);
 
diff --git a/test/engines/ultima/ultima8/misc/util.h b/test/engines/ultima/ultima8/misc/util.h
index 2d2e2d2d67..d9d6795067 100644
--- a/test/engines/ultima/ultima8/misc/util.h
+++ b/test/engines/ultima/ultima8/misc/util.h
@@ -56,19 +56,6 @@ class U8UtilTestSuite : public CxxTest::TestSuite {
 		TS_ASSERT_EQUALS(v1[1], "aa");
 	}
 
-	void test_argv_to_string() {
-		// FIXME: It would be nicer if this function didn't leave a trailing space
-		Common::Array<Common::String> v;
-		Common::String s;
-		Ultima::Ultima8::ArgvToString(v, s);
-		TS_ASSERT_EQUALS(s, "");
-
-		v.push_back("abc");
-		v.push_back("\t\nescape me \"!");
-		Ultima::Ultima8::ArgvToString(v, s);
-		TS_ASSERT_EQUALS(s, "abc \\t\\nescape\\ me\\ \\\"! ");
-	}
-
 	void test_string_to_argv() {
 		Common::Array<Common::String> v;
 		Common::String s;




More information about the Scummvm-git-logs mailing list