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 2008/09/11 22:22:01 UTC
svn commit: r694456 - in /xalan/c/trunk/src/xalanc/PlatformSupport:
NamedNodeMapAttributeList.cpp NamedNodeMapAttributeList.hpp
Author: dbertoni
Date: Thu Sep 11 13:21:57 2008
New Revision: 694456
URL: http://svn.apache.org/viewvc?rev=694456&view=rev
Log:
Fix for XALANC-681.
Modified:
xalan/c/trunk/src/xalanc/PlatformSupport/NamedNodeMapAttributeList.cpp
xalan/c/trunk/src/xalanc/PlatformSupport/NamedNodeMapAttributeList.hpp
Modified: xalan/c/trunk/src/xalanc/PlatformSupport/NamedNodeMapAttributeList.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/PlatformSupport/NamedNodeMapAttributeList.cpp?rev=694456&r1=694455&r2=694456&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/PlatformSupport/NamedNodeMapAttributeList.cpp (original)
+++ xalan/c/trunk/src/xalanc/PlatformSupport/NamedNodeMapAttributeList.cpp Thu Sep 11 13:21:57 2008
@@ -47,13 +47,13 @@
NamedNodeMapAttributeList::NamedNodeMapAttributeList(
const XalanNamedNodeMap& theMap,
- MemoryManagerType& theManager) :
+ MemoryManager& theManager) :
ParentType(),
m_nodeMap(theMap),
- m_lastIndex(theMap.getLength() - 1),
+ m_length(theMap.getLength()),
m_memoryManager(theManager)
{
- assert(theMap.getLength() != 0);
+ assert(length(s_typeString) > 0);
}
@@ -75,20 +75,32 @@
const XMLCh*
NamedNodeMapAttributeList::getName(const XalanSize_t index) const
{
- const XalanNode* const theAttribute = m_nodeMap.item(m_lastIndex - index);
- assert(theAttribute != 0);
+ if (index >= m_length)
+ {
+ return 0;
+ }
+ else
+ {
+ const XalanNode* const theAttribute = m_nodeMap.item(m_length - 1 - index);
+ assert(theAttribute != 0);
- return theAttribute->getNodeName().c_str();
+ return theAttribute->getNodeName().c_str();
+ }
}
const XMLCh*
-NamedNodeMapAttributeList::getType(const XalanSize_t /* index */) const
+NamedNodeMapAttributeList::getType(const XalanSize_t index) const
{
- assert(length(s_typeString) > 0);
-
- return s_typeString;
+ if (index >= m_length)
+ {
+ return 0;
+ }
+ else
+ {
+ return s_typeString;
+ }
}
@@ -96,22 +108,34 @@
const XMLCh*
NamedNodeMapAttributeList::getValue(const XalanSize_t index) const
{
- assert(index <= m_lastIndex);
+ if (index >= m_length)
+ {
+ return 0;
+ }
+ else
+ {
+ const XalanNode* const theAttribute = m_nodeMap.item(m_length - 1 - index);
+ assert(theAttribute != 0);
- const XalanNode* const theAttribute = m_nodeMap.item(m_lastIndex - index);
- assert(theAttribute != 0);
-
- return theAttribute->getNodeValue().c_str();
+ return theAttribute->getNodeValue().c_str();
+ }
}
const XMLCh*
-NamedNodeMapAttributeList::getType(const XMLCh* const /* name */) const
+NamedNodeMapAttributeList::getType(const XMLCh* const name) const
{
- assert(length(s_typeString) > 0);
+ const XalanNode* theNode = m_nodeMap.getNamedItem(XalanDOMString(name, m_memoryManager));
- return s_typeString;
+ if (theNode == 0)
+ {
+ return 0;
+ }
+ else
+ {
+ return s_typeString;
+ }
}
Modified: xalan/c/trunk/src/xalanc/PlatformSupport/NamedNodeMapAttributeList.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/PlatformSupport/NamedNodeMapAttributeList.hpp?rev=694456&r1=694455&r2=694456&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/PlatformSupport/NamedNodeMapAttributeList.hpp (original)
+++ xalan/c/trunk/src/xalanc/PlatformSupport/NamedNodeMapAttributeList.hpp Thu Sep 11 13:21:57 2008
@@ -86,7 +86,7 @@
// Data members...
const XalanNamedNodeMap& m_nodeMap;
- const XalanSize_t m_lastIndex;
+ const XalanSize_t m_length;
MemoryManagerType& m_memoryManager;
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org