Permalink
Browse files

GOB: Replace use of strdup with Common::String

  • Loading branch information...
csnover authored and sev- committed Dec 5, 2017
1 parent 2f87216 commit 4db0f20f4797ae909edb785e9a8b03c095386feb
Showing with 6 additions and 10 deletions.
  1. +6 −10 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) {

0 comments on commit 4db0f20

Please sign in to comment.