Skip to content

Commit

Permalink
GOB: Replace use of strdup with Common::String
Browse files Browse the repository at this point in the history
  • Loading branch information
csnover authored and sev- committed Aug 18, 2018
1 parent 2f87216 commit 4db0f20
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions engines/gob/demos/demoplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 4db0f20

Please sign in to comment.