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 2003/12/23 22:48:14 UTC
cvs commit: xml-xerces/c/src/xercesc/util XMLAbstractDoubleFloat.cpp XMLBigDecimal.cpp XMLBigInteger.cpp
peiyongz 2003/12/23 13:48:14
Modified: c/src/xercesc/util XMLAbstractDoubleFloat.cpp
XMLBigDecimal.cpp XMLBigInteger.cpp
Log:
Absorb exception thrown in getCanonicalRepresentation and return 0
Revision Changes Path
1.22 +15 -2 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.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- XMLAbstractDoubleFloat.cpp 20 Dec 2003 06:21:34 -0000 1.21
+++ XMLAbstractDoubleFloat.cpp 23 Dec 2003 21:48:14 -0000 1.22
@@ -57,6 +57,9 @@
/*
* $Id$
* $Log$
+ * Revision 1.22 2003/12/23 21:48:14 peiyongz
+ * Absorb exception thrown in getCanonicalRepresentation and return 0
+ *
* Revision 1.21 2003/12/20 06:21:34 neilg
* fix canonical representation production
*
@@ -510,6 +513,9 @@
return XMLString::replicate(rawData, memMgr);
}
+ try
+ {
+
int strLen = XMLString::stringLen(rawData);
XMLCh* manStr = (XMLCh*) memMgr->allocate((strLen + 1) * sizeof(XMLCh));
ArrayJanitor<XMLCh> janManStr(manStr, memMgr);
@@ -620,6 +626,13 @@
}
return retBuffer;
+
+ } //try
+
+ catch (...)
+ {
+ return 0;
+ }
}
/***
1.18 +14 -1 xml-xerces/c/src/xercesc/util/XMLBigDecimal.cpp
Index: XMLBigDecimal.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLBigDecimal.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- XMLBigDecimal.cpp 17 Dec 2003 20:42:16 -0000 1.17
+++ XMLBigDecimal.cpp 23 Dec 2003 21:48:14 -0000 1.18
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.18 2003/12/23 21:48:14 peiyongz
+ * Absorb exception thrown in getCanonicalRepresentation and return 0
+ *
* Revision 1.17 2003/12/17 20:42:16 neilg
* fix two overflow conditions
*
@@ -244,6 +247,10 @@
XMLCh* XMLBigDecimal::getCanonicalRepresentation(const XMLCh* const rawData
, MemoryManager* const memMgr)
{
+
+ try
+ {
+
XMLCh* retBuf = (XMLCh*) memMgr->allocate( (XMLString::stringLen(rawData)+1) * sizeof(XMLCh));
ArrayJanitor<XMLCh> janName(retBuf, memMgr);
int sign, totalDigits, fractDigits;
@@ -300,6 +307,12 @@
}
return retBuffer;
+
+ }//try
+ catch (...)
+ {
+ return 0;
+ }
}
1.10 +29 -16 xml-xerces/c/src/xercesc/util/XMLBigInteger.cpp
Index: XMLBigInteger.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLBigInteger.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- XMLBigInteger.cpp 17 Dec 2003 20:42:16 -0000 1.9
+++ XMLBigInteger.cpp 23 Dec 2003 21:48:14 -0000 1.10
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.10 2003/12/23 21:48:14 peiyongz
+ * Absorb exception thrown in getCanonicalRepresentation and return 0
+ *
* Revision 1.9 2003/12/17 20:42:16 neilg
* fix two overflow conditions
*
@@ -122,26 +125,36 @@
XMLCh* XMLBigInteger::getCanonicalRepresentation(const XMLCh* const rawData
, MemoryManager* const memMgr)
{
- XMLCh* retBuf = (XMLCh*) memMgr->allocate( (XMLString::stringLen(rawData)+1) * sizeof(XMLCh));
- int sign = 0;
+ try
+ {
+ XMLCh* retBuf = (XMLCh*) memMgr->allocate( (XMLString::stringLen(rawData) + 1) * sizeof(XMLCh));
+ int sign = 0;
- XMLBigInteger::parseBigInteger(rawData, retBuf, sign);
+ XMLBigInteger::parseBigInteger(rawData, retBuf, sign);
- if (sign == 0)
- {
- retBuf[0] = chDigit_0;
- retBuf[1] = chNull;
- }
- else if (sign == -1)
+ if (sign == 0)
+ {
+ retBuf[0] = chDigit_0;
+ retBuf[1] = chNull;
+ }
+ else if (sign == -1)
+ {
+ XMLCh* retBuffer = (XMLCh*) memMgr->allocate( (XMLString::stringLen(retBuf) + 2) * sizeof(XMLCh));
+ retBuffer[0] = chDash;
+ XMLString::copyString(&(retBuffer[1]), retBuf);
+ memMgr->deallocate(retBuf);
+ return retBuffer;
+ }
+
+ return retBuf;
+
+ }//
+
+ catch (...)
{
- XMLCh* retBuffer = (XMLCh*) memMgr->allocate( (XMLString::stringLen(retBuf) + 2) * sizeof(XMLCh));
- retBuffer[0] = chDash;
- XMLString::copyString(&(retBuffer[1]), retBuf);
- memMgr->deallocate(retBuf);
- return retBuffer;
+ return 0;
}
- return retBuf;
}
/***
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org