SLUDGE: Move createCString() with string tools
This commit is contained in:
parent
7edac197e4
commit
6004cd319d
4 changed files with 13 additions and 12 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue