You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by tn...@apache.org on 2001/06/08 15:10:40 UTC
cvs commit: xml-xerces/c/src/idom IDAttrImpl.cpp IDAttrNSImpl.cpp IDDocumentImpl.cpp IDElementNSImpl.cpp
tng 01/06/08 06:10:39
Modified: c/src/idom IDAttrImpl.cpp IDAttrNSImpl.cpp
IDDocumentImpl.cpp IDElementNSImpl.cpp
Log:
IDOM: some compiler (solaris cc/hp acc)requires memory to align, otherwise core dump.
Revision Changes Path
1.6 +4 -2 xml-xerces/c/src/idom/IDAttrImpl.cpp
Index: IDAttrImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/idom/IDAttrImpl.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- IDAttrImpl.cpp 2001/05/29 18:49:48 1.5
+++ IDAttrImpl.cpp 2001/06/08 13:10:28 1.6
@@ -55,7 +55,7 @@
*/
/*
- * $Id: IDAttrImpl.cpp,v 1.5 2001/05/29 18:49:48 tng Exp $
+ * $Id: IDAttrImpl.cpp,v 1.6 2001/06/08 13:10:28 tng Exp $
*/
#include "IDAttrImpl.hpp"
@@ -155,7 +155,9 @@
// does not ever produce such a thing.
//XMLCh * retString = new (this->getOwnerDocument()) XMLCh[length+1];
- XMLCh * retString = (XMLCh*) ((IDDocumentImpl *)this->getOwnerDocument())->allocate(sizeof(XMLCh) * (length+1));
+ length = sizeof(XMLCh) * (length+1);
+ length = (length % 4) + length;
+ XMLCh * retString = (XMLCh*) ((IDDocumentImpl *)this->getOwnerDocument())->allocate(length);
retString[0] = 0;
for (node = fParent.fFirstChild; node != 0; node = castToChildImpl(node)->nextSibling)
{
1.7 +7 -8 xml-xerces/c/src/idom/IDAttrNSImpl.cpp
Index: IDAttrNSImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/idom/IDAttrNSImpl.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- IDAttrNSImpl.cpp 2001/06/04 14:55:31 1.6
+++ IDAttrNSImpl.cpp 2001/06/08 13:10:30 1.7
@@ -55,7 +55,7 @@
*/
/*
- * $Id: IDAttrNSImpl.cpp,v 1.6 2001/06/04 14:55:31 tng Exp $
+ * $Id: IDAttrNSImpl.cpp,v 1.7 2001/06/08 13:10:30 tng Exp $
*/
#include <util/XMLUniDefs.hpp>
@@ -182,14 +182,11 @@
this-> fPrefix = ((IDDocumentImpl *)this->getOwnerDocument())->getPooledString(prefix);
int prefixLen = XMLString::stringLen(prefix);
- XMLCh *newName;
- XMLCh temp[1000];
int newQualifiedNameLen = prefixLen+1+XMLString::stringLen(fLocalName);
-
- if (newQualifiedNameLen >= 999) {
- //newName = new (getOwnerDocument()) XMLCh[newQualifiedNameLen + 1];
- newName = (XMLCh*) ((IDDocumentImpl *)getOwnerDocument())->allocate(sizeof(XMLCh) * (newQualifiedNameLen + 1));
- }
+ XMLCh* newName;
+ XMLCh temp[4000];
+ if (newQualifiedNameLen >= 3999)
+ newName = new XMLCh[newQualifiedNameLen];
else
newName = temp;
@@ -201,5 +198,7 @@
fName = ((IDDocumentImpl *)this->getOwnerDocument())->
getPooledString(newName);
+ if (newQualifiedNameLen >= 3999)
+ delete[] newName;
}
1.7 +4 -2 xml-xerces/c/src/idom/IDDocumentImpl.cpp
Index: IDDocumentImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/idom/IDDocumentImpl.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- IDDocumentImpl.cpp 2001/06/04 20:11:52 1.6
+++ IDDocumentImpl.cpp 2001/06/08 13:10:32 1.7
@@ -55,7 +55,7 @@
*/
/*
- * $Id: IDDocumentImpl.cpp,v 1.6 2001/06/04 20:11:52 tng Exp $
+ * $Id: IDDocumentImpl.cpp,v 1.7 2001/06/08 13:10:32 tng Exp $
*/
#include <util/XMLUniDefs.hpp>
@@ -844,7 +844,9 @@
XMLCh * IDDocumentImpl::cloneString(const XMLCh *src)
{
size_t len = XMLString::stringLen(src);
- XMLCh *newStr = (XMLCh *)this->allocate((len+1) * sizeof(XMLCh));
+ len = (len + 1) * sizeof(XMLCh);
+ len = (len % 4) + len;
+ XMLCh *newStr = (XMLCh *)this->allocate(len);
XMLString::copyString(newStr, src);
return newStr;
}
1.7 +8 -7 xml-xerces/c/src/idom/IDElementNSImpl.cpp
Index: IDElementNSImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/idom/IDElementNSImpl.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- IDElementNSImpl.cpp 2001/06/04 14:55:33 1.6
+++ IDElementNSImpl.cpp 2001/06/08 13:10:33 1.7
@@ -55,7 +55,7 @@
*/
/*
- * $Id: IDElementNSImpl.cpp,v 1.6 2001/06/04 14:55:33 tng Exp $
+ * $Id: IDElementNSImpl.cpp,v 1.7 2001/06/08 13:10:33 tng Exp $
*/
#include <util/XMLUniDefs.hpp>
@@ -166,14 +166,12 @@
this-> fPrefix = ((IDDocumentImpl *)this->getOwnerDocument())->getPooledString(prefix);
int prefixLen = XMLString::stringLen(prefix);
- XMLCh *newName;
- XMLCh temp[1000];
int newQualifiedNameLen = prefixLen+1+XMLString::stringLen(fLocalName);
- if (newQualifiedNameLen >= 999) {
- //newName = new (getOwnerDocument()) XMLCh[newQualifiedNameLen + 1];
- newName = (XMLCh*) ((IDDocumentImpl *)getOwnerDocument())->allocate(sizeof(XMLCh) * (newQualifiedNameLen + 1));
- }
+ XMLCh *newName;
+ XMLCh temp[4000];
+ if (newQualifiedNameLen >= 3999)
+ newName = new XMLCh[newQualifiedNameLen];
else
newName = temp;
@@ -184,5 +182,8 @@
fName = ((IDDocumentImpl *)this->getOwnerDocument())->
getPooledString(newName);
+
+ if (newQualifiedNameLen >= 3999)
+ delete[] newName;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org