Bug 1317637 - Converts for(...; ...; ...) loops to use the new range-based loops in C++11 in gfx/.
MozReview-Commit-ID: Dd6426wCbMg
--- a/gfx/2d/DrawTargetSkia.cpp
+++ b/gfx/2d/DrawTargetSkia.cpp
@@ -188,18 +188,17 @@ VerifyRGBXCorners(uint8_t* aData, const
const int bottomLeft = aStride * height - aStride;
// Lastly the center pixel
int middleRowHeight = height / 2;
int middleRowWidth = (width / 2) * pixelSize;
const int middle = aStride * middleRowHeight + middleRowWidth;
const int offsets[] = { topLeft, topRight, bottomRight, bottomLeft, middle };
- for (size_t i = 0; i < MOZ_ARRAY_LENGTH(offsets); i++) {
- int offset = offsets[i];
+ for (int offset : offsets) {
if (aData[offset + kARGBAlphaOffset] != 0xFF) {
int row = offset / aStride;
int column = (offset % aStride) / pixelSize;
gfxCriticalError() << "RGBX corner pixel at (" << column << "," << row << ") in "
<< width << "x" << height << " surface is not opaque: "
<< int(aData[offset]) << ","
<< int(aData[offset+1]) << ","
<< int(aData[offset+2]) << ","
--- a/gfx/layers/PersistentBufferProvider.cpp
+++ b/gfx/layers/PersistentBufferProvider.cpp
@@ -425,18 +425,18 @@ PersistentBufferProviderShared::NotifyIn
}
void
PersistentBufferProviderShared::Destroy()
{
mSnapshot = nullptr;
mDrawTarget = nullptr;
- for (uint32_t i = 0; i < mTextures.length(); ++i) {
- TextureClient* texture = mTextures[i];
+ for (auto& mTexture : mTextures) {
+ TextureClient* texture = mTexture;
if (texture && texture->IsLocked()) {
MOZ_ASSERT(false);
texture->Unlock();
}
}
mTextures.clear();
}
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -284,18 +284,18 @@ void CrashStatsLogForwarder::UpdateCrash
case GeckoProcessType_GPU:
logAnnotation = "|[G";
break;
default:
logAnnotation = "|[X";
break;
}
- for (LoggingRecord::iterator it = mBuffer.begin(); it != mBuffer.end(); ++it) {
- message << logAnnotation << Get<0>(*it) << "]" << Get<1>(*it) << " (t=" << Get<2>(*it) << ") ";
+ for (auto& it : mBuffer) {
+ message << logAnnotation << Get<0>(it) << "]" << Get<1>(it) << " (t=" << Get<2>(it) << ") ";
}
#ifdef MOZ_CRASHREPORTER
nsCString reportString(message.str().c_str());
nsresult annotated = CrashReporter::AnnotateCrashReport(mCrashCriticalKey, reportString);
#else
nsresult annotated = NS_ERROR_NOT_IMPLEMENTED;
#endif