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/08/07 17:34:54 UTC
cvs commit: xml-xerces/c/src/idom IDDocumentImpl.cpp IDStringPool.cpp
tng 01/08/07 08:34:54
Modified: c/src/idom IDDocumentImpl.cpp IDStringPool.cpp
Log:
IDOM: Unaligned Access warnings in IDOM samples. Fixed by Kari Whitcomb.
Revision Changes Path
1.9 +7 -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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- IDDocumentImpl.cpp 2001/06/08 21:23:02 1.8
+++ IDDocumentImpl.cpp 2001/08/07 15:34:54 1.9
@@ -55,7 +55,7 @@
*/
/*
- * $Id: IDDocumentImpl.cpp,v 1.8 2001/06/08 21:23:02 tng Exp $
+ * $Id: IDDocumentImpl.cpp,v 1.9 2001/08/07 15:34:54 tng Exp $
*/
#include <util/XMLUniDefs.hpp>
@@ -858,6 +858,11 @@
void * IDDocumentImpl::allocate(size_t amount)
{
+
+ size_t sizeOfPointer = sizeof(void *);
+ if (amount%sizeOfPointer!=0)
+ amount = amount + (sizeOfPointer - (amount % sizeOfPointer));
+
// If the request is for a largish block, hand it off to the system
// allocator. The block still must be linked into the list of
// allocated blocks so that it will be deleted when the time comes.
@@ -884,7 +889,7 @@
fFreePtr = 0;
fFreeBytesRemaining = 0;
}
- void *retPtr = (char *)newBlock + 4;
+ void *retPtr = (char *)newBlock + sizeOfPointer;
return retPtr;
}
1.10 +3 -1 xml-xerces/c/src/idom/IDStringPool.cpp
Index: IDStringPool.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/idom/IDStringPool.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- IDStringPool.cpp 2001/06/07 14:26:36 1.9
+++ IDStringPool.cpp 2001/08/07 15:34:54 1.10
@@ -56,6 +56,9 @@
/*
* $Log: IDStringPool.cpp,v $
+ * Revision 1.10 2001/08/07 15:34:54 tng
+ * IDOM: Unaligned Access warnings in IDOM samples. Fixed by Kari Whitcomb.
+ *
* Revision 1.9 2001/06/07 14:26:36 tng
* IDOM: some compiler (solaris cc/hp acc) requires memory to align, otherwise core dump.
*
@@ -123,7 +126,6 @@
// struct, so we don't need to add one again to account for the trailing null.
//
size_t sizeToAllocate = sizeof(IDStringPoolEntry) + XMLString::stringLen(str)*sizeof(XMLCh);
- sizeToAllocate = (sizeToAllocate % 4) + sizeToAllocate;
IDStringPoolEntry *newSPE = (IDStringPoolEntry *)doc->allocate(sizeToAllocate);
newSPE->fNext = 0;
XMLCh * nonConstStr = (XMLCh *)newSPE->fString;
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org