Permalink
Browse files

SCUMM: Replace use of strdup with Common::String

  • Loading branch information...
csnover authored and sev- committed Dec 5, 2017
1 parent f7e05a6 commit 072a52a9d25dfcc59ba7d18049cc29cd17acaffa
Showing with 3 additions and 4 deletions.
  1. +3 −4 engines/scumm/smush/smush_font.cpp
@@ -22,6 +22,7 @@


#include "common/file.h"
#include "common/str.h"
#include "scumm/scumm.h"
#include "scumm/util.h"

@@ -226,11 +227,11 @@ void SmushFont::drawStringWrap(const char *str, byte *buffer, int dst_width, int
debugC(DEBUG_SMUSH, "SmushFont::drawStringWrap(%s, %d, %d, %d, %d, %d)", str, x, y, left, right, center);

const int width = right - left;
char *s = strdup(str);
Common::String s(str);
char *words[MAX_WORDS];
int word_count = 0;

char *tmp = s;
Common::String::iterator tmp = s.begin();
while (tmp) {
assert(word_count < MAX_WORDS);
words[word_count++] = tmp;
@@ -293,8 +294,6 @@ void SmushFont::drawStringWrap(const char *str, byte *buffer, int dst_width, int
y += getStringHeight(substrings[i]);
}
}

free(s);
}

} // End of namespace Scumm

0 comments on commit 072a52a

Please sign in to comment.