wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth src/filesystem.cpp ./changelog


From: Yann Dirson
Subject: [Wesnoth-cvs-commits] wesnoth src/filesystem.cpp ./changelog
Date: Fri, 28 Jan 2005 18:38:53 -0500

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Yann Dirson <address@hidden>    05/01/28 23:38:52

Modified files:
        src            : filesystem.cpp 
        .              : changelog 

Log message:
        be sure not to call std::string::compare() with a negative offset as 
1st argument

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/filesystem.cpp.diff?tr1=1.58&tr2=1.59&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/changelog.diff?tr1=1.469&tr2=1.470&r1=text&r2=text

Patches:
Index: wesnoth/changelog
diff -u wesnoth/changelog:1.469 wesnoth/changelog:1.470
--- wesnoth/changelog:1.469     Fri Jan 28 16:07:18 2005
+++ wesnoth/changelog   Fri Jan 28 23:38:52 2005
@@ -11,6 +11,7 @@
  * fixed editor to work with zipios support enabled
  * fixed zipios support to honor path to data given on command-line
  * new cmd line option --fps to display frames/second refresh in game
+ * fixed zipios support crashes when running from CVS
  * fixed bugs when replacing player with observer in mp
  * fixed several pathfinding bugs
  * code cleanups
Index: wesnoth/src/filesystem.cpp
diff -u wesnoth/src/filesystem.cpp:1.58 wesnoth/src/filesystem.cpp:1.59
--- wesnoth/src/filesystem.cpp:1.58     Thu Jan 27 22:20:41 2005
+++ wesnoth/src/filesystem.cpp  Fri Jan 28 23:38:52 2005
@@ -1,4 +1,4 @@
-/* $Id: filesystem.cpp,v 1.58 2005/01/27 22:20:41 ydirson Exp $ */
+/* $Id: filesystem.cpp,v 1.59 2005/01/28 23:38:52 ydirson Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -85,7 +85,8 @@
                        if ((**i).isValid()) {
                                const std::string fname = (**i).getName();
                                const std::string suffix = ".zip";
-                               if (0 == fname.compare(fname.size() - 
suffix.size(), suffix.size(), suffix)) {
+                               if ((fname.size() > suffix.size()) &&
+                                   (0 == fname.compare(fname.size() - 
suffix.size(), suffix.size(), suffix))) {
                                        zipios::ZipFile zip(game_config::path + 
"/" + fname);
                                        the_collection.addCollection(zip);
                                        LOG_G << "zip collection " << fname << 
@@ -103,14 +104,14 @@
 {
 #ifdef USE_ZIPIOS
        if (!get_user_data_dir().empty()) {
-               LOG_G << "looking at dir " << get_user_data_dir() << "\n";
+               LOG_G << "looking at user dir " << get_user_data_dir() << "\n";
                zipios::DirectoryCollection dir(get_user_data_dir());
                LOG_G << "user collection has " << dir.size() << " elements\n";
                the_collection.addCollection(dir);
                register_zipdir(get_user_data_dir());
        }
        if (!game_config::path.empty()) {
-               LOG_G << "looking at dir " << game_config::path << "\n";
+               LOG_G << "looking at system dir " << game_config::path << "\n";
                zipios::DirectoryCollection dir(game_config::path);
                LOG_G << "system collection has " << dir.size() << " 
elements\n";
                the_collection.addCollection(dir);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]