Index: /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp
===================================================================
--- /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp	(revision 84258)
+++ /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp	(revision 84259)
@@ -2679,24 +2679,26 @@
                 LogFunc(("Remove all dependencies for surface sid=%u\n", sid));
 
-                uint32_t            surfaceFlags = pSurface->surfaceFlags;
-                SVGA3dSurfaceFormat format = pSurface->format;
-                SVGA3dSurfaceFace   face[SVGA3D_MAX_SURFACE_FACES];
-                uint32_t            multisampleCount = pSurface->multiSampleCount;
-                SVGA3dTextureFilter autogenFilter = pSurface->autogenFilter;
-                SVGA3dSize         *pMipLevelSize;
-                uint32_t            cFaces = pSurface->cFaces;
-
-                pMipLevelSize = (SVGA3dSize *)RTMemAllocZ(pSurface->faces[0].numMipLevels * pSurface->cFaces * sizeof(SVGA3dSize));
+                uint32_t const              surfaceFlags     = pSurface->surfaceFlags;
+                SVGA3dSurfaceFormat const   format           = pSurface->format;
+                uint32_t const              multisampleCount = pSurface->multiSampleCount;
+                SVGA3dTextureFilter const   autogenFilter    = pSurface->autogenFilter;
+                uint32_t const              cFaces           = pSurface->cFaces;
+                uint32_t const              cMipLevels       = pSurface->faces[0].numMipLevels;
+
+                SVGA3dSize *pMipLevelSize = (SVGA3dSize *)RTMemAllocZ(cMipLevels * cFaces * sizeof(SVGA3dSize));
                 AssertReturn(pMipLevelSize, VERR_NO_MEMORY);
 
-                for (uint32_t face=0; face < pSurface->cFaces; face++)
+                for (uint32_t face = 0; face < pSurface->cFaces; face++)
                 {
-                    for (uint32_t i = 0; i < pSurface->faces[0].numMipLevels; i++)
+                    for (uint32_t i = 0; i < cMipLevels; i++)
                     {
-                        uint32_t idx = i + face * pSurface->faces[0].numMipLevels;
+                        uint32_t idx = i + face * cMipLevels;
                         memcpy(&pMipLevelSize[idx], &pSurface->paMipmapLevels[idx].mipmapSize, sizeof(SVGA3dSize));
                     }
                 }
-                memcpy(face, pSurface->faces, sizeof(pSurface->faces));
+
+                SVGA3dSurfaceFace aFaces[SVGA3D_MAX_SURFACE_FACES];
+                AssertCompile(sizeof(aFaces) == sizeof(pSurface->faces));
+                memcpy(aFaces, pSurface->faces, sizeof(pSurface->faces));
 
                 /* Recreate the surface with the original settings; destroys the contents, but that seems fairly safe since the context is also destroyed. */
@@ -2709,6 +2711,6 @@
                 AssertRC(rc);
 
-                rc = vmsvga3dSurfaceDefine(pThisCC, sid, surfaceFlags, format, face, multisampleCount, autogenFilter,
-                                           face[0].numMipLevels * cFaces, pMipLevelSize);
+                rc = vmsvga3dSurfaceDefine(pThisCC, sid, surfaceFlags, format, aFaces, multisampleCount, autogenFilter,
+                                           cMipLevels * cFaces, pMipLevelSize);
                 AssertRC(rc);
 
@@ -3985,6 +3987,6 @@
             {
                 LogFunc(("Creating stencil surface as texture!\n"));
-                int rc = vmsvga3dBackCreateTexture(pState, pContext, cid, pRenderTarget);
-                AssertRC(rc);   /* non-fatal, will use CreateDepthStencilSurface */
+                int rc2 = vmsvga3dBackCreateTexture(pState, pContext, cid, pRenderTarget);
+                AssertRC(rc2);   /* non-fatal, will use CreateDepthStencilSurface */
             }
 
@@ -4099,5 +4101,5 @@
             {
                 LogFunc(("Create texture to be used as render target; sid=%u type=%d format=%d -> create texture\n", target.sid, pRenderTarget->surfaceFlags, pRenderTarget->format));
-                int rc = vmsvga3dBackCreateTexture(pState, pContext, cid, pRenderTarget);
+                rc = vmsvga3dBackCreateTexture(pState, pContext, cid, pRenderTarget);
                 AssertRCReturn(rc, rc);
             }
@@ -5189,11 +5191,11 @@
     {
         /* Create and set the vertex declaration. */
-        IDirect3DVertexDeclaration9 *pVertexDecl;
-        hr = pContext->pDevice->CreateVertexDeclaration(&aVertexElements[0], &pVertexDecl);
+        IDirect3DVertexDeclaration9 *pVertexDecl0;
+        hr = pContext->pDevice->CreateVertexDeclaration(&aVertexElements[0], &pVertexDecl0);
         AssertMsgReturn(hr == D3D_OK, ("CreateVertexDeclaration failed with %x\n", hr), VERR_INTERNAL_ERROR);
 
-        hr = pContext->pDevice->SetVertexDeclaration(pVertexDecl);
+        hr = pContext->pDevice->SetVertexDeclaration(pVertexDecl0);
         AssertMsgReturnStmt(hr == D3D_OK, ("SetVertexDeclaration failed with %x\n", hr),
-                            D3D_RELEASE(pVertexDecl),
+                            D3D_RELEASE(pVertexDecl0),
                             VERR_INTERNAL_ERROR);
 
@@ -5202,5 +5204,5 @@
 
         /* Remember the new vertext declaration. */
-        pContext->d3dState.pVertexDecl = pVertexDecl;
+        pContext->d3dState.pVertexDecl = pVertexDecl0;
         pContext->d3dState.cVertexElements = numVertexDecls + 1;
         memcpy(pContext->d3dState.aVertexElements,
