You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2010/07/03 22:59:04 UTC

svn commit: r960268 - in /xalan/c/trunk/src/xalanc/XMLSupport: FormatterToHTML.cpp FormatterToHTML.hpp FormatterToXML.cpp FormatterToXML.hpp

Author: dbertoni
Date: Sat Jul  3 20:59:04 2010
New Revision: 960268

URL: http://svn.apache.org/viewvc?rev=960268&view=rev
Log:
Fixes for XALANC-700.

Modified:
    xalan/c/trunk/src/xalanc/XMLSupport/FormatterToHTML.cpp
    xalan/c/trunk/src/xalanc/XMLSupport/FormatterToHTML.hpp
    xalan/c/trunk/src/xalanc/XMLSupport/FormatterToXML.cpp
    xalan/c/trunk/src/xalanc/XMLSupport/FormatterToXML.hpp

Modified: xalan/c/trunk/src/xalanc/XMLSupport/FormatterToHTML.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XMLSupport/FormatterToHTML.cpp?rev=960268&r1=960267&r2=960268&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XMLSupport/FormatterToHTML.cpp (original)
+++ xalan/c/trunk/src/xalanc/XMLSupport/FormatterToHTML.cpp Sat Jul  3 20:59:04 2010
@@ -88,7 +88,6 @@ FormatterToHTML::FormatterToHTML(
     m_inScriptElemStack(theManager),
     m_escapeURLs(escapeURLs),
     m_isFirstElement(false),
-    m_isUTF8(XalanTranscodingServices::encodingIsUTF8(m_encoding)),
     m_elementLevel(0),
     m_hasNamespaceStack(theManager),
     m_omitMetaTag(omitMetaTag),
@@ -730,27 +729,24 @@ FormatterToHTML::writeCharacters(
 
             if (accumDefaultEntity(ch, true) == false)
             {
-                if (m_isUTF8 == true && 0xd800 <= ch && ch < 0xdc00)
+                if (0xd800 <= ch && ch < 0xdc00)
                 {
                     // UTF-16 surrogate
-                    XalanDOMChar    next = 0;
-
                     if (i + 1 >= theLength) 
                     {
                         throwInvalidUTF16SurrogateException(ch, getMemoryManager());
                     }
-                    else
-                    {
-                        next = theString[++i];
 
-                        if (!(0xdc00 <= next && next < 0xe000))
-                        {
-                            throwInvalidUTF16SurrogateException(ch, next, getMemoryManager());
-                        }
+                    XalanUnicodeChar    next = theString[++i];
 
-                        next = XalanDOMChar(((ch - 0xd800) << 10) + next - 0xdc00 + 0x00010000);
+                    if (!(0xdc00 <= next && next < 0xe000))
+                    {
+                        throwInvalidUTF16SurrogateException(ch, static_cast<XalanDOMChar>(next),
+                                                            getMemoryManager());
                     }
 
+                    next = ((ch - 0xd800) << 10) + next - 0xdc00 + 0x00010000;
+
                     writeNumberedEntityReference(next);
                 }
                 else if(ch >= 0x007Fu && ch <= m_maxCharacter)

Modified: xalan/c/trunk/src/xalanc/XMLSupport/FormatterToHTML.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XMLSupport/FormatterToHTML.hpp?rev=960268&r1=960267&r2=960268&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XMLSupport/FormatterToHTML.hpp (original)
+++ xalan/c/trunk/src/xalanc/XMLSupport/FormatterToHTML.hpp Sat Jul  3 20:59:04 2010
@@ -311,11 +311,6 @@ private:
     bool                    m_isFirstElement;
 
     /**
-     * A flag so we know whether or not we're writing utf-8.
-     */
-    bool                    m_isUTF8;
-
-    /**
      * A counter so we can tell if we're inside the document element.
      */
     int                     m_elementLevel;

Modified: xalan/c/trunk/src/xalanc/XMLSupport/FormatterToXML.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XMLSupport/FormatterToXML.cpp?rev=960268&r1=960267&r2=960268&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XMLSupport/FormatterToXML.cpp (original)
+++ xalan/c/trunk/src/xalanc/XMLSupport/FormatterToXML.cpp Sat Jul  3 20:59:04 2010
@@ -1530,25 +1530,24 @@ FormatterToXML::writeNormalizedChars(
             else if (0xd800 <= c && c < 0xdc00)
             {
                 // UTF-16 surrogate
-                XalanDOMChar    next = 0;
-
                 if (i + 1 >= end) 
                 {
                     throwInvalidUTF16SurrogateException(c, getMemoryManager());
                 }
                 else
                 {
-                    next = ch[++i];
+                    XalanUnicodeChar    next = ch[++i];
 
                     if (!(0xdc00 <= next && next < 0xe000))
                     {
-                        throwInvalidUTF16SurrogateException(c, next, getMemoryManager());
+                        throwInvalidUTF16SurrogateException(c, static_cast<XalanDOMChar>(next),
+                                                            getMemoryManager());
                     }
 
-                    next = XalanDOMChar(((c - 0xd800) << 10) + next - 0xdc00 + 0x00010000);
-                }
+                    next = ((c - 0xd800) << 10) + next - 0xdc00 + 0x00010000;
 
-                writeNumberedEntityReference(next);
+                    writeNumberedEntityReference(next);
+                }
             }
             else
             {
@@ -1561,7 +1560,7 @@ FormatterToXML::writeNormalizedChars(
 
 
 void
-FormatterToXML::writeNumberedEntityReference(unsigned long  theNumber)
+FormatterToXML::writeNumberedEntityReference(XalanUnicodeChar   theNumber)
 {
     accumContent(XalanUnicode::charAmpersand);
     accumContent(XalanUnicode::charNumberSign);

Modified: xalan/c/trunk/src/xalanc/XMLSupport/FormatterToXML.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XMLSupport/FormatterToXML.hpp?rev=960268&r1=960267&r2=960268&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XMLSupport/FormatterToXML.hpp (original)
+++ xalan/c/trunk/src/xalanc/XMLSupport/FormatterToXML.hpp Sat Jul  3 20:59:04 2010
@@ -526,7 +526,7 @@ protected:
      * @param theNumber the number to write.
      */
     void
-    writeNumberedEntityReference(unsigned long  theNumber);
+    writeNumberedEntityReference(XalanUnicodeChar   theNumber);
 
     /**
      * Write an attribute string.



---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org