aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimei Yin2018-05-30 19:22:46 +0200
committerSimei Yin2018-05-31 23:15:09 +0200
commit6004cd319d3c865821bc2be29647222c957ed517 (patch)
tree4d9697d1c70664e8745ff486c12238d1ca68f8c4
parent7edac197e4aa9846b71f398d9c5a4d56c5b7c34e (diff)
downloadscummvm-rg350-6004cd319d3c865821bc2be29647222c957ed517.tar.gz
scummvm-rg350-6004cd319d3c865821bc2be29647222c957ed517.tar.bz2
scummvm-rg350-6004cd319d3c865821bc2be29647222c957ed517.zip
SLUDGE: Move createCString() with string tools
-rw-r--r--engines/sludge/moreio.cpp11
-rw-r--r--engines/sludge/moreio.h2
-rw-r--r--engines/sludge/variable.cpp11
-rw-r--r--engines/sludge/variable.h1
4 files changed, 13 insertions, 12 deletions
diff --git a/engines/sludge/moreio.cpp b/engines/sludge/moreio.cpp
index 1512574207..ee9ab8e0f0 100644
--- a/engines/sludge/moreio.cpp
+++ b/engines/sludge/moreio.cpp
@@ -167,4 +167,15 @@ Common::String decodeFilename(const Common::String &nameIn) {
return newName;
}
+char *createCString(const Common::String &s) {
+ uint n = s.size() + 1;
+ char *res = new char[n];
+ if (!checkNew(res)) {
+ fatal("createCString : Unable to copy String");
+ return NULL;
+ }
+ memcpy(res, s.c_str(), n);
+ return res;
+}
+
} // End of namespace Sludge
diff --git a/engines/sludge/moreio.h b/engines/sludge/moreio.h
index 09235ae8a6..237a918626 100644
--- a/engines/sludge/moreio.h
+++ b/engines/sludge/moreio.h
@@ -31,6 +31,8 @@ void writeString(Common::String s, Common::WriteStream *stream);
Common::String encodeFilename(const Common::String &nameIn);
Common::String decodeFilename(const Common::String &nameIn);
+char *createCString(const Common::String &s);
+
} // End of namespace Sludge
#endif
diff --git a/engines/sludge/variable.cpp b/engines/sludge/variable.cpp
index 35e1036568..b9e7b123d8 100644
--- a/engines/sludge/variable.cpp
+++ b/engines/sludge/variable.cpp
@@ -239,17 +239,6 @@ void compareVariablesInSecond(const Variable &var1, Variable &var2) {
setVariable(var2, SVT_INT, compareVars(var1, var2));
}
-char *createCString(const Common::String &s) {
- uint n = s.size() + 1;
- char *res = new char[n];
- if (!checkNew(res)) {
- fatal("createCString : Unable to copy String");
- return NULL;
- }
- memcpy(res, s.c_str(), n);
- return res;
-}
-
void makeTextVar(Variable &thisVar, const Common::String &txt) {
unlinkVar(thisVar);
thisVar.varType = SVT_STRING;
diff --git a/engines/sludge/variable.h b/engines/sludge/variable.h
index 8f0d394514..a3ae673f66 100644
--- a/engines/sludge/variable.h
+++ b/engines/sludge/variable.h
@@ -90,7 +90,6 @@ void newCostumeVariable(Variable &thisVar, struct Persona *i);
void makeTextVar(Variable &thisVar, const Common::String &txt);
void addVariablesInSecond(Variable &var1, Variable &var2);
void compareVariablesInSecond(const Variable &var1, Variable &var2);
-char *createCString(const Common::String &s);
// Misc.