dbertoni    00/12/05 11:25:13

  Modified:    c/src/XPath FunctionSubstring.cpp
  Log:
  Fixed problem with overflow.
  
  Revision  Changes    Path
  1.8       +13 -2     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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- FunctionSubstring.cpp     2000/12/04 20:48:17     1.7
  +++ FunctionSubstring.cpp     2000/12/05 19:25:12     1.8
  @@ -132,13 +132,24 @@
        // Total the second and third arguments.  Ithe third argument is
        // missing, make it the length of the string + 1 (for XPath
        // indexing style).
  -     if (arg3.null() == true || 
DoubleSupport::isPositiveInfinity(arg3->num()) == true)
  +     if (arg3.null() == true)
        {
                return double(theSourceStringLength + 1);
        }
        else
        {
  -             return FunctionRound::getRoundedValue(theSecondArgValue + 
arg3->num());
  +             const double    theRoundedValue =
  +                     FunctionRound::getRoundedValue(theSecondArgValue + 
arg3->num());
  +
  +             // If there's overflow, then we should return the length of the 
string + 1.
  +             if (DoubleSupport::isPositiveInfinity(theRoundedValue) == true)
  +             {
  +                     return double(theSourceStringLength + 1);
  +             }
  +             else
  +             {
  +                     return theRoundedValue;
  +             }
        }
   }
   
  
  
  

Reply via email to