Replace a number of incorrect index types

macos_ci
Evil Eye 2 years ago
parent e01a3076dd
commit 6b7e7acd16

@ -781,7 +781,7 @@ namespace EsmTool
for (int skill : mData.mData.mSkills) for (int skill : mData.mData.mSkills)
if (skill != -1) if (skill != -1)
std::cout << " Skill: " << skillLabel(skill) << " (" << skill << ")" << std::endl; std::cout << " Skill: " << skillLabel(skill) << " (" << skill << ")" << std::endl;
for (int i = 0; i != mData.mData.mRankData.size(); i++) for (size_t i = 0; i != mData.mData.mRankData.size(); i++)
if (!mData.mRanks[i].empty()) if (!mData.mRanks[i].empty())
{ {
std::cout << " Rank: " << mData.mRanks[i] << std::endl; std::cout << " Rank: " << mData.mRanks[i] << std::endl;

@ -249,7 +249,7 @@ namespace ESSImport
{ {
ESM::InventoryState& invState = mContext->mPlayer.mObject.mInventory; ESM::InventoryState& invState = mContext->mPlayer.mObject.mInventory;
for (unsigned int i = 0; i < invState.mItems.size(); ++i) for (size_t i = 0; i < invState.mItems.size(); ++i)
{ {
// FIXME: in case of conflict (multiple items with this refID) use the already equipped one? // FIXME: in case of conflict (multiple items with this refID) use the already equipped one?
if (invState.mItems[i].mRef.mRefID == ESM::RefId::stringRefId(refr.mActorData.mSelectedEnchantItem)) if (invState.mItems[i].mRef.mRefID == ESM::RefId::stringRefId(refr.mActorData.mSelectedEnchantItem))

@ -162,7 +162,7 @@ namespace ESSImport
read(mOutFile, file2); // todo rename variable read(mOutFile, file2); // todo rename variable
// FIXME: use max(size1, size2) // FIXME: use max(size1, size2)
for (unsigned int i = 0; i < file1.mRecords.size(); ++i) for (size_t i = 0; i < file1.mRecords.size(); ++i)
{ {
File::Record rec = file1.mRecords[i]; File::Record rec = file1.mRecords[i];
@ -185,7 +185,7 @@ namespace ESSImport
} }
// FIXME: use max(size1, size2) // FIXME: use max(size1, size2)
for (unsigned int j = 0; j < rec.mSubrecords.size(); ++j) for (size_t j = 0; j < rec.mSubrecords.size(); ++j)
{ {
File::Subrecord sub = rec.mSubrecords[j]; File::Subrecord sub = rec.mSubrecords[j];
@ -221,7 +221,7 @@ namespace ESSImport
<< std::hex << sub.mFileOffset << " (2) 0x" << sub2.mFileOffset << std::endl; << std::hex << sub.mFileOffset << " (2) 0x" << sub2.mFileOffset << std::endl;
std::cout << "Data 1:" << std::endl; std::cout << "Data 1:" << std::endl;
for (unsigned int k = 0; k < sub.mData.size(); ++k) for (size_t k = 0; k < sub.mData.size(); ++k)
{ {
bool different = false; bool different = false;
if (k >= sub2.mData.size() || sub2.mData[k] != sub.mData[k]) if (k >= sub2.mData.size() || sub2.mData[k] != sub.mData[k])
@ -236,7 +236,7 @@ namespace ESSImport
std::cout << std::endl; std::cout << std::endl;
std::cout << "Data 2:" << std::endl; std::cout << "Data 2:" << std::endl;
for (unsigned int k = 0; k < sub2.mData.size(); ++k) for (size_t k = 0; k < sub2.mData.size(); ++k)
{ {
bool different = false; bool different = false;
if (k >= sub.mData.size() || sub.mData[k] != sub2.mData[k]) if (k >= sub.mData.size() || sub.mData[k] != sub2.mData[k])

@ -82,9 +82,9 @@ std::pair<QWidget*, QWidget*> CSMPrefs::EnumSetting::makeWidgets(QWidget* parent
mWidget = new QComboBox(parent); mWidget = new QComboBox(parent);
int index = 0; size_t index = 0;
for (int i = 0; i < static_cast<int>(mValues.mValues.size()); ++i) for (size_t i = 0; i < mValues.mValues.size(); ++i)
{ {
if (mDefault.mValue == mValues.mValues[i].mValue) if (mDefault.mValue == mValues.mValues[i].mValue)
index = i; index = i;
@ -95,7 +95,7 @@ std::pair<QWidget*, QWidget*> CSMPrefs::EnumSetting::makeWidgets(QWidget* parent
mWidget->setItemData(i, QString::fromUtf8(mValues.mValues[i].mTooltip.c_str()), Qt::ToolTipRole); mWidget->setItemData(i, QString::fromUtf8(mValues.mValues[i].mTooltip.c_str()), Qt::ToolTipRole);
} }
mWidget->setCurrentIndex(index); mWidget->setCurrentIndex(static_cast<int>(index));
if (!mTooltip.empty()) if (!mTooltip.empty())
{ {

@ -1039,14 +1039,14 @@ void CSMTools::ReferenceableCheckStage::listCheck(
someID, "Chance that no object is used is over 100 percent", "", CSMDoc::Message::Severity_Warning); someID, "Chance that no object is used is over 100 percent", "", CSMDoc::Message::Severity_Warning);
} }
for (unsigned i = 0; i < someList.mList.size(); ++i) for (const auto& element : someList.mList)
{ {
if (mReferencables.searchId(someList.mList[i].mId).first == -1) if (mReferencables.searchId(element.mId).first == -1)
messages.add(someID, "Object '" + someList.mList[i].mId.getRefIdString() + "' does not exist", "", messages.add(someID, "Object '" + element.mId.getRefIdString() + "' does not exist", "",
CSMDoc::Message::Severity_Error); CSMDoc::Message::Severity_Error);
if (someList.mList[i].mLevel < 1) if (element.mLevel < 1)
messages.add(someID, "Level of item '" + someList.mList[i].mId.getRefIdString() + "' is non-positive", "", messages.add(someID, "Level of item '" + element.mId.getRefIdString() + "' is non-positive", "",
CSMDoc::Message::Severity_Error); CSMDoc::Message::Severity_Error);
} }
} }

@ -134,9 +134,9 @@ CSMWorld::NestableColumn::NestableColumn(int columnId, CSMWorld::ColumnBase::Dis
CSMWorld::NestableColumn::~NestableColumn() CSMWorld::NestableColumn::~NestableColumn()
{ {
for (unsigned int i = 0; i < mNestedColumns.size(); ++i) for (auto* col : mNestedColumns)
{ {
delete mNestedColumns[i]; delete col;
} }
} }

@ -1026,12 +1026,12 @@ int CSMWorld::Data::getTotalRecords(const std::vector<std::filesystem::path>& fi
std::unique_ptr<ESM::ESMReader> reader = std::make_unique<ESM::ESMReader>(); std::unique_ptr<ESM::ESMReader> reader = std::make_unique<ESM::ESMReader>();
for (unsigned int i = 0; i < files.size(); ++i) for (const auto& file : files)
{ {
if (!std::filesystem::exists(files[i])) if (!std::filesystem::exists(file))
continue; continue;
reader->open(files[i]); reader->open(file);
records += reader->getRecordCount(); records += reader->getRecordCount();
reader->close(); reader->close();
} }

@ -45,21 +45,21 @@ std::string CSMWorld::TableMimeData::getIcon() const
std::string tmpIcon; std::string tmpIcon;
bool firstIteration = true; bool firstIteration = true;
for (unsigned i = 0; i < mUniversalId.size(); ++i) for (const auto& id : mUniversalId)
{ {
if (firstIteration) if (firstIteration)
{ {
firstIteration = false; firstIteration = false;
tmpIcon = mUniversalId[i].getIcon(); tmpIcon = id.getIcon();
continue; continue;
} }
if (tmpIcon != mUniversalId[i].getIcon()) if (tmpIcon != id.getIcon())
{ {
return ":/multitype.png"; // icon stolen from gnome TODO: get new icon return ":/multitype.png"; // icon stolen from gnome TODO: get new icon
} }
tmpIcon = mUniversalId[i].getIcon(); tmpIcon = id.getIcon();
} }
return mUniversalId.begin()->getIcon(); // All objects are of the same type; return mUniversalId.begin()->getIcon(); // All objects are of the same type;

@ -698,9 +698,9 @@ bool CSVRender::PagedWorldspaceWidget::handleDrop(
return false; return false;
bool selectionChanged = false; bool selectionChanged = false;
for (unsigned i = 0; i < universalIdData.size(); ++i) for (const auto& id : universalIdData)
{ {
std::pair<int, int> coordinates(getCoordinatesFromId(universalIdData[i].getId())); std::pair<int, int> coordinates(getCoordinatesFromId(id.getId()));
if (mSelection.add(CSMWorld::CellCoordinates(coordinates.first, coordinates.second))) if (mSelection.add(CSMWorld::CellCoordinates(coordinates.first, coordinates.second)))
{ {
selectionChanged = true; selectionChanged = true;

@ -347,10 +347,10 @@ namespace CSVRender
QModelIndex parent = model->index(recordIndex, parentColumn); QModelIndex parent = model->index(recordIndex, parentColumn);
for (size_t i = 0; i < mSelected.size(); ++i) for (const auto& selected : mSelected)
{ {
const CSMWorld::Pathgrid::Point& point = source->mPoints[mSelected[i]]; const CSMWorld::Pathgrid::Point& point = source->mPoints[selected];
int row = static_cast<int>(mSelected[i]); int row = static_cast<int>(selected);
commands.push(new CSMWorld::ModifyCommand( commands.push(new CSMWorld::ModifyCommand(
*model, model->index(row, posXColumn, parent), clampToCell(point.mX + offsetX))); *model, model->index(row, posXColumn, parent), clampToCell(point.mX + offsetX)));
@ -378,9 +378,9 @@ namespace CSVRender
const CSMWorld::Pathgrid* source = getPathgridSource(); const CSMWorld::Pathgrid* source = getPathgridSource();
if (source) if (source)
{ {
for (size_t i = 0; i < mSelected.size(); ++i) for (const auto& selected : mSelected)
{ {
addEdge(commands, *source, node, mSelected[i]); addEdge(commands, *source, node, selected);
} }
} }
} }

@ -227,11 +227,11 @@ void CSVWorld::DialogueDelegateDispatcher::setEditorData(QWidget* editor, const
delegateIt->second->setEditorData(editor, index, true); delegateIt->second->setEditorData(editor, index, true);
} }
for (unsigned i = 0; i < mProxys.size(); ++i) for (const auto& proxy : mProxys)
{ {
if (mProxys[i]->getEditor() == editor) if (proxy->getEditor() == editor)
{ {
mProxys[i]->setIndex(index); proxy->setIndex(index);
} }
} }
} }
@ -341,9 +341,9 @@ QWidget* CSVWorld::DialogueDelegateDispatcher::makeEditor(
CSVWorld::DialogueDelegateDispatcher::~DialogueDelegateDispatcher() CSVWorld::DialogueDelegateDispatcher::~DialogueDelegateDispatcher()
{ {
for (unsigned i = 0; i < mProxys.size(); ++i) for (auto* proxy : mProxys)
{ {
delete mProxys[i]; // unique_ptr could be handy delete proxy; // unique_ptr could be handy
} }
} }
@ -477,8 +477,8 @@ void CSVWorld::EditWidget::createEditorContextMenu(
CSVWorld::EditWidget::~EditWidget() CSVWorld::EditWidget::~EditWidget()
{ {
for (unsigned i = 0; i < mNestedModels.size(); ++i) for (auto* model : mNestedModels)
delete mNestedModels[i]; delete model;
if (mDispatcher) if (mDispatcher)
delete mDispatcher; delete mDispatcher;
@ -511,8 +511,8 @@ void CSVWorld::EditWidget::remake(int row)
} }
mMainWidget = new QWidget(this); mMainWidget = new QWidget(this);
for (unsigned i = 0; i < mNestedModels.size(); ++i) for (auto* model : mNestedModels)
delete mNestedModels[i]; delete model;
mNestedModels.clear(); mNestedModels.clear();

@ -611,7 +611,7 @@ void CSVWorld::Table::moveRecords(QDropEvent* event)
std::vector<int> newOrder(highestDifference + 1); std::vector<int> newOrder(highestDifference + 1);
for (long unsigned int i = 0; i < newOrder.size(); ++i) for (int i = 0; i <= highestDifference; ++i)
{ {
newOrder[i] = i; newOrder[i] = i;
} }

@ -108,7 +108,7 @@ namespace MWClass
// hide effects the player doesn't know about // hide effects the player doesn't know about
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
for (unsigned int i = 0; i < info.effects.size(); ++i) for (size_t i = 0; i < info.effects.size(); ++i)
info.effects[i].mKnown = MWMechanics::Alchemy::knownEffect(i, player); info.effects[i].mKnown = MWMechanics::Alchemy::knownEffect(i, player);
info.isPotion = true; info.isPotion = true;

@ -462,7 +462,7 @@ namespace MWGui::Formatting
mPaginator.setIgnoreLeadingEmptyLines(true); mPaginator.setIgnoreLeadingEmptyLines(true);
const MyGUI::VectorLineInfo& lines = mEditBox->getSubWidgetText()->castType<MyGUI::EditText>()->getLineInfo(); const MyGUI::VectorLineInfo& lines = mEditBox->getSubWidgetText()->castType<MyGUI::EditText>()->getLineInfo();
for (unsigned int i = lastLine; i < lines.size(); ++i) for (size_t i = lastLine; i < lines.size(); ++i)
{ {
if (lines[i].width == 0) if (lines[i].width == 0)
ret += lineHeight; ret += lineHeight;

@ -163,13 +163,13 @@ namespace MWGui
setGender(proto.isMale() ? GM_Male : GM_Female); setGender(proto.isMale() ? GM_Male : GM_Female);
recountParts(); recountParts();
for (unsigned int i = 0; i < mAvailableHeads.size(); ++i) for (size_t i = 0; i < mAvailableHeads.size(); ++i)
{ {
if (mAvailableHeads[i] == proto.mHead) if (mAvailableHeads[i] == proto.mHead)
mFaceIndex = i; mFaceIndex = i;
} }
for (unsigned int i = 0; i < mAvailableHairs.size(); ++i) for (size_t i = 0; i < mAvailableHairs.size(); ++i)
{ {
if (mAvailableHairs[i] == proto.mHair) if (mAvailableHairs[i] == proto.mHair)
mHairIndex = i; mHairIndex = i;

@ -121,19 +121,19 @@ namespace MWGui
else if (mPtr.getType() == ESM::Creature::sRecordId) else if (mPtr.getType() == ESM::Creature::sRecordId)
transport = mPtr.get<ESM::Creature>()->mBase->getTransport(); transport = mPtr.get<ESM::Creature>()->mBase->getTransport();
for (unsigned int i = 0; i < transport.size(); i++) for (const auto& dest : transport)
{ {
std::string_view cellname = transport[i].mCellName; std::string_view cellname = dest.mCellName;
bool interior = true; bool interior = true;
const ESM::ExteriorCellLocation cellIndex const ESM::ExteriorCellLocation cellIndex
= ESM::positionToExteriorCellLocation(transport[i].mPos.pos[0], transport[i].mPos.pos[1]); = ESM::positionToExteriorCellLocation(dest.mPos.pos[0], dest.mPos.pos[1]);
if (cellname.empty()) if (cellname.empty())
{ {
MWWorld::CellStore& cell = MWBase::Environment::get().getWorldModel()->getExterior(cellIndex); MWWorld::CellStore& cell = MWBase::Environment::get().getWorldModel()->getExterior(cellIndex);
cellname = MWBase::Environment::get().getWorld()->getCellName(&cell); cellname = MWBase::Environment::get().getWorld()->getCellName(&cell);
interior = false; interior = false;
} }
addDestination(ESM::RefId::stringRefId(cellname), transport[i].mPos, interior); addDestination(ESM::RefId::stringRefId(cellname), dest.mPos, interior);
} }
updateLabels(); updateLabels();

Loading…
Cancel
Save