tentative fix for bug #61

This commit is contained in:
Benoit Jacob 2009-10-21 18:55:54 -04:00
parent a4a3e511d0
commit 9af431e78e

View File

@ -3,6 +3,7 @@
#define EIGEN_QTMALLOC_MODULE_H
#include "Core"
#include <QtCore/QVectorData>
#if (!EIGEN_MALLOC_ALREADY_ALIGNED)
@ -24,6 +25,16 @@ inline void *qRealloc(void *ptr, size_t size)
return newPtr;
}
// needed to copy that too because it is implemented in the qt binary library, hence
// wouldn't otherwise honor our qMalloc.
QVectorData *QVectorData::malloc(int sizeofTypedData, int size, int sizeofT, QVectorData *init)
{
QVectorData* p = (QVectorData *)qMalloc(sizeofTypedData + (size - 1) * sizeofT);
Q_CHECK_PTR(p);
::memcpy(p, init, sizeofTypedData + (qMin(size, init->alloc) - 1) * sizeofT);
return p;
}
#endif
#endif // EIGEN_QTMALLOC_MODULE_H