CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Guillaume Melquiond <[EMAIL PROTECTED]> 05/03/25 20:10:39

Modified files:
        src/serialization: binary_wml.cpp 

Log message:
        Rewriting an STL function with an utterly inefficient implementation, I 
just like it... Hmm... Right, cleaning up.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/serialization/binary_wml.cpp.diff?tr1=1.5&tr2=1.6&r1=text&r2=text

Patches:
Index: wesnoth/src/serialization/binary_wml.cpp
diff -u wesnoth/src/serialization/binary_wml.cpp:1.5 
wesnoth/src/serialization/binary_wml.cpp:1.6
--- wesnoth/src/serialization/binary_wml.cpp:1.5        Fri Mar 25 19:35:27 2005
+++ wesnoth/src/serialization/binary_wml.cpp    Fri Mar 25 20:10:39 2005
@@ -1,4 +1,4 @@
-/* $Id: binary_wml.cpp,v 1.5 2005/03/25 19:35:27 silene Exp $ */
+/* $Id: binary_wml.cpp,v 1.6 2005/03/25 20:10:39 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <[EMAIL PROTECTED]>
    Copyright (C) 2005 by Guillaume Melquiond <[EMAIL PROTECTED]>
@@ -114,15 +114,9 @@
 static std::string compress_read_literal_word(std::istream &in)
 {
        std::stringstream stream;
-       for(;;) {
-               unsigned char c;
-               c = in.get();
-               if (in.fail())
-                       throw config::error("Unexpected end of data in 
compressed config read\n");
-               if (c == 0)
-                       break;
-               stream.put(c);
-       }
+       in.get(*stream.rdbuf(), 0);
+       if (in.get() || in.fail())
+               throw config::error("Unexpected end of data in compressed 
config read\n");
        return stream.str();
 }
 


Reply via email to