aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2018-05-08 10:07:35 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2018-05-08 13:16:12 +0000
commit9ce75e086cc2cd22cbcc0541024fb9044f3cd7ec (patch)
treef297fc304abefef6255e10379ebac9aff8f04935 /src
parentc65c5e14142f99e8e5014f6213e272017f84953e (diff)
Fix size_t/int size difference warnings
Change-Id: I1f22a986cdb581cdd968b6f09bde4fe46d7f97f4 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/lib/corelib/buildgraph/buildgraphloader.cpp38
-rw-r--r--src/lib/corelib/buildgraph/projectbuilddata.cpp2
2 files changed, 22 insertions, 18 deletions
diff --git a/src/lib/corelib/buildgraph/buildgraphloader.cpp b/src/lib/corelib/buildgraph/buildgraphloader.cpp
index cc71cd0d6..bef7145ca 100644
--- a/src/lib/corelib/buildgraph/buildgraphloader.cpp
+++ b/src/lib/corelib/buildgraph/buildgraphloader.cpp
@@ -395,23 +395,27 @@ void BuildGraphLoader::trackProjectChanges()
m_result.newlyResolvedProject->buildData.swap(restoredProject->buildData);
QBS_CHECK(m_result.newlyResolvedProject->buildData);
m_result.newlyResolvedProject->buildData->setDirty();
- for (int i = allNewlyResolvedProducts.size() - 1; i >= 0; --i) {
- const ResolvedProductPtr &newlyResolvedProduct = allNewlyResolvedProducts.at(i);
- for (int j = allRestoredProducts.size() - 1; j >= 0; --j) {
- const ResolvedProductPtr &restoredProduct = allRestoredProducts.at(j);
- if (newlyResolvedProduct->uniqueName() == restoredProduct->uniqueName()) {
- if (newlyResolvedProduct->enabled)
- newlyResolvedProduct->buildData.swap(restoredProduct->buildData);
- if (newlyResolvedProduct->buildData)
- updateProductAndRulePointers(newlyResolvedProduct);
-
- // Keep in list if build data still needs to be resolved.
- if (!newlyResolvedProduct->enabled || newlyResolvedProduct->buildData)
- allNewlyResolvedProducts.erase(allNewlyResolvedProducts.begin() + i);
-
- allRestoredProducts.erase(allRestoredProducts.begin() + j);
- break;
- }
+
+ for (auto it = allNewlyResolvedProducts.begin(); it != allNewlyResolvedProducts.end();) {
+ const ResolvedProductPtr &newlyResolvedProduct = *it;
+ auto k = std::find_if(allRestoredProducts.begin(), allRestoredProducts.end(),
+ [&newlyResolvedProduct](const ResolvedProductPtr &restoredProduct) {
+ return newlyResolvedProduct->uniqueName() == restoredProduct->uniqueName();
+ });
+ if (k == allRestoredProducts.end()) {
+ ++it;
+ } else {
+ const ResolvedProductPtr &restoredProduct = *k;
+ if (newlyResolvedProduct->enabled)
+ newlyResolvedProduct->buildData.swap(restoredProduct->buildData);
+ if (newlyResolvedProduct->buildData)
+ updateProductAndRulePointers(newlyResolvedProduct);
+
+ // Keep in list if build data still needs to be resolved.
+ if (!newlyResolvedProduct->enabled || newlyResolvedProduct->buildData)
+ it = allNewlyResolvedProducts.erase(it);
+
+ allRestoredProducts.erase(k);
}
}
diff --git a/src/lib/corelib/buildgraph/projectbuilddata.cpp b/src/lib/corelib/buildgraph/projectbuilddata.cpp
index e48a31695..2874fe23c 100644
--- a/src/lib/corelib/buildgraph/projectbuilddata.cpp
+++ b/src/lib/corelib/buildgraph/projectbuilddata.cpp
@@ -292,7 +292,7 @@ void BuildDataResolver::resolveBuildData(const TopLevelProjectPtr &resolvedProje
resolvedProject->buildData->evaluationContext = evalContext;
const std::vector<ResolvedProductPtr> &allProducts = resolvedProject->allProducts();
evalContext->initializeObserver(Tr::tr("Setting up build graph for configuration %1")
- .arg(resolvedProject->id()), allProducts.size() + 1);
+ .arg(resolvedProject->id()), int(allProducts.size()) + 1);
for (ResolvedProductPtr rProduct : allProducts) {
if (rProduct->enabled)
resolveProductBuildData(rProduct);