Author: suokko
Date: Sat Jul  5 01:35:02 2008
New Revision: 27739

URL: http://svn.gna.org/viewcvs/wesnoth?rev=27739&view=rev
Log:
* Fixed text parser to strip CRs
* Made addons upload/downloads escape CR which forces reupload for anyone 
having binary data in addon

Modified:
    trunk/changelog
    trunk/src/addon_management.cpp
    trunk/src/serialization/tokenizer.cpp
    trunk/src/serialization/tokenizer.hpp

Modified: trunk/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=27739&r1=27738&r2=27739&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Sat Jul  5 01:35:02 2008
@@ -33,6 +33,8 @@
    * Fixed statitics not add turn data from previus scenarios (bug: #11719)
    * Fixed manager to initialize before gamestate in playcontroller (bug: 
11935)
    * Removed persistance from team configuration (bug: #10916)
+   * Fixed text parser again strip cr from configs. Added CR and 254 to be
+     escaped in campaign upload. All UMC has to be reuploaded to server
    * Made automaticaly generated macro reference easier to naviagate and link 
to
      (patch: #1076)
    * Allow [unit_type] num_traits=0 to override race's num_traits.

Modified: trunk/src/addon_management.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/addon_management.cpp?rev=27739&r1=27738&r2=27739&view=diff
==============================================================================
--- trunk/src/addon_management.cpp (original)
+++ trunk/src/addon_management.cpp Sat Jul  5 01:35:02 2008
@@ -105,7 +105,7 @@
        const char escape_char = 1;
 }
 
-static bool needs_escaping(char c) { return c == 0 || c == escape_char; }
+static bool needs_escaping(char c) { return c == 0 || c == escape_char || c == 
13 || c == 254; }
 
 static bool IsCR(const char& c)
 {

Modified: trunk/src/serialization/tokenizer.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/serialization/tokenizer.cpp?rev=27739&r1=27738&r2=27739&view=diff
==============================================================================
--- trunk/src/serialization/tokenizer.cpp (original)
+++ trunk/src/serialization/tokenizer.cpp Sat Jul  5 01:35:02 2008
@@ -146,10 +146,7 @@
        case '"':
                token_.type = token::QSTRING;
                while (1) {
-                       /** Have to use next_char_no_strip 
-                        * because we will break image ifwe do striping
-                        **/
-                       next_char_no_strip();
+                       next_char();
 
                        if(current_ == EOF) {
                                token_.type = token::UNTERMINATED_QSTRING;
@@ -158,20 +155,11 @@
                        if(current_ == '"' && peek_char() != '"')
                                break;
                        if(current_ == '"' && peek_char() == '"')
-                               next_char_fast_no_strip();
-                       if (current_ == 254 && 
-                                       (peek_char() == 'l' || peek_char() == 
't')) {
-                               next_char_fast_no_strip();
-                               if ((current_ == 'l' && peek_char() == 'i') || 
(current_ == 't' && peek_char() == 'e'))
-                               {
-                                       skip_comment();
-                                       --lineno_;
-                                       continue;
-                               }
-                               else
-                               {
-                                       token_.value += 254;
-                               }
+                               next_char_fast();
+                       if (current_ == 254 ) {
+                               skip_comment();
+                               --lineno_;
+                               continue;
                        }
 
                        token_.value += current_;

Modified: trunk/src/serialization/tokenizer.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/serialization/tokenizer.hpp?rev=27739&r1=27738&r2=27739&view=diff
==============================================================================
--- trunk/src/serialization/tokenizer.hpp (original)
+++ trunk/src/serialization/tokenizer.hpp Sat Jul  5 01:35:02 2008
@@ -71,26 +71,6 @@
        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

Reply via email to