diff --git a/src/xercesc/util/XMLAbstractDoubleFloat.cpp b/src/xercesc/util/XMLAbstractDoubleFloat.cpp index c81a5a6b527a6fdaacc1278154b24449c90a1b0e..44d0bc8613230e18c0ad54a10752ecd487a30b07 100644 --- a/src/xercesc/util/XMLAbstractDoubleFloat.cpp +++ b/src/xercesc/util/XMLAbstractDoubleFloat.cpp @@ -17,6 +17,9 @@ /* * $Id$ * $Log$ + * Revision 1.29 2004/09/09 20:09:30 peiyongz + * getDataOverflowed() + * * Revision 1.28 2004/09/08 13:56:23 peiyongz * Apache License Version 2.0 * @@ -140,6 +143,7 @@ XMLAbstractDoubleFloat::XMLAbstractDoubleFloat(MemoryManager* const manager) : fValue(0) , fType(Normal) , fDataConverted(false) +, fDataOverflowed(false) , fSign(0) , fRawData(0) , fFormattedString(0) diff --git a/src/xercesc/util/XMLAbstractDoubleFloat.hpp b/src/xercesc/util/XMLAbstractDoubleFloat.hpp index a49169b6b33d54ba390f9cfa7c9b2a6e1ba5aed3..0db21e7f3a75c191d97aec9a30d83a8a15c0eadf 100644 --- a/src/xercesc/util/XMLAbstractDoubleFloat.hpp +++ b/src/xercesc/util/XMLAbstractDoubleFloat.hpp @@ -17,6 +17,9 @@ /* * $Id$ * $Log$ + * Revision 1.24 2004/09/09 20:09:30 peiyongz + * getDataOverflowed() + * * Revision 1.23 2004/09/08 13:56:23 peiyongz * Apache License Version 2.0 * @@ -175,6 +178,8 @@ public: inline bool isDataConverted() const; + inline bool isDataOverflowed() const; + inline double getValue() const; /*** @@ -246,6 +251,7 @@ protected: double fValue; LiteralType fType; bool fDataConverted; + bool fDataOverflowed; private: int fSign; @@ -279,6 +285,11 @@ inline bool XMLAbstractDoubleFloat::isDataConverted() const return fDataConverted; } +inline bool XMLAbstractDoubleFloat::isDataOverflowed() const +{ + return fDataOverflowed; +} + inline double XMLAbstractDoubleFloat::getValue() const { return fValue; diff --git a/src/xercesc/util/XMLDouble.cpp b/src/xercesc/util/XMLDouble.cpp index 8aee7d89c74f3bd73075eb7049b4908e2bcc09e1..9207ca804b9d3a857e207f9880582813d68cec9a 100644 --- a/src/xercesc/util/XMLDouble.cpp +++ b/src/xercesc/util/XMLDouble.cpp @@ -17,6 +17,9 @@ /* * $Id$ * $Log$ + * Revision 1.15 2004/09/09 20:09:30 peiyongz + * getDataOverflowed() + * * Revision 1.14 2004/09/08 13:56:24 peiyongz * Apache License Version 2.0 * @@ -159,36 +162,33 @@ void XMLDouble::checkBoundary(const XMLCh* const strValue) // check if overflow/underflow occurs if (errno == ERANGE) { + + fDataConverted = true; + if ( fValue < 0 ) { if (fValue > (-1)*DBL_MIN) { - fDataConverted = true; fValue = 0; } else { fType = NegINF; - fDataConverted = true; + fDataOverflowed = true; } } else if ( fValue > 0) { if (fValue < DBL_MIN ) { - fDataConverted = true; fValue = 0; } else { fType = PosINF; - fDataConverted = true; + fDataOverflowed = true; } } - else - { - fDataConverted = true; - } } diff --git a/src/xercesc/util/XMLFloat.cpp b/src/xercesc/util/XMLFloat.cpp index d73859d54a9f84d86e1f9af695f5e6c11fea73a5..588bbb860a9242cf8e4c415ac077fe0f6323326c 100644 --- a/src/xercesc/util/XMLFloat.cpp +++ b/src/xercesc/util/XMLFloat.cpp @@ -17,6 +17,9 @@ /* * $Id$ * $Log$ + * Revision 1.16 2004/09/09 20:09:30 peiyongz + * getDataOverflowed() + * * Revision 1.15 2004/09/08 13:56:24 peiyongz * Apache License Version 2.0 * @@ -154,36 +157,33 @@ void XMLFloat::checkBoundary(const XMLCh* const strValue) // check if overflow/underflow occurs if (errno == ERANGE) { + + fDataConverted = true; + if ( fValue < 0 ) { if (fValue > (-1)*DBL_MIN) { - fDataConverted = true; fValue = 0; } else { fType = NegINF; - fDataConverted = true; + fDataOverflowed = true; } } else if ( fValue > 0) { if (fValue < DBL_MIN ) { - fDataConverted = true; fValue = 0; } else { fType = PosINF; - fDataConverted = true; + fDataOverflowed = true; } } - else - { - fDataConverted = true; - } } else { @@ -194,6 +194,7 @@ void XMLFloat::checkBoundary(const XMLCh* const strValue) { fType = NegINF; fDataConverted = true; + fDataOverflowed = true; } else if (fValue > (-1)*FLT_MIN && fValue < 0) { @@ -209,6 +210,7 @@ void XMLFloat::checkBoundary(const XMLCh* const strValue) { fType = PosINF; fDataConverted = true; + fDataOverflowed = true; } } }