[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src/serialization binary_or_text.cpp bi...
From: |
Guillaume Melquiond |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src/serialization binary_or_text.cpp bi... |
Date: |
Sat, 26 Mar 2005 06:11:10 -0500 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Guillaume Melquiond <address@hidden> 05/03/26 11:11:10
Modified files:
src/serialization: binary_or_text.cpp binary_wml.cpp
Log message:
Strengthen the test for binary files a bit. And rewrite once again the
literal input function, it's only the third time in less than 24 hours...
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/serialization/binary_or_text.cpp.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/serialization/binary_wml.cpp.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
Patches:
Index: wesnoth/src/serialization/binary_or_text.cpp
diff -u wesnoth/src/serialization/binary_or_text.cpp:1.5
wesnoth/src/serialization/binary_or_text.cpp:1.6
--- wesnoth/src/serialization/binary_or_text.cpp:1.5 Sat Mar 26 09:06:17 2005
+++ wesnoth/src/serialization/binary_or_text.cpp Sat Mar 26 11:11:10 2005
@@ -1,4 +1,4 @@
-/* $Id: binary_or_text.cpp,v 1.5 2005/03/26 09:06:17 silene Exp $ */
+/* $Id: binary_or_text.cpp,v 1.6 2005/03/26 11:11:10 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Copyright (C) 2005 by Guillaume Melquiond <address@hidden>
@@ -22,7 +22,7 @@
bool detect_format_and_read(config &cfg, std::istream &in)
{
unsigned char c = in.peek();
- if (c < 5) {
+ if (c < 4) {
read_compressed(cfg, in);
return true;
} else {
Index: wesnoth/src/serialization/binary_wml.cpp
diff -u wesnoth/src/serialization/binary_wml.cpp:1.7
wesnoth/src/serialization/binary_wml.cpp:1.8
--- wesnoth/src/serialization/binary_wml.cpp:1.7 Sat Mar 26 09:48:25 2005
+++ wesnoth/src/serialization/binary_wml.cpp Sat Mar 26 11:11:10 2005
@@ -1,4 +1,4 @@
-/* $Id: binary_wml.cpp,v 1.7 2005/03/26 09:48:25 silene Exp $ */
+/* $Id: binary_wml.cpp,v 1.8 2005/03/26 11:11:10 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Copyright (C) 2005 by Guillaume Melquiond <address@hidden>
@@ -113,12 +113,11 @@
static std::string compress_read_literal_word(std::istream &in)
{
- std::stringstream stream;
- if (in.peek()) // this conditional works around the failure of the
empty word
- in.get(*stream.rdbuf(), 0);
- if (in.get() || !in.good())
+ std::string buffer;
+ std::getline(in, buffer, '\0');
+ if (!in.good())
throw config::error("Unexpected end of data in compressed
config read");
- return stream.str();
+ return buffer;
}
static void write_compressed_internal(std::ostream &out, config const &cfg,
compression_schema &schema, int level)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Wesnoth-cvs-commits] wesnoth/src/serialization binary_or_text.cpp bi...,
Guillaume Melquiond <=