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 2002/03/07 06:35:48 UTC
cvs commit: xml-xalan/c/src/XPath FunctionSubstring.cpp
dbertoni 02/03/06 21:35:48
Modified: c/src/XPath FunctionSubstring.cpp
Log:
Fixed 64-bit HP problem.
Revision Changes Path
1.16 +10 -3 xml-xalan/c/src/XPath/FunctionSubstring.cpp
Index: FunctionSubstring.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionSubstring.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- FunctionSubstring.cpp 26 Sep 2001 20:58:46 -0000 1.15
+++ FunctionSubstring.cpp 7 Mar 2002 05:35:48 -0000 1.16
@@ -86,15 +86,22 @@
* Get the value for the start index (C-style, not XPath).
*/
inline XalanDOMString::size_type
-getStartIndex(double theSecondArgValue)
+getStartIndex(
+ double theSecondArgValue,
+ XalanDOMString::size_type theStringLength)
{
// We always subtract 1 for C-style index, since XPath indexes from 1.
// Anything less than, or equal to 1 is 0.
- if (theSecondArgValue <= 1)
+ if (theSecondArgValue <= 1 ||
+ DoubleSupport::isNaN(theSecondArgValue) == true)
{
return 0;
}
+ else if (DoubleSupport::isPositiveInfinity(theSecondArgValue) == true)
+ {
+ return theStringLength;
+ }
else
{
return XalanDOMString::size_type(DoubleSupport::round(theSecondArgValue)) - 1;
@@ -214,7 +221,7 @@
DoubleSupport::round(arg2->num());
// XPath indexes from 1, so this is the first XPath index....
- const XalanDOMString::size_type theStartIndex = getStartIndex(theSecondArgValue);
+ const XalanDOMString::size_type theStartIndex = getStartIndex(theSecondArgValue, theSourceStringLength);
if (theStartIndex >= theSourceStringLength)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org