mail[Wesnoth-commits] r28939 - in /trunk/src: ./ serialization/


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by koraq on August 24, 2008 - 18:12:
Author: mordante
Date: Sun Aug 24 18:12:22 2008
New Revision: 28939

URL: http://svn.gna.org/viewcvs/wesnoth?rev=28939&view=rev
Log:
MSVC 6 cleanup.

Now that MSVC 6 is no longer supported start to remove some helper code
to work around problems in that compiler. The first step is to comment
out the code and replace it with new helper code that uses the standard.
The second step is to remove the helper code and fix all callers.

Patch 3/3 for step 2: Remove push_back and fix it's callers.

Modified:
    trunk/src/builder.cpp
    trunk/src/marked-up_text.cpp
    trunk/src/play_controller.cpp
    trunk/src/serialization/string_utils.cpp
    trunk/src/statistics.cpp
    trunk/src/util.hpp

Modified: trunk/src/builder.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/builder.cpp?rev=28939&r1=28938&r2=28939&view=diff
==============================================================================
--- trunk/src/builder.cpp (original)
+++ trunk/src/builder.cpp Sun Aug 24 18:12:22 2008
@@ -525,7 +525,7 @@
        for(int i = 0; i < 6; ++i) {
                int a = (angle+i) % 6;
                std::string token = "@R";
-               push_back(token,'0' + i);
+               token.push_back('0' + i);
                replace_token(ret, token, rot[a]);
        }
 

Modified: trunk/src/marked-up_text.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/marked-up_text.cpp?rev=28939&r1=28938&r2=28939&view=diff
==============================================================================
--- trunk/src/marked-up_text.cpp (original)
+++ trunk/src/marked-up_text.cpp Sun Aug 24 18:12:22 2008
@@ -505,7 +505,7 @@
        for(std::string::iterator i = message.begin(); i != message.end(); 
++i) {
                if(at_start) {
                        if(font::is_format_char(*i)) {
-                               push_back(starting_markup,*i);
+                               starting_markup.push_back(*i);
                        } else {
                                at_start = false;
                        }

Modified: trunk/src/play_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/play_controller.cpp?rev=28939&r1=28938&r2=28939&view=diff
==============================================================================
--- trunk/src/play_controller.cpp (original)
+++ trunk/src/play_controller.cpp Sun Aug 24 18:12:22 2008
@@ -850,7 +850,7 @@
                                        std::string newitem = 
itor->second->description;
 
                                        // Prevent accidental hotkey binding 
by appending a space
-                                       push_back<std::string, char>(newitem, 
' ');
+                                       newitem.push_back(' ');
                                        newitems.push_back(newitem);
                                }
                        }

Modified: trunk/src/serialization/string_utils.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/serialization/string_utils.cpp?rev=28939&r1=28938&r2=28939&view=diff
==============================================================================
--- trunk/src/serialization/string_utils.cpp (original)
+++ trunk/src/serialization/string_utils.cpp Sun Aug 24 18:12:22 2008
@@ -22,7 +22,6 @@
 #include <cctype>
 #include <sstream>
 #include "gettext.hpp"
-#include "util.hpp"
 #include "log.hpp"
 #include "serialization/string_utils.hpp"
 #include "wctype.h"
@@ -752,7 +751,7 @@
                        }
 
                        if(count == 1) {
-                               push_back(ret,static_cast<char>(ch));
+                               ret.push_back(static_cast<char>(ch));
                        } else {
                                for(int j = static_cast<int>(count) - 1; j >= 
0; --j) {
                                        unsigned char c = (ch >> (6 * j)) & 
0x3f;
@@ -760,7 +759,7 @@
                                        if(j == static_cast<int>(count) - 1) {
                                                c |= 0xff << (8 - count);
                                        }
-                                       push_back(ret, c);
+                                       ret.push_back(c);
                                }
                        }
 
@@ -791,7 +790,7 @@
 
                // Equivalent to res.insert(res.end(),i1,i2) which doesn't 
work on VC++6.
                while(i1 != i2) {
-                       push_back(res,*i1);
+                       res.push_back(*i1);
                        ++i1;
                }
        }

Modified: trunk/src/statistics.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/statistics.cpp?rev=28939&r1=28938&r2=28939&view=diff
==============================================================================
--- trunk/src/statistics.cpp (original)
+++ trunk/src/statistics.cpp Sun Aug 24 18:12:22 2008
@@ -20,7 +20,6 @@
 #include "global.hpp"
 #include "config.hpp"
 #include "statistics.hpp"
-#include "util.hpp"
 #include "log.hpp"
 #include "serialization/binary_or_text.hpp"
 #include "unit.hpp"
@@ -521,7 +520,7 @@
        if(stats_disabled > 0)
                return;
 
-       push_back(attacker_res,(res == MISSES ? '0' : '1'));
+       attacker_res.push_back(res == MISSES ? '0' : '1');
 
        if(res != MISSES) {
                // handle drain
@@ -560,7 +559,7 @@
        if(stats_disabled > 0)
                return;
 
-       push_back(defender_res,(res == MISSES ? '0' : '1'));
+       defender_res.push_back(res == MISSES ? '0' : '1');
 
 
        if(res != MISSES) {

Modified: trunk/src/util.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/util.hpp?rev=28939&r1=28938&r2=28939&view=diff
==============================================================================
--- trunk/src/util.hpp (original)
+++ trunk/src/util.hpp Sun Aug 24 18:12:22 2008
@@ -138,27 +138,6 @@
 inline bool chars_equal_insensitive(char a, char b) { return tolower(a) == 
tolower(b); }
 inline bool chars_less_insensitive(char a, char b) { return tolower(a) < 
tolower(b); }
 
-#if 0
-/**
- *  A definition of 'push_back' for strings,
- * since some implementations don't support string::push_back
- */
-template<typename T, typename C>
-void push_back(T& str, C c)
-{
-       str.resize(str.size()+1);
-       str[str.size()-1] = c;
-}
-#else
-
-template<typename T, typename C>
-void push_back(T& str, C c)
-{      
-       str.push_back(c);
-}
-
-#endif
-
 #ifdef __GNUC__
 #define LIKELY(a)    __builtin_expect((a),1) // Tells GCC to optimize code 
so that if is likely to happen
 #define UNLIKELY(a)  __builtin_expect((a),0) // Tells GCC to optimize code 
so that if is unlikely to happen




Related Messages


Powered by MHonArc, Updated Sun Aug 24 18:21:24 2008