You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Frank Emser <Fr...@nortel-dasa.de> on 2001/02/05 18:22:10 UTC
Error in Rev1.6 of xml-xalan/c/src/XalanDOM/XalanDOMString.cpp
?
I guess that there is an error in Rev1.6 of xml-xalan/c/src/XalanDOM/XalanDOMString.cpp:
I was not even able to run the Sample SimpleTransform because
of error
"Assertion failed: length (theFunction Name) != 0
file XPath/XPathFunctionTable.cpp, line 199.
The original version of the XalanDOMString-CopyConstructor
does not take into account that theCount might be npos:
=====================================================================
XalanDOMString::XalanDOMString(
const char* theString,
size_type theCount) :
m_data()
#if defined(XALAN_DOMSTRING_CACHE_SIZE)
, m_size(0)
#endif
{
assert(theString != 0);
if (*theString != 0)
{
TranscodeFromLocalCodePage(theString, theCount, m_data, true);
#if defined(XALAN_DOMSTRING_CACHE_SIZE)
m_size = m_data.size() - 1;
#endif
}
invariants();
}
=====================================================================
Changing into the code below worked fine for me:
======================================================================
XalanDOMString::XalanDOMString(
const char* theString,
size_type theCount) :
m_data()
#if defined(XALAN_DOMSTRING_CACHE_SIZE)
, m_size(0)
#endif
{
assert(theString != 0);
if (*theString != 0)
{
// 05.Feb.2001: unconditional call changed by Frank Emser
// into a conditional call, depending on whether theCount is defined or not (==-1)
// The previous code **always** called
// TranscodeFromLocalCodePage(theString, theCount, m_data, true);
// which in turn called
// doTranscodeFromLocalCodePage(
// const char* theSourceString,
// unsigned int theSourceStringLength,
// bool theSourceStringIsNullTerminated,
// XalanDOMCharVectorType& theTargetVector,
// bool terminate)
// using the following parameters:
// doTranscodeFromLocalCodePage(theSourceString, theSourceStringLength, false, theTargetVector, terminate);
// and especially: theSourceStringIsNullTerminated == ***false***
// which is not reasonable considering that
// theSourceStringLength might be invalid.
if (theCount == size_type(npos)) {
TranscodeFromLocalCodePage(theString, m_data, true);
} else {
TranscodeFromLocalCodePage(theString, theCount, m_data, true);
}
#if defined(XALAN_DOMSTRING_CACHE_SIZE)
m_size = m_data.size() - 1;
#endif
}
invariants();
}
Re: Error in Rev1.6 of xml-xalan/c/src/XalanDOM/XalanDOMString.cpp?
Posted by David Braaten <da...@multiactive.com>.
This patch from Frank fixes the problem I was having with Release builds
of Xalan that I was experiencing last week.
----- Original Message -----
From: "Frank Emser" <Fr...@nortel-dasa.de>
To: <xa...@xml.apache.org>
Cc: <Fr...@gmx.de>
Sent: Monday, February 05, 2001 09:22 AM
Subject: Error in Rev1.6 of xml-xalan/c/src/XalanDOM/XalanDOMString.cpp?
> I guess that there is an error in Rev1.6 of
xml-xalan/c/src/XalanDOM/XalanDOMString.cpp:
> I was not even able to run the Sample SimpleTransform because
> of error
> "Assertion failed: length (theFunction Name) != 0
> file XPath/XPathFunctionTable.cpp, line 199.
_snip_
>
> =====================================================================
>
> Changing into the code below worked fine for me:
> ======================================================================
> XalanDOMString::XalanDOMString(
> const char* theString,
> size_type theCount) :
> m_data()
> #if defined(XALAN_DOMSTRING_CACHE_SIZE)
> , m_size(0)
> #endif
> {
> assert(theString != 0);
>
> if (*theString != 0)
> {
> if (theCount == size_type(npos)) {
> TranscodeFromLocalCodePage(theString, m_data, true);
> } else {
> TranscodeFromLocalCodePage(theString, theCount, m_data, true);
> }
>
>
> #if defined(XALAN_DOMSTRING_CACHE_SIZE)
> m_size = m_data.size() - 1;
> #endif
> }
>
> invariants();
> }
>