Author: suokko
Date: Tue Feb 26 15:02:36 2008
New Revision: 24079
URL: http://svn.gna.org/viewcvs/wesnoth?rev=24079&view=rev
Log:
Fixed parser problems with \r\r in files
Modified:
trunk/changelog
trunk/src/campaign_server/campaign_server.cpp
trunk/src/serialization/tokenizer.hpp
Modified: trunk/changelog
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=24079&r1=24078&r2=24079&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Tue Feb 26 15:02:36 2008
@@ -14,6 +14,7 @@
* miscellaneous and bug fixes:
* units with a death sound but no death animation now play their death
sound correctly
+ * Fixed parser problems with \r\r in files
* cleanups and a compiler fix based on patch #911
* the detection of the savegame version was done after parsing the savegame
this could lead to crashes when loading 1.2 savegames (debian bug 467088)
Modified: trunk/src/campaign_server/campaign_server.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/campaign_server/campaign_server.cpp?rev=24079&r1=24078&r2=24079&view=diff
==============================================================================
--- trunk/src/campaign_server/campaign_server.cpp (original)
+++ trunk/src/campaign_server/campaign_server.cpp Tue Feb 26 15:02:36 2008
@@ -139,23 +139,6 @@
const int num_suffix = 3;
const char* fname_suffix[] =
{".cfg",".map",".txt",".py",".tree",".po",".gmo"};
- void clean_cr(config& cfg)
- {
- for (int i = 0; i < num_suffix; ++i)
- {
- std::vector<config *> files = find_scripts(cfg,
fname_suffix[i]);
- std::vector<config *>::iterator file;
- for (file = files.begin(); file != files.end(); ++file)
- {
- std::string contents = (**file)["contents"];
- size_t size =
std::remove(contents.begin(),contents.end(),'\r')-contents.begin();
- contents.resize(size);
- (**file)["contents"] = contents;
- }
- }
-
- }
-
void find_translations(const config& cfg, config& campaign)
{
const config::child_list& dirs = cfg.get_children("dir");
@@ -395,7 +378,6 @@
(*data)["translate"] = (*campaign)["translate"];
(*campaign).clear_children("translation");
find_translations(*data, *campaign);
- clean_cr(*data);
scoped_ostream
campaign_file = ostream_file(filename);
write_compressed(*campaign_file, *data);
@@ -450,7 +432,6 @@
(*data)["icon"] =
(*campaign)["icon"];
(*campaign).clear_children("translation");
find_translations(*data, *campaign);
- clean_cr(*data);
// Campaigns which have
python="allowed" are not checked
if
((*campaign)["python"] != "allowed") {
Modified: trunk/src/serialization/tokenizer.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/serialization/tokenizer.hpp?rev=24079&r1=24078&r2=24079&view=diff
==============================================================================
--- trunk/src/serialization/tokenizer.hpp (original)
+++ trunk/src/serialization/tokenizer.hpp Tue Feb 26 15:02:36 2008
@@ -80,6 +80,19 @@
inline void next_char_fast()
{
+ do {
+ if (LIKELY(in_.good()))
+ {
+ current_ = in_.get();
+ }
+ else
+ {
+ current_ = EOF;
+ return;
+ }
+ }while (UNLIKELY(current_ == '\r'))
+#if 0
+ // @todo: disabled untill campaign server is fixed
if(LIKELY(in_.good())) {
current_ = in_.get();
if (UNLIKELY(current_ == '\r'))
@@ -94,6 +107,7 @@
} else {
current_ = EOF;
}
+#endif
}
inline int peek_char() const
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits