From 4db0f20f4797ae909edb785e9a8b03c095386feb Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Tue, 5 Dec 2017 12:53:49 -0600 Subject: GOB: Replace use of strdup with Common::String --- engines/gob/demos/demoplayer.cpp | 16 ++++++---------- 1 file 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) { -- cgit v1.2.3