diff --git a/common/lc_array.h b/common/lc_array.h index c57d26d0..9fb6f6ce 100644 --- a/common/lc_array.h +++ b/common/lc_array.h @@ -120,11 +120,11 @@ public: mGrow = Grow; } - void AllocGrow(int Grow) + void AllocGrow(size_t Grow) { if ((mLength + Grow) > mAlloc) { - int NewSize = ((mLength + Grow + mGrow - 1) / mGrow) * mGrow; + size_t NewSize = ((mLength + Grow + mGrow - 1) / mGrow) * mGrow; T* NewData = new T[NewSize]; for (int i = 0; i < mLength; i++) @@ -263,7 +263,7 @@ public: protected: T* mData; int mLength; - int mAlloc; + size_t mAlloc; int mGrow; }; diff --git a/common/lc_file.cpp b/common/lc_file.cpp index 64755e5b..ac75d57b 100644 --- a/common/lc_file.cpp +++ b/common/lc_file.cpp @@ -19,7 +19,7 @@ lcMemFile::~lcMemFile() Close(); } -void lcMemFile::Seek(long Offset, int From) +void lcMemFile::Seek(qint64 Offset, int From) { if (From == SEEK_SET) mPosition = Offset; diff --git a/common/lc_file.h b/common/lc_file.h index 881aac26..e4b1704d 100644 --- a/common/lc_file.h +++ b/common/lc_file.h @@ -19,7 +19,7 @@ public: } virtual long GetPosition() const = 0; - virtual void Seek(long Offset, int From) = 0; + virtual void Seek(qint64 Offset, int From) = 0; virtual size_t GetLength() const = 0; virtual void Close() = 0; @@ -457,7 +457,7 @@ public: virtual ~lcMemFile(); long GetPosition() const override; - void Seek(long Offset, int From) override; + void Seek(qint64 Offset, int From) override; void SetLength(size_t NewLength); size_t GetLength() const override; @@ -503,7 +503,7 @@ public: return mFile.pos(); } - void Seek(long Offset, int From) override + void Seek(qint64 Offset, int From) override { switch (From) { diff --git a/common/lc_http.cpp b/common/lc_http.cpp index f2debdf4..8863eb07 100644 --- a/common/lc_http.cpp +++ b/common/lc_http.cpp @@ -18,8 +18,7 @@ void lcHttpReply::run() HINTERNET Session = nullptr; HINTERNET Request = nullptr; - if (sizeof(wchar_t) != sizeof(QChar)) - return; + static_assert(sizeof(wchar_t) == sizeof(QChar), "Character size mismatch"); Session = InternetOpen(L"LeoCAD", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); if (!Session) diff --git a/common/lc_library.cpp b/common/lc_library.cpp index ef73bf90..f552bcfe 100644 --- a/common/lc_library.cpp +++ b/common/lc_library.cpp @@ -783,7 +783,7 @@ void lcPiecesLibrary::ReadDirectoryDescriptions(const QFileInfoList (&FileLists) ProgressDialog->setWindowFlags(ProgressDialog->windowFlags() & ~Qt::WindowCloseButtonHint); ProgressDialog->setWindowTitle(tr("Initializing")); ProgressDialog->setLabelText(tr("Loading Parts Library")); - ProgressDialog->setMaximum(mPieces.size()); + ProgressDialog->setMaximum((int)mPieces.size()); ProgressDialog->setMinimum(0); ProgressDialog->setValue(0); ProgressDialog->setCancelButton(nullptr); @@ -814,11 +814,11 @@ void lcPiecesLibrary::ReadDirectoryDescriptions(const QFileInfoList (&FileLists) if (Modified) { - lcMemFile IndexFile; + lcMemFile NewIndexFile; - IndexFile.WriteQString(mLibraryDir.absolutePath()); + NewIndexFile.WriteQString(mLibraryDir.absolutePath()); - IndexFile.WriteU32(mPieces.size()); + NewIndexFile.WriteU32((quint32)mPieces.size()); std::vector SortedPieces; SortedPieces.reserve(mPieces.size()); @@ -834,14 +834,14 @@ void lcPiecesLibrary::ReadDirectoryDescriptions(const QFileInfoList (&FileLists) for (const PieceInfo* Info : SortedPieces) { - if (IndexFile.WriteBuffer(Info->mFileName, strlen(Info->mFileName) + 1) == 0) + if (NewIndexFile.WriteBuffer(Info->mFileName, strlen(Info->mFileName) + 1) == 0) return; - if (IndexFile.WriteBuffer(Info->m_strDescription, strlen(Info->m_strDescription) + 1) == 0) + if (NewIndexFile.WriteBuffer(Info->m_strDescription, strlen(Info->m_strDescription) + 1) == 0) return; - IndexFile.WriteU32(Info->mFlags); - IndexFile.WriteU8(Info->mFolderType); + NewIndexFile.WriteU32(Info->mFlags); + NewIndexFile.WriteU8(Info->mFolderType); #if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)) quint64 FileTime = FileLists[Info->mFolderType][Info->mFolderIndex].lastModified().toMSecsSinceEpoch(); @@ -849,10 +849,10 @@ void lcPiecesLibrary::ReadDirectoryDescriptions(const QFileInfoList (&FileLists) quint64 FileTime = FileLists[Info->mFolderType][Info->mFolderIndex].lastModified().toTime_t(); #endif - IndexFile.WriteU64(FileTime); + NewIndexFile.WriteU64(FileTime); } - WriteDirectoryCacheFile(IndexFileName, IndexFile); + WriteDirectoryCacheFile(IndexFileName, NewIndexFile); } } @@ -1062,7 +1062,7 @@ bool lcPiecesLibrary::WriteDirectoryCacheFile(const QString& FileName, lcMemFile if (File.write((char*)&UncompressedSize, sizeof(UncompressedSize)) == -1) return false; - File.write(qCompress(CacheFile.mBuffer, CacheFile.GetLength())); + File.write(qCompress(CacheFile.mBuffer, (int)CacheFile.GetLength())); return true; } @@ -1100,7 +1100,7 @@ bool lcPiecesLibrary::SaveArchiveCacheIndex(const QString& FileName) { lcMemFile IndexFile; - quint32 NumFiles = mPieces.size(); + quint32 NumFiles = (quint32)mPieces.size(); if (IndexFile.WriteBuffer((char*)&NumFiles, sizeof(NumFiles)) == 0) return false; diff --git a/common/lc_mainwindow.cpp b/common/lc_mainwindow.cpp index 829abb30..0ac12bca 100644 --- a/common/lc_mainwindow.cpp +++ b/common/lc_mainwindow.cpp @@ -1192,8 +1192,8 @@ void lcMainWindow::SetSelectionMode(lcSelectionMode SelectionMode) QByteArray lcMainWindow::GetTabLayout() { - QByteArray TabLayout; - QDataStream DataStream(&TabLayout, QIODevice::WriteOnly); + QByteArray TabLayoutData; + QDataStream DataStream(&TabLayoutData, QIODevice::WriteOnly); DataStream << (quint32)LC_TAB_LAYOUT_VERSION; qint32 NumTabs = mModelTabWidget->count(); @@ -1249,7 +1249,7 @@ QByteArray lcMainWindow::GetTabLayout() SaveWidget(TabLayout->itemAt(0)->widget()); } - return TabLayout; + return TabLayoutData; } void lcMainWindow::RestoreTabLayout(const QByteArray& TabLayout) diff --git a/common/lc_shortcuts.cpp b/common/lc_shortcuts.cpp index 33c8161f..f5889a73 100644 --- a/common/lc_shortcuts.cpp +++ b/common/lc_shortcuts.cpp @@ -179,18 +179,18 @@ bool lcMouseShortcuts::Save(QStringList& Shortcuts) return true; } -bool lcMouseShortcuts::Load(const QStringList& Shortcuts) +bool lcMouseShortcuts::Load(const QStringList& FullShortcuts) { memset(mShortcuts, 0, sizeof(mShortcuts)); - for (const QString& Shortcut : Shortcuts) + for (const QString& FullShortcut : FullShortcuts) { - int Equals = Shortcut.indexOf('='); + int Equals = FullShortcut.indexOf('='); if (Equals == -1) continue; - QString Key = Shortcut.left(Equals); + QString Key = FullShortcut.left(Equals); int ToolIdx; for (ToolIdx = 0; ToolIdx < LC_NUM_TOOLS; ToolIdx++) @@ -200,7 +200,7 @@ bool lcMouseShortcuts::Load(const QStringList& Shortcuts) if (ToolIdx == LC_NUM_TOOLS) continue; - QStringList Shortcuts = Shortcut.mid(Equals + 1).split(','); + QStringList Shortcuts = FullShortcut.mid(Equals + 1).split(','); bool AddedShortcut = false; for (const QString& Shortcut : Shortcuts) diff --git a/common/lc_stringcache.cpp b/common/lc_stringcache.cpp index b86298eb..032eac62 100644 --- a/common/lc_stringcache.cpp +++ b/common/lc_stringcache.cpp @@ -18,6 +18,8 @@ lcStringCache::~lcStringCache() void lcStringCache::AddRef(lcContext* Context) { + Q_UNUSED(Context); + mRefCount++; if (mRefCount == 1) diff --git a/common/lc_viewsphere.cpp b/common/lc_viewsphere.cpp index cf4219ab..c2e21b7f 100644 --- a/common/lc_viewsphere.cpp +++ b/common/lc_viewsphere.cpp @@ -328,11 +328,11 @@ std::bitset<6> lcViewSphere::GetIntersectionFlags(lcVector3& Intersection) const { for (int Axis1Idx = 0; Axis1Idx < 6; Axis1Idx++) { - lcVector3 Point(0.0f, 0.0f, 0.0f); + lcVector3 Point1(0.0f, 0.0f, 0.0f); - Point[Axis1Idx / 2] = Axis1Idx % 2 ? -1.0f : 1.0f; + Point1[Axis1Idx / 2] = Axis1Idx % 2 ? -1.0f : 1.0f; - if (lcLengthSquared(Point - Intersection) < mHighlightRadius * mHighlightRadius) + if (lcLengthSquared(Point1 - Intersection) < mHighlightRadius * mHighlightRadius) { IntersectionFlags.set(Axis1Idx); return; @@ -343,11 +343,11 @@ std::bitset<6> lcViewSphere::GetIntersectionFlags(lcVector3& Intersection) const if (Axis1Idx / 2 == Axis2Idx / 2) continue; - lcVector3 Point(0.0f, 0.0f, 0.0f); - Point[Axis1Idx / 2] = Axis1Idx % 2 ? -0.70710678118f : 0.70710678118f; - Point[Axis2Idx / 2] = Axis2Idx % 2 ? -0.70710678118f : 0.70710678118f; + lcVector3 Point2(0.0f, 0.0f, 0.0f); + Point2[Axis1Idx / 2] = Axis1Idx % 2 ? -0.70710678118f : 0.70710678118f; + Point2[Axis2Idx / 2] = Axis2Idx % 2 ? -0.70710678118f : 0.70710678118f; - if (lcLengthSquared(Point - Intersection) < mHighlightRadius * mHighlightRadius) + if (lcLengthSquared(Point2 - Intersection) < mHighlightRadius * mHighlightRadius) { IntersectionFlags.set(Axis1Idx); IntersectionFlags.set(Axis2Idx); @@ -359,12 +359,12 @@ std::bitset<6> lcViewSphere::GetIntersectionFlags(lcVector3& Intersection) const if (Axis1Idx / 2 == Axis3Idx / 2 || Axis2Idx / 2 == Axis3Idx / 2) continue; - lcVector3 Point(0.0f, 0.0f, 0.0f); - Point[Axis1Idx / 2] = Axis1Idx % 2 ? -0.57735026919f : 0.57735026919f; - Point[Axis2Idx / 2] = Axis2Idx % 2 ? -0.57735026919f : 0.57735026919f; - Point[Axis3Idx / 2] = Axis3Idx % 2 ? -0.57735026919f : 0.57735026919f; + lcVector3 Point3(0.0f, 0.0f, 0.0f); + Point3[Axis1Idx / 2] = Axis1Idx % 2 ? -0.57735026919f : 0.57735026919f; + Point3[Axis2Idx / 2] = Axis2Idx % 2 ? -0.57735026919f : 0.57735026919f; + Point3[Axis3Idx / 2] = Axis3Idx % 2 ? -0.57735026919f : 0.57735026919f; - if (lcLengthSquared(Point - Intersection) < mHighlightRadius * mHighlightRadius) + if (lcLengthSquared(Point3 - Intersection) < mHighlightRadius * mHighlightRadius) { IntersectionFlags.set(Axis1Idx); IntersectionFlags.set(Axis2Idx); diff --git a/common/lc_zipfile.cpp b/common/lc_zipfile.cpp index a808057a..89fcf5ed 100644 --- a/common/lc_zipfile.cpp +++ b/common/lc_zipfile.cpp @@ -93,7 +93,7 @@ quint64 lcZipFile::SearchCentralDir() ReadPos = SizeFile - BackRead; ReadSize = ((CommentBufferSize + 4) < (SizeFile - ReadPos)) ? (CommentBufferSize + 4) : (SizeFile - ReadPos); - mFile->Seek((long)ReadPos, SEEK_SET); + mFile->Seek(ReadPos, SEEK_SET); if (mFile->ReadBuffer(buf, (long)ReadSize) != ReadSize) break; @@ -136,7 +136,7 @@ quint64 lcZipFile::SearchCentralDir64() ReadPos = SizeFile - BackRead; ReadSize = ((CommentBufferSize + 4) < (SizeFile - ReadPos)) ? (CommentBufferSize + 4) : (SizeFile - ReadPos); - mFile->Seek((long)ReadPos, SEEK_SET); + mFile->Seek(ReadPos, SEEK_SET); if (mFile->ReadBuffer(buf, (long)ReadSize) != ReadSize) break; @@ -157,7 +157,7 @@ quint64 lcZipFile::SearchCentralDir64() if (PosFound == 0) return 0; - mFile->Seek((long)PosFound, SEEK_SET); + mFile->Seek(PosFound, SEEK_SET); quint32 Number; quint64 RelativeOffset; @@ -185,7 +185,7 @@ quint64 lcZipFile::SearchCentralDir64() return 0; // Go to end of central directory record. - mFile->Seek((long)RelativeOffset, SEEK_SET); + mFile->Seek(RelativeOffset, SEEK_SET); // The signature. if (mFile->ReadU32(&Number, 1) != 1) @@ -208,7 +208,7 @@ bool lcZipFile::CheckFileCoherencyHeader(int FileIndex, quint32* SizeVar, quint6 *OffsetLocalExtraField = 0; *SizeLocalExtraField = 0; - mFile->Seek((long)(FileInfo.offset_curfile + mBytesBeforeZipFile), SEEK_SET); + mFile->Seek(FileInfo.offset_curfile + mBytesBeforeZipFile, SEEK_SET); if (mFile->ReadU32(&Magic, 1) != 1 || Magic != 0x04034b50) return false; @@ -266,7 +266,7 @@ bool lcZipFile::Open() mZip64 = true; // Skip signature, size and versions. - mFile->Seek((long)CentralPos + 4 + 8 + 2 + 2, SEEK_SET); + mFile->Seek(CentralPos + 4 + 8 + 2 + 2, SEEK_SET); // Number of this disk. if (mFile->ReadU32(&NumberDisk, 1) != 1) @@ -310,7 +310,7 @@ bool lcZipFile::Open() mZip64 = false; // Skip signature. - mFile->Seek((long)CentralPos + 4, SEEK_SET); + mFile->Seek(CentralPos + 4, SEEK_SET); // Number of this disk. if (mFile->ReadU16(&NumberDisk, 1) != 1) @@ -361,7 +361,7 @@ bool lcZipFile::ReadCentralDir() { quint64 PosInCentralDir = mCentralDirOffset; - mFile->Seek((long)(PosInCentralDir + mBytesBeforeZipFile), SEEK_SET); + mFile->Seek(PosInCentralDir + mBytesBeforeZipFile, SEEK_SET); mFiles.AllocGrow((int)mNumEntries); for (quint64 FileNum = 0; FileNum < mNumEntries; FileNum++) @@ -636,6 +636,7 @@ bool lcZipFile::ExtractFile(int FileIndex, lcMemFile& File, quint32 MaxLength) File.SetLength(Length); File.Seek(0, SEEK_SET); + Stream.next_in = (Bytef*)ReadBuffer; Stream.next_out = (Bytef*)File.mBuffer; Stream.avail_out = Length; @@ -653,7 +654,7 @@ bool lcZipFile::ExtractFile(int FileIndex, lcMemFile& File, quint32 MaxLength) if (ReadThis == 0) return false; - mFile->Seek((long)(PosInZipfile + mBytesBeforeZipFile), SEEK_SET); + mFile->Seek(PosInZipfile + mBytesBeforeZipFile, SEEK_SET); if (mFile->ReadBuffer(ReadBuffer, ReadThis) != ReadThis) return false; diff --git a/common/piece.cpp b/common/piece.cpp index 9fa6eb05..843e1d3a 100644 --- a/common/piece.cpp +++ b/common/piece.cpp @@ -596,17 +596,17 @@ void lcPiece::DrawInterface(lcContext* Context, const lcScene& Scene) const float Verts[8 * 3]; float* CurVert = Verts; - lcVector3 Min(-LC_PIECE_CONTROL_POINT_SIZE, -LC_PIECE_CONTROL_POINT_SIZE, -LC_PIECE_CONTROL_POINT_SIZE); - lcVector3 Max(LC_PIECE_CONTROL_POINT_SIZE, LC_PIECE_CONTROL_POINT_SIZE, LC_PIECE_CONTROL_POINT_SIZE); + lcVector3 CubeMin(-LC_PIECE_CONTROL_POINT_SIZE, -LC_PIECE_CONTROL_POINT_SIZE, -LC_PIECE_CONTROL_POINT_SIZE); + lcVector3 CubeMax(LC_PIECE_CONTROL_POINT_SIZE, LC_PIECE_CONTROL_POINT_SIZE, LC_PIECE_CONTROL_POINT_SIZE); - *CurVert++ = Min[0]; *CurVert++ = Min[1]; *CurVert++ = Min[2]; - *CurVert++ = Min[0]; *CurVert++ = Max[1]; *CurVert++ = Min[2]; - *CurVert++ = Max[0]; *CurVert++ = Max[1]; *CurVert++ = Min[2]; - *CurVert++ = Max[0]; *CurVert++ = Min[1]; *CurVert++ = Min[2]; - *CurVert++ = Min[0]; *CurVert++ = Min[1]; *CurVert++ = Max[2]; - *CurVert++ = Min[0]; *CurVert++ = Max[1]; *CurVert++ = Max[2]; - *CurVert++ = Max[0]; *CurVert++ = Max[1]; *CurVert++ = Max[2]; - *CurVert++ = Max[0]; *CurVert++ = Min[1]; *CurVert++ = Max[2]; + *CurVert++ = CubeMin[0]; *CurVert++ = CubeMin[1]; *CurVert++ = CubeMin[2]; + *CurVert++ = CubeMin[0]; *CurVert++ = CubeMax[1]; *CurVert++ = CubeMin[2]; + *CurVert++ = CubeMax[0]; *CurVert++ = CubeMax[1]; *CurVert++ = CubeMin[2]; + *CurVert++ = CubeMax[0]; *CurVert++ = CubeMin[1]; *CurVert++ = CubeMin[2]; + *CurVert++ = CubeMin[0]; *CurVert++ = CubeMin[1]; *CurVert++ = CubeMax[2]; + *CurVert++ = CubeMin[0]; *CurVert++ = CubeMax[1]; *CurVert++ = CubeMax[2]; + *CurVert++ = CubeMax[0]; *CurVert++ = CubeMax[1]; *CurVert++ = CubeMax[2]; + *CurVert++ = CubeMax[0]; *CurVert++ = CubeMin[1]; *CurVert++ = CubeMax[2]; const GLushort Indices[36] = { diff --git a/common/project.cpp b/common/project.cpp index 09b91604..6d91ba44 100644 --- a/common/project.cpp +++ b/common/project.cpp @@ -192,11 +192,11 @@ QString Project::GetNewModelName(QWidget* ParentWidget, const QString& DialogTit for (int ModelIdx = 0; ModelIdx < ExistingModels.size(); ModelIdx++) { - const QString& Name = ExistingModels[ModelIdx]; + const QString& ExistingName = ExistingModels[ModelIdx]; - if (Name.startsWith(Prefix)) + if (ExistingName.startsWith(Prefix)) { - QString NumberString = Name.mid(Prefix.length()); + QString NumberString = ExistingName.mid(Prefix.length()); QTextStream Stream(&NumberString); int Number; Stream >> Number; @@ -552,19 +552,14 @@ bool Project::ImportLDD(const QString& FileName) Model->SetSaved(); } else - delete Model; - - if (mModels.IsEmpty()) - return false; - - if (mModels.GetSize() == 1) { - lcModel* Model = mModels[0]; - - if (Model->GetProperties().mName.isEmpty()) - Model->SetName(QFileInfo(FileName).completeBaseName()); + delete Model; + return false; } + if (Model->GetProperties().mName.isEmpty()) + Model->SetName(QFileInfo(FileName).completeBaseName()); + for (int ModelIdx = 0; ModelIdx < mModels.GetSize(); ModelIdx++) mModels[ModelIdx]->CreatePieceInfo(this); @@ -593,19 +588,14 @@ bool Project::ImportInventory(const QByteArray& Inventory, const QString& Name, Model->SetSaved(); } else - delete Model; - - if (mModels.IsEmpty()) - return false; - - if (mModels.GetSize() == 1) { - lcModel* Model = mModels[0]; - - Model->SetName(Name); - Model->SetDescription(Description); + delete Model; + return false; } + Model->SetName(Name); + Model->SetDescription(Description); + for (int ModelIdx = 0; ModelIdx < mModels.GetSize(); ModelIdx++) mModels[ModelIdx]->CreatePieceInfo(this); @@ -1670,10 +1660,10 @@ QImage Project::CreatePartsListImage(lcModel* Model, lcStep Step) CurrentHeight += NextHeightIncrease; } - QImage Image(MaxWidth + 40, CurrentHeight + 40, QImage::Format_ARGB32); - Image.fill(QColor(255, 255, 255, 0)); + QImage PainterImage(MaxWidth + 40, CurrentHeight + 40, QImage::Format_ARGB32); + PainterImage.fill(QColor(255, 255, 255, 0)); - QPainter Painter(&Image); + QPainter Painter(&PainterImage); Painter.setFont(Font); for (lcPartsListImage& Image : Images) @@ -1685,7 +1675,7 @@ QImage Project::CreatePartsListImage(lcModel* Model, lcStep Step) Painter.end(); - return Image; + return PainterImage; } void Project::CreateHTMLPieceList(QTextStream& Stream, lcModel* Model, lcStep Step, bool Images) diff --git a/common/view.cpp b/common/view.cpp index 70fb41ce..5db066b7 100644 --- a/common/view.cpp +++ b/common/view.cpp @@ -690,7 +690,7 @@ lcArray View::FindObjectsInBox(float x1, float y1, float x2, float y2 lcVector3(Right, Bottom, 1) }}; - UnprojectPoints(Corners.data(), Corners.size()); + UnprojectPoints(Corners.data(), (int)Corners.size()); lcModel* ActiveModel = GetActiveModel(); diff --git a/leocad.pro b/leocad.pro index 6d9a6a83..aa010039 100644 --- a/leocad.pro +++ b/leocad.pro @@ -22,6 +22,7 @@ win32 { } win32-msvc* { QMAKE_CXXFLAGS_WARN_ON += -wd4100 + QMAKE_CXXFLAGS *= /MP /W4 PRECOMPILED_HEADER = common/lc_global.h DEFINES += _CRT_SECURE_NO_WARNINGS _CRT_SECURE_NO_DEPRECATE=1 _CRT_NONSTDC_NO_WARNINGS=1 greaterThan(QT_MAJOR_VERSION, 4) { diff --git a/qt/lc_qpropertiesdialog.cpp b/qt/lc_qpropertiesdialog.cpp index a757bf09..0b0dd54d 100644 --- a/qt/lc_qpropertiesdialog.cpp +++ b/qt/lc_qpropertiesdialog.cpp @@ -71,7 +71,7 @@ lcQPropertiesDialog::lcQPropertiesDialog(QWidget *parent, void *data) : QTableWidget *table = ui->partsTable; table->setColumnCount(NumColors + 2); - table->setRowCount(PartsList.size() + 1); + table->setRowCount((int)PartsList.size() + 1); table->setHorizontalHeaderLabels(horizontalLabels); #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) @@ -80,8 +80,8 @@ lcQPropertiesDialog::lcQPropertiesDialog(QWidget *parent, void *data) : table->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents); #endif - QVector InfoTotals(PartsList.size()); - QVector ColorTotals(NumColors); + std::vector InfoTotals(PartsList.size()); + std::vector ColorTotals(NumColors); int Row = 0, Total = 0; for (const auto& PartIt : PartsList) @@ -105,7 +105,7 @@ lcQPropertiesDialog::lcQPropertiesDialog(QWidget *parent, void *data) : Row++; } - table->setItem(InfoTotals.size(), 0, new QTableWidgetItem(tr("Total"))); + table->setItem((int)InfoTotals.size(), 0, new QTableWidgetItem(tr("Total"))); for (Row = 0; Row < InfoTotals.size(); Row++) { @@ -118,12 +118,12 @@ lcQPropertiesDialog::lcQPropertiesDialog(QWidget *parent, void *data) : { QTableWidgetItem *item = new QTableWidgetItem(QString::number(ColorTotals[colorIdx])); item->setTextAlignment(Qt::AlignCenter); - table->setItem(InfoTotals.size(), colorIdx + 1, item); + table->setItem((int)InfoTotals.size(), colorIdx + 1, item); } QTableWidgetItem *item = new QTableWidgetItem(QString::number(Total)); item->setTextAlignment(Qt::AlignCenter); - table->setItem(InfoTotals.size(), NumColors + 1, item); + table->setItem((int)InfoTotals.size(), NumColors + 1, item); } lcQPropertiesDialog::~lcQPropertiesDialog() diff --git a/qt/system.cpp b/qt/system.cpp index a8ed4206..b4a5a3c0 100644 --- a/qt/system.cpp +++ b/qt/system.cpp @@ -5,12 +5,11 @@ char* strcasestr(const char *s, const char *find) { char c, sc; - size_t len; if ((c = *find++) != 0) { c = tolower((unsigned char)c); - len = strlen(find); + int len = (int)strlen(find); do { do