Fix lots of variable shadowing in ANGLE

BUG=angle:877

Change-Id: I15168ae32605b26aee08274464ffe68adb5a7e87
Reviewed-on: https://chromium-review.googlesource.com/242351
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Austin Kinross <aukinros@microsoft.com>
diff --git a/src/compiler/translator/Compiler.cpp b/src/compiler/translator/Compiler.cpp
index d7d98b5..5eac0c5 100644
--- a/src/compiler/translator/Compiler.cpp
+++ b/src/compiler/translator/Compiler.cpp
@@ -423,25 +423,25 @@
     nameMap.clear();
 }
 
-bool TCompiler::detectCallDepth(TIntermNode* root, TInfoSink& infoSink, bool limitCallStackDepth)
+bool TCompiler::detectCallDepth(TIntermNode* inputRoot, TInfoSink& inputInfoSink, bool limitCallStackDepth)
 {
-    DetectCallDepth detect(infoSink, limitCallStackDepth, maxCallStackDepth);
-    root->traverse(&detect);
+    DetectCallDepth detect(inputInfoSink, limitCallStackDepth, maxCallStackDepth);
+    inputRoot->traverse(&detect);
     switch (detect.detectCallDepth())
     {
       case DetectCallDepth::kErrorNone:
         return true;
       case DetectCallDepth::kErrorMissingMain:
-        infoSink.info.prefix(EPrefixError);
-        infoSink.info << "Missing main()";
+        inputInfoSink.info.prefix(EPrefixError);
+        inputInfoSink.info << "Missing main()";
         return false;
       case DetectCallDepth::kErrorRecursion:
-        infoSink.info.prefix(EPrefixError);
-        infoSink.info << "Function recursion detected";
+        inputInfoSink.info.prefix(EPrefixError);
+        inputInfoSink.info << "Function recursion detected";
         return false;
       case DetectCallDepth::kErrorMaxDepthExceeded:
-        infoSink.info.prefix(EPrefixError);
-        infoSink.info << "Function call stack too deep";
+        inputInfoSink.info.prefix(EPrefixError);
+        inputInfoSink.info << "Function call stack too deep";
         return false;
       default:
         UNREACHABLE();
diff --git a/src/compiler/translator/DetectCallDepth.cpp b/src/compiler/translator/DetectCallDepth.cpp
index bfc1d58..0dc5d22 100644
--- a/src/compiler/translator/DetectCallDepth.cpp
+++ b/src/compiler/translator/DetectCallDepth.cpp
@@ -33,7 +33,7 @@
     ASSERT(visit == PreVisit);
     ASSERT(detectCallDepth);
 
-    int maxDepth = depth;
+    int retMaxDepth = depth;
     visit = InVisit;
     for (size_t i = 0; i < callees.size(); ++i) {
         switch (callees[i]->visit) {
@@ -52,7 +52,7 @@
                     detectCallDepth->getInfoSink().info << "<-" << callees[i]->getName();
                     return callDepth;
                 }
-                maxDepth = std::max(callDepth, maxDepth);
+                retMaxDepth = std::max(callDepth, retMaxDepth);
                 break;
             }
             default:
@@ -61,7 +61,7 @@
         }
     }
     visit = PostVisit;
-    return maxDepth;
+    return retMaxDepth;
 }
 
 void DetectCallDepth::FunctionNode::reset()
diff --git a/src/compiler/translator/OutputGLSLBase.cpp b/src/compiler/translator/OutputGLSLBase.cpp
index b98f5d5..8d8830c 100644
--- a/src/compiler/translator/OutputGLSLBase.cpp
+++ b/src/compiler/translator/OutputGLSLBase.cpp
@@ -651,11 +651,11 @@
         for (TIntermSequence::const_iterator iter = node->getSequence()->begin();
              iter != node->getSequence()->end(); ++iter)
         {
-            TIntermNode *node = *iter;
-            ASSERT(node != NULL);
-            node->traverse(this);
+            TIntermNode *curNode = *iter;
+            ASSERT(curNode != NULL);
+            curNode->traverse(this);
 
-            if (isSingleStatement(node))
+            if (isSingleStatement(curNode))
                 out << ";\n";
         }
         decrementDepth();
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index de9295b..e2959d7 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -1077,14 +1077,14 @@
 //
 // Return the function symbol if found, otherwise 0.
 //
