synced with scummvm svn rev 53000

This commit is contained in:
Pawel Kolodziejski 2011-04-11 15:40:01 +02:00
parent 886c17d130
commit 241c7a8c6e
116 changed files with 104334 additions and 1926 deletions

View file

@ -30,11 +30,6 @@
#include <stdarg.h>
#if !defined(__SYMBIAN32__)
#include <new>
#endif
namespace Common {
MemoryPool *g_refCountPool = 0; // FIXME: This is never freed right now
@ -421,7 +416,7 @@ void String::trim() {
// Trim leading whitespace
char *t = _str;
while (isspace(*t))
while (isspace((unsigned char)*t))
t++;
if (t != _str) {
@ -626,7 +621,7 @@ Common::String lastPathComponent(const Common::String &path, const char sep) {
// Now scan the whole component
const char *first = last - 1;
while (first >= str && *first != sep)
while (first > str && *first != sep)
--first;
if (*first == sep)
@ -696,9 +691,18 @@ bool matchString(const char *str, const char *pat, bool ignoreCase, bool pathMod
switch (*pat) {
case '*':
// Record pattern / string position for backtracking
p = ++pat;
q = str;
if (*str) {
// Record pattern / string position for backtracking
p = ++pat;
q = str;
} else {
// If we've reached the end of str, we can't backtrack further
// NB: We can't simply check if pat also ended here, because
// the pattern might end with any number of *s.
++pat;
p = 0;
q = 0;
}
// If pattern ended with * -> match
if (!*pat)
return true;