[Top][All Lists]
[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 06:09:48 -0400 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Guillaume Melquiond <address@hidden> 05/05/14 10:09:48
Modified files:
src/serialization: preprocessor.cpp
Log message:
Fix tips of the day not being translated. Do not discard the buffer on
the very first underflow, it may already contain data, especially the
textdomain.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/serialization/preprocessor.cpp.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
Patches:
Index: wesnoth/src/serialization/preprocessor.cpp
diff -u wesnoth/src/serialization/preprocessor.cpp:1.16
wesnoth/src/serialization/preprocessor.cpp:1.17
--- wesnoth/src/serialization/preprocessor.cpp:1.16 Sat May 14 09:43:55 2005
+++ wesnoth/src/serialization/preprocessor.cpp Sat May 14 10:09:48 2005
@@ -1,4 +1,4 @@
-/* $Id: preprocessor.cpp,v 1.16 2005/05/14 09:43:55 silene Exp $ */
+/* $Id: preprocessor.cpp,v 1.17 2005/05/14 10:09:48 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Copyright (C) 2005 by Guillaume Melquiond <address@hidden>
@@ -96,17 +96,20 @@
int preprocessor_streambuf::underflow()
{
- if (gptr() < egptr())
- return *gptr();
- // the buffer has been completely read; fill it again
- // keep part of the previous buffer, to ensure putback capabilities
- unsigned sz = out_buffer_.size();
- if (sz > 3) {
- out_buffer_ = out_buffer_.substr(sz - 3);
- sz = 3;
+ unsigned sz = 0;
+ if (char *gp = gptr()) {
+ if (gp < egptr())
+ return *gp;
+ // the buffer has been completely read; fill it again
+ // keep part of the previous buffer, to ensure putback
capabilities
+ sz = out_buffer_.size();
+ if (sz > 3) {
+ out_buffer_ = out_buffer_.substr(sz - 3);
+ sz = 3;
+ }
+ buffer_.str(std::string());
+ buffer_ << out_buffer_;
}
- buffer_.str(std::string());
- buffer_ << out_buffer_;
while (current_) {
if (current_->get_chunk()) {
if (buffer_.str().size() >= 2000)