-const TFunction* TParseContext::findFunction(const TSourceLoc& line, TFunction* call, int shaderVersion, bool *builtIn)
+const TFunction* TParseContext::findFunction(const TSourceLoc& line, TFunction* call, int inputShaderVersion, bool *builtIn)
 {
     // First find by unmangled name to check whether the function name has been
     // hidden by a variable name or struct typename.
     // If a function is found, check for one with a matching argument list.
-    const TSymbol* symbol = symbolTable.find(call->getName(), shaderVersion, builtIn);
+    const TSymbol* symbol = symbolTable.find(call->getName(), inputShaderVersion, builtIn);
     if (symbol == 0 || symbol->isFunction()) {
-        symbol = symbolTable.find(call->getMangledName(), shaderVersion, builtIn);
+        symbol = symbolTable.find(call->getMangledName(), inputShaderVersion, builtIn);
     }
 
     if (symbol == 0) {
diff --git a/src/compiler/translator/ParseContext.h b/src/compiler/translator/ParseContext.h
index ed4b7b4..23be57e 100644
--- a/src/compiler/translator/ParseContext.h
+++ b/src/compiler/translator/ParseContext.h
@@ -120,7 +120,7 @@
 
     bool containsSampler(TType& type);
     bool areAllChildConst(TIntermAggregate* aggrNode);
-    const TFunction* findFunction(const TSourceLoc& line, TFunction* pfnCall, int shaderVersion, bool *builtIn = 0);
+    const TFunction* findFunction(const TSourceLoc& line, TFunction* pfnCall, int inputShaderVersion, bool *builtIn = 0);
     bool executeInitializer(const TSourceLoc& line, const TString& identifier, TPublicType& pType,
                             TIntermTyped* initializer, TIntermNode*& intermNode, TVariable* variable = 0);
 
diff --git a/src/compiler/translator/QualifierAlive.cpp b/src/compiler/translator/QualifierAlive.cpp
index 1f6fb75..3d950aa 100644
--- a/src/compiler/translator/QualifierAlive.cpp
+++ b/src/compiler/translator/QualifierAlive.cpp
@@ -49,7 +49,7 @@
         found = true;
 }
 
-bool TAliveTraverser::visitSelection(Visit preVisit, TIntermSelection* node)
+bool TAliveTraverser::visitSelection(Visit, TIntermSelection*)
 {
     if (wasFound())
         return false;
diff --git a/src/compiler/translator/ShaderVars.cpp b/src/compiler/translator/ShaderVars.cpp
index 3098a7f..187b73e 100644
--- a/src/compiler/translator/ShaderVars.cpp
+++ b/src/compiler/translator/ShaderVars.cpp
@@ -86,7 +86,6 @@
     // 2) the top variable is an array;
     // 3) otherwise.
     size_t pos = mappedFullName.find_first_of(".[");
-    std::string topName;
 
     if (pos == std::string::npos)
     {
diff --git a/src/compiler/translator/StructureHLSL.cpp b/src/compiler/translator/StructureHLSL.cpp
index 48929af..304949b 100644
--- a/src/compiler/translator/StructureHLSL.cpp
+++ b/src/compiler/translator/StructureHLSL.cpp
@@ -274,9 +274,9 @@
 
     for (unsigned int parameter = 0; parameter < ctorParameters.size(); parameter++)
     {
-        const TType &type = ctorParameters[parameter];
+        const TType &paramType = ctorParameters[parameter];
 
-        constructor += TypeString(type) + " x" + str(parameter) + ArrayString(type);
+        constructor += TypeString(paramType) + " x" + str(parameter) + ArrayString(paramType);
 
         if (parameter < ctorParameters.size() - 1)
         {
diff --git a/src/compiler/translator/TranslatorESSL.cpp b/src/compiler/translator/TranslatorESSL.cpp
index 3b50f7d..5f064f9 100644
--- a/src/compiler/translator/TranslatorESSL.cpp
+++ b/src/compiler/translator/TranslatorESSL.cpp
@@ -46,9 +46,9 @@
 
 void TranslatorESSL::writeExtensionBehavior() {
     TInfoSinkBase& sink = getInfoSink().obj;
-    const TExtensionBehavior& extensionBehavior = getExtensionBehavior();
-    for (TExtensionBehavior::const_iterator iter = extensionBehavior.begin();
-         iter != extensionBehavior.end(); ++iter) {
+    const TExtensionBehavior& extBehavior = getExtensionBehavior();
+    for (TExtensionBehavior::const_iterator iter = extBehavior.begin();
+         iter != extBehavior.end(); ++iter) {
         if (iter->second != EBhUndefined) {
             if (getResources().NV_shader_framebuffer_fetch && iter->first == "GL_EXT_shader_framebuffer_fetch") {
                 sink << "#extension GL_NV_shader_framebuffer_fetch : "
diff --git a/src/compiler/translator/TranslatorGLSL.cpp b/src/compiler/translator/TranslatorGLSL.cpp
index 1c243b7..83c0a69 100644
--- a/src/compiler/translator/TranslatorGLSL.cpp
+++ b/src/compiler/translator/TranslatorGLSL.cpp
@@ -64,9 +64,9 @@
 
 void TranslatorGLSL::writeExtensionBehavior() {
     TInfoSinkBase& sink = getInfoSink().obj;
-    const TExtensionBehavior& extensionBehavior = getExtensionBehavior();
-    for (TExtensionBehavior::const_iterator iter = extensionBehavior.begin();
-         iter != extensionBehavior.end(); ++iter) {
+    const TExtensionBehavior& extBehavior = getExtensionBehavior();
+    for (TExtensionBehavior::const_iterator iter = extBehavior.begin();
+         iter != extBehavior.end(); ++iter) {
         if (iter->second == EBhUndefined)
             continue;
 
diff --git a/src/compiler/translator/Types.cpp b/src/compiler/translator/Types.cpp
index d36936f..0fe6acc 100644
--- a/src/compiler/translator/Types.cpp
+++ b/src/compiler/translator/Types.cpp
@@ -178,11 +178,12 @@
 
     if (isArray())
     {
-        size_t arraySize = getArraySize();
-        if (arraySize > INT_MAX / totalSize)
+        // TODO: getArraySize() returns an int, not a size_t
+        size_t currentArraySize = getArraySize();
+        if (currentArraySize > INT_MAX / totalSize)
             totalSize = INT_MAX;
         else
-            totalSize *= arraySize;
+            totalSize *= currentArraySize;
     }
 
     return totalSize;
diff --git a/src/libANGLE/formatutils.cpp b/src/libANGLE/formatutils.cpp
index fa2725d..0ebc67a 100644
--- a/src/libANGLE/formatutils.cpp
+++ b/src/libANGLE/formatutils.cpp
@@ -560,18 +560,18 @@
     }
 }
 
-GLuint InternalFormat::computeRowPitch(GLenum type, GLsizei width, GLint alignment) const
+GLuint InternalFormat::computeRowPitch(GLenum formatType, GLsizei width, GLint alignment) const
 {
     ASSERT(alignment > 0 && isPow2(alignment));
-    return rx::roundUp(computeBlockSize(type, width, 1), static_cast<GLuint>(alignment));
+    return rx::roundUp(computeBlockSize(formatType, width, 1), static_cast<GLuint>(alignment));
 }
 
-GLuint InternalFormat::computeDepthPitch(GLenum type, GLsizei width, GLsizei height, GLint alignment) const
+GLuint InternalFormat::computeDepthPitch(GLenum formatType, GLsizei width, GLsizei height, GLint alignment) const
 {
-    return computeRowPitch(type, width, alignment) * height;
+    return computeRowPitch(formatType, width, alignment) * height;
 }
 
-GLuint InternalFormat::computeBlockSize(GLenum type, GLsizei width, GLsizei height) const
+GLuint InternalFormat::computeBlockSize(GLenum formatType, GLsizei width, GLsizei height) const
 {
     if (compressed)
     {
@@ -581,7 +581,7 @@
     }
     else
     {
-        const Type &typeInfo = GetTypeInfo(type);
+        const Type &typeInfo = GetTypeInfo(formatType);
         if (typeInfo.specialInterpretation)
         {
             return typeInfo.bytes * width * height;
diff --git a/src/libANGLE/formatutils.h b/src/libANGLE/formatutils.h
index 91fe043..be8921e 100644
--- a/src/libANGLE/formatutils.h
+++ b/src/libANGLE/formatutils.h
@@ -64,9 +64,9 @@
     SupportCheckFunction renderSupport;
     SupportCheckFunction filterSupport;
 
-    GLuint computeRowPitch(GLenum type, GLsizei width, GLint alignment) const;
-    GLuint computeDepthPitch(GLenum type, GLsizei width, GLsizei height, GLint alignment) const;
-    GLuint computeBlockSize(GLenum type, GLsizei width, GLsizei height) const;
+    GLuint computeRowPitch(GLenum formatType, GLsizei width, GLint alignment) const;
+    GLuint computeDepthPitch(GLenum formatType, GLsizei width, GLsizei height, GLint alignment) const;
+    GLuint computeBlockSize(GLenum formatType, GLsizei width, GLsizei height) const;
 };
 const InternalFormat &GetInternalFormatInfo(GLenum internalFormat);
 
diff --git a/src/libANGLE/renderer/d3d/ShaderD3D.cpp b/src/libANGLE/renderer/d3d/ShaderD3D.cpp
index 9c8181e..1134b3e7 100644
--- a/src/libANGLE/renderer/d3d/ShaderD3D.cpp
+++ b/src/libANGLE/renderer/d3d/ShaderD3D.cpp
@@ -229,9 +229,9 @@
             if (uniform.staticUse)
             {
                 unsigned int index = -1;
-                bool result = ShGetUniformRegister(compiler, uniform.name, &index);
-                UNUSED_ASSERTION_VARIABLE(result);
-                ASSERT(result);
+                bool getUniformRegisterResult = ShGetUniformRegister(compiler, uniform.name, &index);
+                UNUSED_ASSERTION_VARIABLE(getUniformRegisterResult);
+                ASSERT(getUniformRegisterResult);
 
                 mUniformRegisterMap[uniform.name] = index;
             }
@@ -246,9 +246,9 @@
             if (interfaceBlock.staticUse)
             {
                 unsigned int index = -1;
-                bool result = ShGetInterfaceBlockRegister(compiler, interfaceBlock.name, &index);
-                UNUSED_ASSERTION_VARIABLE(result);
-                ASSERT(result);
+                bool blockRegisterResult = ShGetInterfaceBlockRegister(compiler, interfaceBlock.name, &index);
+                UNUSED_ASSERTION_VARIABLE(blockRegisterResult);
+                ASSERT(blockRegisterResult);
 
                 mInterfaceBlockRegisterMap[interfaceBlock.name] = index;
             }
diff --git a/src/libANGLE/renderer/d3d/TextureD3D.cpp b/src/libANGLE/renderer/d3d/TextureD3D.cpp
index 7b7c822..a808344 100644
--- a/src/libANGLE/renderer/d3d/TextureD3D.cpp
+++ b/src/libANGLE/renderer/d3d/TextureD3D.cpp
@@ -166,8 +166,6 @@
 
     if (pixelData != NULL)
     {
-        gl::Error error(GL_NO_ERROR);
-
         if (shouldUseSetData(image))
         {
             error = mTexStorage->setData(index, image, NULL, type, unpack, pixelData);
@@ -210,7 +208,7 @@
             return mTexStorage->setData(index, image, &area, type, unpack, pixelData);
         }
 
-        gl::Error error = image->loadData(area, unpack.alignment, type, pixelData);
+        error = image->loadData(area, unpack.alignment, type, pixelData);
         if (error.isError())
         {
             return error;
@@ -245,7 +243,7 @@
         ASSERT(image);
 
         gl::Box fullImageArea(0, 0, 0, image->getWidth(), image->getHeight(), image->getDepth());
-        gl::Error error = image->loadCompressedData(fullImageArea, pixelData);
+        error = image->loadCompressedData(fullImageArea, pixelData);
         if (error.isError())
         {
             return error;
@@ -272,7 +270,7 @@
         ImageD3D *image = getImage(index);
         ASSERT(image);
 
-        gl::Error error = image->loadCompressedData(area, pixelData);
+        error = image->loadCompressedData(area, pixelData);
         if (error.isError())
         {
             return error;
@@ -752,7 +750,7 @@
 
         if (sourceArea.width != 0 && sourceArea.height != 0 && isValidLevel(level))
         {
-            gl::Error error = mRenderer->copyImage2D(source, sourceArea, internalFormat, destOffset, mTexStorage, level);
+            error = mRenderer->copyImage2D(source, sourceArea, internalFormat, destOffset, mTexStorage, level);
             if (error.isError())
             {
                 return error;
@@ -1682,11 +1680,11 @@
             size.height != storageHeight ||
             internalformat != storageFormat)   // Discard mismatched storage
         {
-            for (int level = 0; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+            for (int dirtyLevel = 0; dirtyLevel < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; dirtyLevel++)
             {
-                for (int faceIndex = 0; faceIndex < 6; faceIndex++)
+                for (int dirtyFace = 0; dirtyFace < 6; faceIndex++)
                 {
-                    mImageArray[faceIndex][level]->markDirty();
+                    mImageArray[dirtyFace][dirtyLevel]->markDirty();
                 }
             }
 
@@ -2811,11 +2809,11 @@
             size.depth != storageDepth ||
             internalformat != storageFormat)   // Discard mismatched storage
         {
-            for (int level = 0; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+            for (int dirtyLevel = 0; dirtyLevel < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; dirtyLevel++)
             {
-                for (int layer = 0; layer < mLayerCounts[level]; layer++)
+                for (int dirtyLayer = 0; dirtyLayer < mLayerCounts[dirtyLevel]; dirtyLayer++)
                 {
-                    mImageArray[level][layer]->markDirty();
+                    mImageArray[dirtyLevel][dirtyLayer]->markDirty();
                 }
             }
 
diff --git a/src/libANGLE/renderer/d3d/VertexDataManager.cpp b/src/libANGLE/renderer/d3d/VertexDataManager.cpp
index d0848ce..eade346 100644
--- a/src/libANGLE/renderer/d3d/VertexDataManager.cpp
+++ b/src/libANGLE/renderer/d3d/VertexDataManager.cpp
@@ -305,8 +305,8 @@
             int totalCount = ElementsInBuffer(attrib, storage->getSize());
             int startIndex = attrib.offset / ComputeVertexAttributeStride(attrib);
 
-            gl::Error error = staticBuffer->storeVertexAttributes(attrib, currentValue, -startIndex, totalCount,
-                                                                  0, &streamOffset);
+            error = staticBuffer->storeVertexAttributes(attrib, currentValue, -startIndex, totalCount,
+                                                        0, &streamOffset);
             if (error.isError())
             {
                 return error;
diff --git a/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp b/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp
index 4f86f56..2995765 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp
@@ -534,13 +534,13 @@
         blendDesc.AlphaToCoverageEnable = FALSE;
         blendDesc.IndependentBlendEnable = (rts.size() > 1) ? TRUE : FALSE;
 
-        for (unsigned int i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
+        for (unsigned int j = 0; j < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; j++)
         {
-            blendDesc.RenderTarget[i].BlendEnable = FALSE;
-            blendDesc.RenderTarget[i].RenderTargetWriteMask = gl_d3d11::ConvertColorMask(blendKey.maskChannels[i][0],
-                                                                                         blendKey.maskChannels[i][1],
-                                                                                         blendKey.maskChannels[i][2],
-                                                                                         blendKey.maskChannels[i][3]);
+            blendDesc.RenderTarget[j].BlendEnable = FALSE;
+            blendDesc.RenderTarget[j].RenderTargetWriteMask = gl_d3d11::ConvertColorMask(blendKey.maskChannels[j][0],
+                                                                                         blendKey.maskChannels[j][1],
+                                                                                         blendKey.maskChannels[j][2],
+                                                                                         blendKey.maskChannels[j][3]);
         }
 
         ID3D11Device *device = mRenderer->getDevice();
diff --git a/src/libANGLE/renderer/d3d/d3d11/Fence11.cpp b/src/libANGLE/renderer/d3d/d3d11/Fence11.cpp
index 8d4ed9a..8552bc2 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Fence11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/Fence11.cpp
@@ -179,7 +179,7 @@
     while (currentCounter.QuadPart < endCounter && !result)
     {
         ScheduleYield();
-        BOOL success = QueryPerformanceCounter(&currentCounter);
+        success = QueryPerformanceCounter(&currentCounter);
         UNUSED_ASSERTION_VARIABLE(success);
         ASSERT(success);
 
diff --git a/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp b/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp
index 9417095..fb65c85 100644
--- a/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp
@@ -216,7 +216,6 @@
     {
         gl::VertexFormat shaderInputLayout[gl::MAX_VERTEX_ATTRIBS];
         GetInputLayout(attributes, shaderInputLayout);
-        ProgramD3D *programD3D = ProgramD3D::makeProgramD3D(program->getImplementation());
 
         ShaderExecutableD3D *shader = NULL;
         gl::Error error = programD3D->getVertexExecutableForInputLayout(shaderInputLayout, &shader, nullptr);
diff --git a/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp b/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
index 58d756f..2ce19d9 100644
--- a/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
@@ -379,8 +379,6 @@
     }
     else
     {
-        const d3d11::DXGIFormat &dxgiFormatInfo = d3d11::GetDXGIFormatInfo(mTextureFormat);
-
         D3D11_BOX srcBox;
         srcBox.left = copyArea.x;
         srcBox.top = copyArea.y;
@@ -788,7 +786,6 @@
             return error;
         }
 
-        TextureStorage11 *dest11 = TextureStorage11::makeTextureStorage11(destStorage);
         ID3D11Resource *destResource = NULL;
         error = dest11->getResource(&destResource);
         if (error.isError())
diff --git a/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp b/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp
index f1986a2..d4331b6 100644
--- a/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp
@@ -124,7 +124,7 @@
         if (buffer)
         {
             BufferD3D *storage = BufferD3D::makeFromBuffer(buffer);
-            gl::Error error = storage->getData(&input);
+            error = storage->getData(&input);
             if (error.isError())
             {
                 return error;
diff --git a/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp b/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp
index a4cbb2b..cf17791 100644
--- a/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp
@@ -237,8 +237,8 @@
     UINT formatSupport;
     if (SUCCEEDED(device->CheckFormatSupport(formatInfo.texFormat, &formatSupport)))
     {
-        const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalFormat);
-        if (formatInfo.depthBits > 0 || formatInfo.stencilBits > 0)
+        const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(internalFormat);
+        if (internalFormatInfo.depthBits > 0 || internalFormatInfo.stencilBits > 0)
         {
             textureCaps.texturable = ((formatSupport & D3D11_FORMAT_SUPPORT_TEXTURE2D) != 0);
         }
diff --git a/src/libANGLE/renderer/d3d/d3d9/Image9.cpp b/src/libANGLE/renderer/d3d/d3d9/Image9.cpp
index f2a034f..5c0e2a2 100644
--- a/src/libANGLE/renderer/d3d/d3d9/Image9.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/Image9.cpp
@@ -395,7 +395,7 @@
     if (index.type == GL_TEXTURE_2D)
     {
         TextureStorage9_2D *storage9 = TextureStorage9_2D::makeTextureStorage9_2D(storage);
-        gl::Error error = storage9->getSurfaceLevel(index.mipIndex, true, &destSurface);
+        error = storage9->getSurfaceLevel(index.mipIndex, true, &destSurface);
         if (error.isError())
         {
             return error;
@@ -405,7 +405,7 @@
     {
         ASSERT(gl::IsCubeMapTextureTarget(index.type));
         TextureStorage9_Cube *storage9 = TextureStorage9_Cube::makeTextureStorage9_Cube(storage);
-        gl::Error error = storage9->getCubeMapSurface(index.type, index.mipIndex, true, &destSurface);
+        error = storage9->getCubeMapSurface(index.type, index.mipIndex, true, &destSurface);
         if (error.isError())
         {
             return error;
diff --git a/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp b/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp
index c224035..90db4a2 100644
--- a/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp
@@ -99,7 +99,7 @@
         {
             BufferD3D *storage = BufferD3D::makeFromBuffer(buffer);
             ASSERT(storage);
-            gl::Error error = storage->getData(&input);
+            error = storage->getData(&input);
             if (error.isError())
             {
                 return error;