Fix cases of variable shadowing in /bench/.
If we manage to fix all the existing cases of variable shadowing, we
could enable -Wshadow.
Change-Id: I91187f35a33293914958fba1c0b3b6adf5364e19
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438318
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
diff --git a/bench/CmapBench.cpp b/bench/CmapBench.cpp
index d8193b3..2186406 100644
--- a/bench/CmapBench.cpp
+++ b/bench/CmapBench.cpp
@@ -49,7 +49,7 @@
}
static void addcache_proc(const Rec& r) {
- for (int i = 0; i < r.fLoops; ++i) {
+ for (int loop = 0; loop < r.fLoops; ++loop) {
SkCharToGlyphCache cache;
for (int i = 0; i < r.fCount; ++i) {
cache.addCharAndGlyph(r.fText[i], i);
@@ -58,7 +58,7 @@
}
static void findcache_proc(const Rec& r) {
- for (int i = 0; i < r.fLoops; ++i) {
+ for (int loop = 0; loop < r.fLoops; ++loop) {
for (int i = 0; i < r.fCount; ++i) {
r.fCache.findGlyphIndex(r.fText[i]);
}
diff --git a/bench/CompositingImagesBench.cpp b/bench/CompositingImagesBench.cpp
index 2267ea4..acbe769 100644
--- a/bench/CompositingImagesBench.cpp
+++ b/bench/CompositingImagesBench.cpp
@@ -126,7 +126,7 @@
canvas->save();
canvas->concat(this->getTransform());
- for (int i = 0; i < loops; ++i) {
+ for (int loop = 0; loop < loops; ++loop) {
for (int l = 0; l < fLayerCnt; ++l) {
SkAutoTArray<SkCanvas::ImageSetEntry> set(
fTileGridSize.fWidth * fTileGridSize.fHeight);
diff --git a/bench/FontCacheBench.cpp b/bench/FontCacheBench.cpp
index c85713e..5d8966e 100644
--- a/bench/FontCacheBench.cpp
+++ b/bench/FontCacheBench.cpp
@@ -176,7 +176,7 @@
void onDraw(int loops, SkCanvas* canvas) override {
SkPath path;
- for (int i = 0; i < loops; ++i) {
+ for (int loop = 0; loop < loops; ++loop) {
if (fOneAtATime) {
for (size_t i = 0; i < SK_ARRAY_COUNT(fGlyphs); ++i) {
fFont.getPath(fGlyphs[i], &path);
diff --git a/bench/PictureOverheadBench.cpp b/bench/PictureOverheadBench.cpp
index 4fca2f4..daacf5e 100644
--- a/bench/PictureOverheadBench.cpp
+++ b/bench/PictureOverheadBench.cpp
@@ -21,7 +21,7 @@
void onDraw(int loops, SkCanvas*) override {
SkPictureRecorder rec;
- for (int i = 0; i < loops; i++) {
+ for (int loop = 0; loop < loops; loop++) {
SkCanvas* canvas = rec.beginRecording({0,0, 2000,3000});
SkPaint paint;
diff --git a/bench/ScalarBench.cpp b/bench/ScalarBench.cpp
index 9148532..e47fc63 100644
--- a/bench/ScalarBench.cpp
+++ b/bench/ScalarBench.cpp
@@ -150,7 +150,7 @@
void onDraw(int loops, SkCanvas* canvas) override {
SkRect r;
- for (int i = 0; i < loops; ++i) {
+ for (int loop = 0; loop < loops; ++loop) {
for (int i = 0; i < 1000; ++i) {
r.setBounds(fPts, PTS);
}
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 912ead9..1946b4a 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -1446,8 +1446,8 @@
if (!keys.empty()) {
// dump to json, only SKPBench currently returns valid keys / values
SkASSERT(keys.count() == values.count());
- for (int i = 0; i < keys.count(); i++) {
- log.appendMetric(keys[i].c_str(), values[i]);
+ for (int j = 0; j < keys.count(); j++) {
+ log.appendMetric(keys[j].c_str(), values[j]);
}
}
@@ -1512,8 +1512,8 @@
if (FLAGS_verbose) {
SkDebugf("Samples: ");
- for (int i = 0; i < samples.count(); i++) {
- SkDebugf("%s ", HUMANIZE(samples[i]));
+ for (int j = 0; j < samples.count(); j++) {
+ SkDebugf("%s ", HUMANIZE(samples[j]));
}
SkDebugf("%s\n", bench->getUniqueName());
}