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

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

[Wesnoth-cvs-commits] wesnoth/src config.cpp multiplayer_wait.cpp ser...


From: Philippe Plantier
Subject: [Wesnoth-cvs-commits] wesnoth/src config.cpp multiplayer_wait.cpp ser...
Date: Mon, 14 Mar 2005 16:07:36 -0500

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Philippe Plantier <address@hidden>      05/03/14 21:07:36

Modified files:
        src            : config.cpp multiplayer_wait.cpp 
        src/server     : server.cpp 

Log message:
        * Fixed bug #12287: game crashing on multiplayer screen
        
        * Made config::apply_diff log an error and quit instead of failing an 
assertion
        on an invalid diff. This will prevent games to be crashed remotely.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/config.cpp.diff?tr1=1.131&tr2=1.132&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_wait.cpp.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/server/server.cpp.diff?tr1=1.72&tr2=1.73&r1=text&r2=text

Patches:
Index: wesnoth/src/config.cpp
diff -u wesnoth/src/config.cpp:1.131 wesnoth/src/config.cpp:1.132
--- wesnoth/src/config.cpp:1.131        Sun Mar  6 18:12:16 2005
+++ wesnoth/src/config.cpp      Mon Mar 14 21:07:36 2005
@@ -1,4 +1,4 @@
-/* $Id: config.cpp,v 1.131 2005/03/06 18:12:16 ydirson Exp $ */
+/* $Id: config.cpp,v 1.132 2005/03/14 21:07:36 gruikya Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -15,10 +15,12 @@
 
 #include <algorithm>
 #include <sstream>
-
 #include "config.hpp"
 #include "variable.hpp"
 #include "wassert.hpp"
+#include "log.hpp"
+
+#define ERR_CF lg::err(lg::config)
 
 config::config(const config& cfg)
 {
@@ -186,7 +188,12 @@
 
        //remove from the child map
        child_list& v = children[key];
-       wassert(index < v.size());
+       //wassert(index < v.size());
+       if(index >= v.size()) {
+               ERR_CF << "Error: attempting to delete non-existing child: " 
+                       << key << "[" << index << "]\n";
+               return;
+       }
        config* const res = v[index];
        v.erase(v.begin()+index);
        delete res;
Index: wesnoth/src/multiplayer_wait.cpp
diff -u wesnoth/src/multiplayer_wait.cpp:1.11 
wesnoth/src/multiplayer_wait.cpp:1.12
--- wesnoth/src/multiplayer_wait.cpp:1.11       Thu Mar 10 22:29:57 2005
+++ wesnoth/src/multiplayer_wait.cpp    Mon Mar 14 21:07:36 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_wait.cpp,v 1.11 2005/03/10 22:29:57 ydirson Exp $ */
+/* $Id: multiplayer_wait.cpp,v 1.12 2005/03/14 21:07:36 gruikya Exp $ */
 /*
    Copyright (C) 
    Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -332,7 +332,7 @@
                set_result(QUIT);
                return;
        } else if(data.child("scenario_diff")) {
-               LOG_NW << "received diff for scenario....applying...\n";
+               LOG_NW << "received diff for scenario... applying...\n";
                level_.apply_diff(*data.child("scenario_diff"));
                generate_menu();
        } else if(data.child("side")) {
Index: wesnoth/src/server/server.cpp
diff -u wesnoth/src/server/server.cpp:1.72 wesnoth/src/server/server.cpp:1.73
--- wesnoth/src/server/server.cpp:1.72  Thu Mar 10 20:59:20 2005
+++ wesnoth/src/server/server.cpp       Mon Mar 14 21:07:36 2005
@@ -373,8 +373,8 @@
        //check the username is valid (all alpha-numeric or space)
        std::string username = (*login)["username"];
        utils::strip(username);
-       const int alnum = 
std::count_if(username.begin(),username.end(),isalnum);
-       const int spaces = std::count(username.begin(),username.end(),' ');
+       const size_t alnum = 
std::count_if(username.begin(),username.end(),isalnum);
+       const size_t spaces = std::count(username.begin(),username.end(),' ');
        if((alnum + spaces != username.size()) || spaces == username.size() || 
username.empty()) {
                network::send_data(construct_error(
                                   "This username is not valid"),sock);
@@ -630,7 +630,6 @@
        else if(g->is_owner(sock) && data.child("scenario_diff")) {
                g->level().apply_diff(*data.child("scenario_diff"));
                g->update_side_data();
-               g->send_data(data,sock);
 
                const bool lobby_changes = g->describe_slots();
                if(lobby_changes) {




reply via email to

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