From a633f16ac1bff0f1db1ae38e2913e7e4097a4838 Mon Sep 17 00:00:00 2001 From: Ilya Date: Fri, 24 Mar 2017 18:48:02 +0300 Subject: [PATCH] Copy-paste errors found by PVS-Studio. (dotnet/coreclr#10450) I used PVS-Studio static analyzer to check this project. I would like to suggest a variant of the way to fix the copy-paste errors, detected with the help of V778 diagnostic. Description of the diagnostic: https://www.viva64.com/en/w/V778/ Commit migrated from https://github.com/dotnet/coreclr/commit/3c61ffd676603bb14d4e815e1e249f816d4cbc74 --- src/coreclr/src/ildasm/dasm.cpp | 2 +- src/coreclr/src/jit/lclvars.cpp | 2 +- src/coreclr/src/vm/peimage.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/coreclr/src/ildasm/dasm.cpp b/src/coreclr/src/ildasm/dasm.cpp index 0cb5cc8..68cfa2a 100644 --- a/src/coreclr/src/ildasm/dasm.cpp +++ b/src/coreclr/src/ildasm/dasm.cpp @@ -483,7 +483,7 @@ void Uninit() { SDELETE(g_szBuf_UnquotedProperName); } - if (g_szBuf_UnquotedProperName != NULL) + if (g_szBuf_ProperName != NULL) { SDELETE(g_szBuf_ProperName); } diff --git a/src/coreclr/src/jit/lclvars.cpp b/src/coreclr/src/jit/lclvars.cpp index 319a64d..f0b9128 100644 --- a/src/coreclr/src/jit/lclvars.cpp +++ b/src/coreclr/src/jit/lclvars.cpp @@ -2760,7 +2760,7 @@ int __cdecl Compiler::RefCntCmp(const void* op1, const void* op2) } if (varTypeIsGC(dsc2->TypeGet())) { - weight1 += BB_UNITY_WEIGHT / 2; + weight2 += BB_UNITY_WEIGHT / 2; } if (dsc2->lvRegister) diff --git a/src/coreclr/src/vm/peimage.cpp b/src/coreclr/src/vm/peimage.cpp index 508f368..39b71ff 100644 --- a/src/coreclr/src/vm/peimage.cpp +++ b/src/coreclr/src/vm/peimage.cpp @@ -808,7 +808,7 @@ void PEImage::EnumMemoryRegions(CLRDataEnumMemoryFlags flags) m_pLayouts[IMAGE_MAPPED]->EnumMemoryRegions(flags); if (m_pLayouts[IMAGE_LOADED].IsValid() && m_pLayouts[IMAGE_LOADED]!=NULL) m_pLayouts[IMAGE_LOADED]->EnumMemoryRegions(flags); - if (m_pLayouts[IMAGE_LOADED_FOR_INTROSPECTION].IsValid() && m_pLayouts[IMAGE_LOADED]!=NULL) + if (m_pLayouts[IMAGE_LOADED_FOR_INTROSPECTION].IsValid() && m_pLayouts[IMAGE_LOADED_FOR_INTROSPECTION]!=NULL) m_pLayouts[IMAGE_LOADED_FOR_INTROSPECTION]->EnumMemoryRegions(flags); } -- 2.7.4