Author: suokko
Date: Wed May 28 11:38:05 2008
New Revision: 26895
URL: http://svn.gna.org/viewcvs/wesnoth?rev=26895&view=rev
Log:
* Fixed tokenizer not to strip CR from quoted string becaue it would destroy
images transfered over network
Modified:
branches/1.4/changelog
branches/1.4/src/serialization/tokenizer.cpp
branches/1.4/src/serialization/tokenizer.hpp
Modified: branches/1.4/changelog
URL:
http://svn.gna.org/viewcvs/wesnoth/branches/1.4/changelog?rev=26895&r1=26894&r2=26895&view=diff
==============================================================================
--- branches/1.4/changelog (original)
+++ branches/1.4/changelog Wed May 28 11:38:05 2008
@@ -24,6 +24,8 @@
* Fixed a mememory leak in networking code
* fixed an alignement issue which caused a SIGBUS on a Sparc
(debian bug #426318)
+ * Fixed tokenizer not to strip CR from quoted string becaue it would destroy
+ images transfered over network
* added some includes to fix compilation problems with Sun Studio 12
(patch #1066)
* fixed null-pointer reference in network code
Modified: branches/1.4/src/serialization/tokenizer.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/branches/1.4/src/serialization/tokenizer.cpp?rev=26895&r1=26894&r2=26895&view=diff
==============================================================================
--- branches/1.4/src/serialization/tokenizer.cpp (original)
+++ branches/1.4/src/serialization/tokenizer.cpp Wed May 28 11:38:05 2008
@@ -146,20 +146,23 @@
case '"':
token_.type = token::QSTRING;
while (1) {
- next_char();
+ /** Have to use next_char_no_strip
+ * because we will break image ifwe do striping
+ **/
+ next_char_no_strip();
if(current_ == EOF) {
token_.type = token::UNTERMINATED_QSTRING;
break;
}
- if(current_ == '"' && peek_char() != '"')
+ if(current_ == '"' && peek_char_no_strip() != '"')
break;
- if(current_ == '"' && peek_char() == '"')
- next_char_fast();
+ if(current_ == '"' && peek_char_no_strip() == '"')
+ next_char_fast_no_strip();
if (current_ == 254 &&
- (peek_char() == 'l' || peek_char() ==
't')) {
- next_char_fast();
- if ((current_ == 'l' && peek_char() == 'i') ||
(current_ == 't' && peek_char() == 'e'))
+ (peek_char_no_strip() == 'l' ||
peek_char_no_strip() == 't')) {
+ next_char_fast_no_strip();
+ if ((current_ == 'l' && peek_char_no_strip() ==
'i') || (current_ == 't' && peek_char_no_strip() == 'e'))
{
skip_comment();
--lineno_;
Modified: branches/1.4/src/serialization/tokenizer.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/branches/1.4/src/serialization/tokenizer.hpp?rev=26895&r1=26894&r2=26895&view=diff
==============================================================================
--- branches/1.4/src/serialization/tokenizer.hpp (original)
+++ branches/1.4/src/serialization/tokenizer.hpp Wed May 28 11:38:05 2008
@@ -71,6 +71,26 @@
int current_;
size_t lineno_;
+ inline void next_char_no_strip()
+ {
+ if (UNLIKELY(current_ == '\n'))
+ lineno_++;
+ this->next_char_fast_no_strip();
+ }
+
+ inline void next_char_fast_no_strip()
+ {
+ if (LIKELY(in_.good()))
+ {
+ current_ = in_.get();
+ }
+ else
+ {
+ current_ = EOF;
+ return;
+ }
+ }
+
inline void next_char()
{
if (UNLIKELY(current_ == '\n'))
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits