[Scummvm-cvs-logs] scummvm branch-1-8 -> c9ed79350eaa57896c0d4aa0180bec16cee26bbd

lordhoto lordhoto at gmail.com
Thu Feb 25 21:14:51 CET 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c9ed79350e DREAMCAST: Fix listing of savefiles.


Commit: c9ed79350eaa57896c0d4aa0180bec16cee26bbd
    https://github.com/scummvm/scummvm/commit/c9ed79350eaa57896c0d4aa0180bec16cee26bbd
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2016-02-25T21:14:24+01:00

Commit Message:
DREAMCAST: Fix listing of savefiles.

We introduced a new pattern '#' in 06641f29a7bdcda280b0291f215193f055c83969.
Starting from that commit all backends were supposed to support it. Dreamcast
was missed. To support it in Dreamcast we now use Common::String::matchString
to do pattern matching.

(cherry picked from commit 47f82d439d545a0173ae41d8572ac6e4ba47a5cd)

Changed paths:
    backends/platform/dc/vmsave.cpp



diff --git a/backends/platform/dc/vmsave.cpp b/backends/platform/dc/vmsave.cpp
index 5f5cdff..d7602bd 100644
--- a/backends/platform/dc/vmsave.cpp
+++ b/backends/platform/dc/vmsave.cpp
@@ -165,30 +165,7 @@ static bool tryDelete(const char *filename, int vm)
   return true;
 }
 
-static bool matches(const char *glob, const char *name)
-{
-  while(*glob)
-    if(*glob == '*') {
-      while(*glob == '*')
-	glob++;
-      do {
-	if((*name == *glob || *glob == '?') &&
-	   matches(glob, name))
-	  return true;
-      } while(*name++);
-      return false;
-    } else if(!*name)
-      return false;
-    else if(*glob == '?' || *glob == *name) {
-      glob++;
-      name++;
-    }
-    else
-      return false;
-  return !*name;
-}
-
-static void tryList(const char *glob, int vm, Common::StringArray &list)
+static void tryList(const Common::String &glob, int vm, Common::StringArray &list)
 {
   struct vmsinfo info;
   struct superblock super;
@@ -205,7 +182,7 @@ static void tryList(const char *glob, int vm, Common::StringArray &list)
       char buf[16];
       strncpy(buf, (char *)de.entry+4, 12);
       buf[12] = 0;
-      if (matches(glob, buf))
+      if (glob.matchString(buf))
 	list.push_back(buf);
     }
 }
@@ -425,7 +402,7 @@ Common::StringArray VMSaveManager::listSavefiles(const Common::String &pattern)
   Common::StringArray list;
 
   for (int i=0; i<24; i++)
-    tryList(pattern.c_str(), i, list);
+    tryList(pattern, i, list);
 
   return list;
 }






More information about the Scummvm-git-logs mailing list