[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src/serialization string_utils.cpp
From: |
Philippe Plantier |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src/serialization string_utils.cpp |
Date: |
Sun, 06 Mar 2005 05:46:28 -0500 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Philippe Plantier <address@hidden> 05/03/06 10:46:28
Modified files:
src/serialization: string_utils.cpp
Log message:
Fixed a bug where the UTD8-decoding iterator would try to decode
characters at
the end of a string.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/serialization/string_utils.cpp.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
Patches:
Index: wesnoth/src/serialization/string_utils.cpp
diff -u wesnoth/src/serialization/string_utils.cpp:1.5
wesnoth/src/serialization/string_utils.cpp:1.6
--- wesnoth/src/serialization/string_utils.cpp:1.5 Thu Mar 3 21:52:40 2005
+++ wesnoth/src/serialization/string_utils.cpp Sun Mar 6 10:46:27 2005
@@ -1,4 +1,4 @@
-/* $Id: string_utils.cpp,v 1.5 2005/03/03 21:52:40 gruikya Exp $ */
+/* $Id: string_utils.cpp,v 1.6 2005/03/06 10:46:27 gruikya Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Copyright (C) 2005 by Guillaume Melquiond <address@hidden>
@@ -384,13 +384,17 @@
void utf8_iterator::update()
{
+ // Do not try to update the current unicode char at end-of-string.
+ if(current_substr.first == string_end)
+ return;
+
size_t size = byte_size_from_utf8_first(*current_substr.first);
current_substr.second = current_substr.first + size;
current_char = (unsigned char)(*current_substr.first);
/* Convert the first character */
- if (size != 1) {
+ if(size != 1) {
current_char &= 0xFF >> (size + 1);
}