dbertoni 2003/01/07 22:56:10
Modified: c/src/XMLSupport FormatterToXML.cpp FormatterToXML.hpp
Log:
Use more optimistic algorithm to accumulate content. Removed unnecessary
code and parameters.
Revision Changes Path
1.65 +31 -19 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.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- FormatterToXML.cpp 20 Nov 2002 02:32:13 -0000 1.64
+++ FormatterToXML.cpp 8 Jan 2003 06:56:10 -0000 1.65
@@ -774,7 +774,7 @@
XalanDOMString::size_type len,
bool escLF)
{
- if(!accumDefaultEntity(ch, i, chars, len, escLF))
+ if(!accumDefaultEntity(ch, escLF))
{
if (0xd800 <= ch && ch < 0xdc00)
{
@@ -787,7 +787,7 @@
}
else
{
- next = chars[++i];
+ next = chars[i + 1];
if (!(0xdc00u <= next && next < 0xe000u))
{
@@ -818,21 +818,9 @@
bool
FormatterToXML::accumDefaultEntity(
XalanDOMChar ch,
- XalanDOMString::size_type i,
- const XalanDOMChar chars[],
- XalanDOMString::size_type len,
bool escLF)
{
- if (escLF == false &&
- XalanUnicode::charCR == ch &&
- i + 1 < len &&
- XalanUnicode::charLF == chars[i + 1])
- {
- outputLineSep();
-
- i++;
- }
- else if (escLF == false && XalanUnicode::charLF == ch)
+ if (escLF == false && XalanUnicode::charLF == ch)
{
outputLineSep();
}
@@ -1163,7 +1151,10 @@
m_ispreserve = true;
- for (unsigned int i = 0; i < length; ++i)
+ unsigned int i = 0;
+ unsigned int firstIndex = 0;
+
+ while(i < length)
{
const XalanDOMChar ch = chars[i];
@@ -1171,14 +1162,22 @@
m_charsMap[ch] == 'S') ||
ch > m_maxCharacter)
{
+ accumContent(chars, firstIndex, i -
firstIndex);
+
accumDefaultEscape(ch, i, chars,
length, false);
+
+ ++i;
+
+ firstIndex = i;
}
else
{
- accumContent(ch);
+ ++i;
}
}
+ accumContent(chars, firstIndex, i - firstIndex);
+
if (m_isprevtext == false)
{
m_isprevtext = true;
@@ -1211,7 +1210,12 @@
const XalanDOMChar* theString,
XalanDOMString::size_type theStringLength)
{
- for (XalanDOMString::size_type i = 0; i < theStringLength; i ++)
+ assert(theString != 0);
+
+ XalanDOMString::size_type i = 0;
+ XalanDOMString::size_type firstIndex = 0;
+
+ while(i < theStringLength)
{
const XalanDOMChar ch = theString[i];
@@ -1219,13 +1223,21 @@
m_attrCharsMap[ch] == 'S') ||
ch > m_maxCharacter)
{
+ accumContent(theString, firstIndex, i - firstIndex);
+
accumDefaultEscape(ch, i, theString, theStringLength,
true);
+
+ ++i;
+
+ firstIndex = i;
}
else
{
- accumName(ch);
+ ++i;
}
}
+
+ accumContent(theString, firstIndex, i - firstIndex);
}
1.42 +0 -3 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.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- FormatterToXML.hpp 12 Dec 2002 01:51:08 -0000 1.41
+++ FormatterToXML.hpp 8 Jan 2003 06:56:10 -0000 1.42
@@ -504,9 +504,6 @@
virtual bool
accumDefaultEntity(
XalanDOMChar ch,
- XalanDOMString::size_type i,
- const XalanDOMChar chars[],
- XalanDOMString::size_type len,
bool escLF);
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]