dbertoni 2003/06/04 21:47:53
Modified: c/src/XMLSupport FormatterToXML.cpp FormatterToXML.hpp
Log:
Fixed bug where surrogate pair is not serialized properly.
Revision Changes Path
1.67 +12 -10 xml-xalan/c/src/XMLSupport/FormatterToXML.cpp
Index: FormatterToXML.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XMLSupport/FormatterToXML.cpp,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- FormatterToXML.cpp 6 Mar 2003 00:18:24 -0000 1.66
+++ FormatterToXML.cpp 5 Jun 2003 04:47:53 -0000 1.67
@@ -776,7 +776,7 @@
-void
+XalanDOMString::size_type
FormatterToXML::accumDefaultEscape(
XalanDOMChar ch,
XalanDOMString::size_type i,
@@ -789,22 +789,22 @@
if (0xd800 <= ch && ch < 0xdc00)
{
// UTF-16 surrogate
- XalanDOMChar next = 0;
+ unsigned long next = 0;
- if (i + 1 >= len)
+ if (i + 1 >= len)
{
throwInvalidUTF16SurrogateException(ch);
}
else
{
- next = chars[i + 1];
+ next = chars[++i];
if (!(0xdc00u <= next && next < 0xe000u))
{
- throwInvalidUTF16SurrogateException(ch,
next);
+ throwInvalidUTF16SurrogateException(ch,
XalanDOMChar(next));
}
- next = XalanDOMChar(((ch - 0xd800u) << 10) +
next - 0xdc00u + 0x00010000u);
+ next = ((ch - 0xd800u) << 10) + next - 0xdc00u
+ 0x00010000u;
}
writeNumberedEntityReference(next);
@@ -821,14 +821,16 @@
}
}
}
+
+ return i;
}
bool
FormatterToXML::accumDefaultEntity(
- XalanDOMChar ch,
- bool escLF)
+ XalanDOMChar ch,
+ bool escLF)
{
if (escLF == false && XalanUnicode::charLF == ch)
{
@@ -1174,7 +1176,7 @@
{
accumContent(chars, firstIndex, i -
firstIndex);
- accumDefaultEscape(ch, i, chars,
length, false);
+ i = accumDefaultEscape(ch, i, chars,
length, false);
++i;
@@ -1235,7 +1237,7 @@
{
accumContent(theString, firstIndex, i - firstIndex);
- accumDefaultEscape(ch, i, theString, theStringLength,
true);
+ i = accumDefaultEscape(ch, i, theString,
theStringLength, true);
++i;
1.44 +4 -4 xml-xalan/c/src/XMLSupport/FormatterToXML.hpp
Index: FormatterToXML.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XMLSupport/FormatterToXML.hpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- FormatterToXML.hpp 6 Mar 2003 00:18:24 -0000 1.43
+++ FormatterToXML.hpp 5 Jun 2003 04:47:53 -0000 1.44
@@ -489,7 +489,7 @@
/**
* Escape and accum a character.
*/
- void
+ XalanDOMString::size_type
accumDefaultEscape(
XalanDOMChar ch,
XalanDOMString::size_type i,
@@ -500,11 +500,11 @@
/**
* Handle one of the default entities, return false if it
* is not a default entity.
- */
+ */
virtual bool
accumDefaultEntity(
- XalanDOMChar ch,
- bool escLF);
+ XalanDOMChar ch,
+ bool escLF);
/**
* Set the attribute characters what will require special mapping.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]