diff options
author | Colin Snover | 2017-12-05 12:53:49 -0600 |
---|---|---|
committer | Eugene Sandulenko | 2018-08-18 16:30:05 +0200 |
commit | 4db0f20f4797ae909edb785e9a8b03c095386feb (patch) | |
tree | 3af5adf4531aafdf4e786b20d0d72a09610c6a07 | |
parent | 2f872168647e0dc4d87f449ed283b830716ad78e (diff) | |
download | scummvm-rg350-4db0f20f4797ae909edb785e9a8b03c095386feb.tar.gz scummvm-rg350-4db0f20f4797ae909edb785e9a8b03c095386feb.tar.bz2 scummvm-rg350-4db0f20f4797ae909edb785e9a8b03c095386feb.zip |
GOB: Replace use of strdup with Common::String
-rw-r--r-- | engines/gob/demos/demoplayer.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/engines/gob/demos/demoplayer.cpp b/engines/gob/demos/demoplayer.cpp index 4812301a6b..92e829d1bb 100644 --- a/engines/gob/demos/demoplayer.cpp +++ b/engines/gob/demos/demoplayer.cpp @@ -130,19 +130,18 @@ void DemoPlayer::clearScreen() { void DemoPlayer::playVideo(const char *fileName) { uint32 waitTime = 0; - char *file, *filePtr; - - file = filePtr = strdup(fileName); + Common::String filePtr(fileName); + Common::String::iterator file = filePtr.begin(); // Trimming spaces front while (*file == ' ') file++; - char *spaceBack = strchr(file, ' '); - if (spaceBack) { - char *nextSpace = strchr(spaceBack, ' '); + Common::String::iterator spaceBack = Common::find(file, filePtr.end(), ' '); + if (spaceBack != filePtr.end()) { + Common::String::iterator nextSpace = Common::find(spaceBack, filePtr.end(), ' '); - if (nextSpace) + if (nextSpace != filePtr.end()) *nextSpace = '\0'; *spaceBack++ = '\0'; @@ -180,9 +179,6 @@ void DemoPlayer::playVideo(const char *fileName) { if (waitTime > 0) _vm->_util->longDelay(waitTime); } - - - free(filePtr); } void DemoPlayer::playADL(const char *params) { |