You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by pe...@apache.org on 2002/03/01 19:47:37 UTC
cvs commit: xml-xerces/c/src/xercesc/util XMLUni.cpp XMLAbstractDoubleFloat.hpp XMLAbstractDoubleFloat.cpp
peiyongz 02/03/01 10:47:37
Modified: c/src/xercesc/util XMLUni.cpp XMLAbstractDoubleFloat.hpp
XMLAbstractDoubleFloat.cpp
Log:
fix: more valid lexcial representation forms for "neural zero"
Revision Changes Path
1.4 +2 -2 xml-xerces/c/src/xercesc/util/XMLUni.cpp
Index: XMLUni.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLUni.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XMLUni.cpp 13 Feb 2002 16:09:24 -0000 1.3
+++ XMLUni.cpp 1 Mar 2002 18:47:37 -0000 1.4
@@ -55,7 +55,7 @@
*/
/*
- * $Id: XMLUni.cpp,v 1.3 2002/02/13 16:09:24 knoaman Exp $
+ * $Id: XMLUni.cpp,v 1.4 2002/03/01 18:47:37 peiyongz Exp $
*/
@@ -794,7 +794,7 @@
const XMLCh XMLUni::fgNeuralZeroString[] =
{
- chDigit_0, chPeriod, chDigit_0, chNull
+ chDigit_0, chNull
};
const XMLCh XMLUni::fgPosZeroString[] =
1.3 +6 -1 xml-xerces/c/src/xercesc/util/XMLAbstractDoubleFloat.hpp
Index: XMLAbstractDoubleFloat.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLAbstractDoubleFloat.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XMLAbstractDoubleFloat.hpp 20 Feb 2002 18:17:02 -0000 1.2
+++ XMLAbstractDoubleFloat.hpp 1 Mar 2002 18:47:37 -0000 1.3
@@ -55,8 +55,11 @@
*/
/*
- * $Id: XMLAbstractDoubleFloat.hpp,v 1.2 2002/02/20 18:17:02 tng Exp $
+ * $Id: XMLAbstractDoubleFloat.hpp,v 1.3 2002/03/01 18:47:37 peiyongz Exp $
* $Log: XMLAbstractDoubleFloat.hpp,v $
+ * Revision 1.3 2002/03/01 18:47:37 peiyongz
+ * fix: more valid lexcial representation forms for "neural zero"
+ *
* Revision 1.2 2002/02/20 18:17:02 tng
* [Bug 5977] Warnings on generating apiDocs.
*
@@ -175,6 +178,8 @@
//
XMLAbstractDoubleFloat(const XMLAbstractDoubleFloat& toCopy);
XMLAbstractDoubleFloat& operator=(const XMLAbstractDoubleFloat& toAssign);
+
+ void normalizeToNeuralZero(XMLCh* const);
inline bool isSpecialValue() const;
1.2 +31 -1 xml-xerces/c/src/xercesc/util/XMLAbstractDoubleFloat.cpp
Index: XMLAbstractDoubleFloat.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLAbstractDoubleFloat.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XMLAbstractDoubleFloat.cpp 1 Feb 2002 22:22:14 -0000 1.1
+++ XMLAbstractDoubleFloat.cpp 1 Mar 2002 18:47:37 -0000 1.2
@@ -55,10 +55,13 @@
*/
/*
- * $Id: XMLAbstractDoubleFloat.cpp,v 1.1 2002/02/01 22:22:14 peiyongz Exp $
+ * $Id: XMLAbstractDoubleFloat.cpp,v 1.2 2002/03/01 18:47:37 peiyongz Exp $
* $Log: XMLAbstractDoubleFloat.cpp,v $
- * Revision 1.1 2002/02/01 22:22:14 peiyongz
- * Initial revision
+ * Revision 1.2 2002/03/01 18:47:37 peiyongz
+ * fix: more valid lexcial representation forms for "neural zero"
+ *
+ * Revision 1.1.1.1 2002/02/01 22:22:14 peiyongz
+ * sane_include
*
* Revision 1.2 2001/11/22 21:39:00 peiyongz
* Allow "0.0" to be a valid lexcial representation of ZERO.
@@ -111,6 +114,8 @@
ArrayJanitor<XMLCh> janTmpName(tmpStrValue);
XMLString::trim(tmpStrValue);
+ normalizeToNeuralZero(tmpStrValue);
+
if (XMLString::compareString(tmpStrValue, XMLUni::fgNegINFString) == 0)
{
fType = NegINF;
@@ -338,3 +343,28 @@
return 0;
}
}
+
+//
+// Apply to string
+// "0.[0]+" -> "0"
+//
+
+void XMLAbstractDoubleFloat::normalizeToNeuralZero(XMLCh* const inData)
+{
+ if (!inData || !*inData)
+ return;
+
+ const unsigned int len = XMLString::stringLen(inData);
+
+ // the first two have to be "0."
+ if (len < 3 || inData[0] != chDigit_0 || inData[1] != chPeriod)
+ return;
+
+ unsigned int index;
+ for ( index = 2; (index < len) && (inData[index] == chDigit_0); index++);
+
+ if (index >= len)
+ XMLString::copyString(inData, XMLUni::fgNeuralZeroString);
+
+ return;
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org