wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth/src/serialization preprocessor.cpp


From: Guillaume Melquiond
Subject: [Wesnoth-cvs-commits] wesnoth/src/serialization preprocessor.cpp
Date: Sat, 14 May 2005 05:44:00 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Guillaume Melquiond <address@hidden>    05/05/14 09:43:59

Modified files:
        src/serialization: preprocessor.cpp 

Log message:
        Fix bug #13067; a quoted string must end before poping the context. Fix 
textdomain not being comments; it induced corrupted domains due to line 
numbering. Speedup the preprocessor: context is useless on the fast path.

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

Patches:
Index: wesnoth/src/serialization/preprocessor.cpp
diff -u wesnoth/src/serialization/preprocessor.cpp:1.15 
wesnoth/src/serialization/preprocessor.cpp:1.16
--- wesnoth/src/serialization/preprocessor.cpp:1.15     Sat May 14 07:49:51 2005
+++ wesnoth/src/serialization/preprocessor.cpp  Sat May 14 09:43:55 2005
@@ -1,4 +1,4 @@
-/* $Id: preprocessor.cpp,v 1.15 2005/05/14 07:49:51 silene Exp $ */
+/* $Id: preprocessor.cpp,v 1.16 2005/05/14 09:43:55 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Copyright (C) 2005 by Guillaume Melquiond <address@hidden>
@@ -234,7 +234,7 @@
        token_desc token = { t, strings_.size(), linenum_ };
        tokens_.push_back(token);
        std::ostringstream s;
-       if (!skipping_) {
+       if (!skipping_ && slowpath_) {
                s << "\376line " << linenum_ << ' ' << target_.location_
                  << "\n\376textdomain " << target_.textdomain_ << '\n';
        }
@@ -372,15 +372,20 @@
        } else if (c == '"') {
                if (token.type == '"') {
                        target_.quoted_ = false;
-                       std::string tmp = strings_.back();
-                       pop_token();
-                       put(tmp);
+                       put(c);
+                       if (!skipping_ && slowpath_) {
+                               std::string tmp = strings_.back();
+                               pop_token();
+                               strings_.back() += tmp;
+                       } else
+                               pop_token();
                        char &t = tokens_.back().type;
                        if (t == '{')
                                t = '[';
                } else if (!target_.quoted_) {
                        target_.quoted_ = true;
                        push_token('"');
+                       put(c);
                } else {
                        std::ostringstream error;
                        error << "nested quoted string started at "
@@ -388,7 +393,6 @@
                        ERR_CF << error.str() << '\n';
                        throw config::error(error.str());
                }
-               put(c);
        } else if (c == '{') {
                push_token('{');
                ++slowpath_;
@@ -488,6 +492,7 @@
                        put("#textdomain ");
                        put(s);
                        target_.textdomain_ = s;
+                       comment = true;
                } else if (command == "enddef") {
                        std::ostringstream error;
                        error << "unexpected #enddef at "




reply via email to

[Prev in Thread] Current Thread [Next in Thread]