diff --git a/canframemodel.cpp b/canframemodel.cpp index fe54877..ef08b4f 100644 --- a/canframemodel.cpp +++ b/canframemodel.cpp @@ -34,8 +34,21 @@ int CANFrameModel::columnCount(const QModelIndex &index) const CANFrameModel::CANFrameModel(QObject *parent) : QAbstractTableModel(parent) { - frames.reserve(50000000); //yes, preallocating a huge number of frames. - filteredFrames.reserve(50000000); //the goal is to prevent a reallocation from ever happening + + if (QSysInfo::WordSize > 32) + { + qDebug() << "64 bit OS detected. Requesting a large preallocation"; + preallocSize = 50000000; + } + else //if compiling for 32 bit you can't ask for gigabytes of preallocation so tone it down. + { + qDebug() << "32 bit OS detected. Requesting a much restricted prealloc"; + preallocSize = 5000000; + } + + frames.reserve(preallocSize); + filteredFrames.reserve(preallocSize); //the goal is to prevent a reallocation from ever happening + dbcHandler = NULL; interpretFrames = false; overwriteDups = false; @@ -159,7 +172,7 @@ void CANFrameModel::recalcOverwrite() while (frames.count() > lastUnique) frames.removeLast(); filteredFrames.clear(); - filteredFrames.reserve(50000000); + filteredFrames.reserve(preallocSize); for (int i = 0; i < frames.count(); i++) { @@ -360,7 +373,7 @@ void CANFrameModel::sendRefresh() beginResetModel(); filteredFrames.clear(); filteredFrames.append(tempContainer); - filteredFrames.reserve(50000000); + filteredFrames.reserve(preallocSize); lastUpdateNumFrames = filteredFrames.count(); endResetModel(); mutex.unlock(); @@ -416,8 +429,8 @@ void CANFrameModel::clearFrames() frames.clear(); filteredFrames.clear(); filters.clear(); - frames.reserve(50000000); - filteredFrames.reserve(50000000); + frames.reserve(preallocSize); + filteredFrames.reserve(preallocSize); this->endResetModel(); lastUpdateNumFrames = 0; mutex.unlock(); diff --git a/canframemodel.h b/canframemodel.h index 7e93007..a994857 100644 --- a/canframemodel.h +++ b/canframemodel.h @@ -62,6 +62,7 @@ private: bool needFilterRefresh; uint64_t timeOffset; int lastUpdateNumFrames; + uint32_t preallocSize; }; diff --git a/deltamodel.cpp b/deltamodel.cpp index 98f88fa..4d501d2 100644 --- a/deltamodel.cpp +++ b/deltamodel.cpp @@ -8,6 +8,7 @@ DeltaModel::DeltaModel(QObject *parent) QVariant DeltaModel::headerData(int section, Qt::Orientation orientation, int role) const { // FIXME: Implement me! + return QVariant(); } int DeltaModel::rowCount(const QModelIndex &parent) const @@ -15,6 +16,8 @@ int DeltaModel::rowCount(const QModelIndex &parent) const if (!parent.isValid()) return 0; + return 0; + // FIXME: Implement me! } @@ -23,6 +26,8 @@ int DeltaModel::columnCount(const QModelIndex &parent) const if (!parent.isValid()) return 0; + return 0; + // FIXME: Implement me! } diff --git a/graphingwindow.cpp b/graphingwindow.cpp index 6aff9ec..e555f0f 100644 --- a/graphingwindow.cpp +++ b/graphingwindow.cpp @@ -837,7 +837,7 @@ void GraphingWindow::loadDefinitions() for (int b = 0; b < 8; b++) { - if (oldMask & (1 << b)) + if (oldMask & (1ull << b)) { gp.startBit = (8 * oldEnd) + b; break; @@ -846,7 +846,7 @@ void GraphingWindow::loadDefinitions() for (int c = 7; c >= 0; c--) { - if ( oldMask & (1<<(((numBytes - 1) * 8) + c)) ) + if ( oldMask & (1ull << (((numBytes - 1) * 8) + c)) ) { gp.numBits -= (7-c); break; @@ -865,7 +865,7 @@ void GraphingWindow::loadDefinitions() gp.numBits = 8; for (int b = 0; b < 8; b++) { - if (oldMask & (1 << b)) + if (oldMask & (1ull << b)) { gp.startBit = 8 * oldStart + b; gp.numBits = 8 - b;