summaryrefslogtreecommitdiff
path: root/src/vm
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2019-05-14 19:07:53 -0700
committerGitHub <noreply@github.com>2019-05-14 19:07:53 -0700
commit718598334310f6ad331ba2893ee4557beffaa74c (patch)
tree7bc4830b29442e79be150b67dc0f67473e5ba681 /src/vm
parent6a85ca560a7dfa109c6f17c0b76d93373dbd5a00 (diff)
downloadcoreclr-718598334310f6ad331ba2893ee4557beffaa74c.tar.gz
coreclr-718598334310f6ad331ba2893ee4557beffaa74c.tar.bz2
coreclr-718598334310f6ad331ba2893ee4557beffaa74c.zip
Fix issues reported by PREfast static analysis tool (#24577)
Diffstat (limited to 'src/vm')
-rw-r--r--src/vm/classcompat.cpp2
-rw-r--r--src/vm/method.hpp11
-rw-r--r--src/vm/methodtablebuilder.cpp2
3 files changed, 6 insertions, 9 deletions
diff --git a/src/vm/classcompat.cpp b/src/vm/classcompat.cpp
index 473e328200..b677045f0b 100644
--- a/src/vm/classcompat.cpp
+++ b/src/vm/classcompat.cpp
@@ -3290,7 +3290,7 @@ HRESULT MethodTableBuilder::FindMethodDeclarationForMethodImpl(
if (TypeFromToken(typeref) == mdtMethodDef)
{
mdTypeDef typeDef;
- hr = pMDInternalImport->GetParentToken(typeref, &typeDef);
+ IfFailRet(pMDInternalImport->GetParentToken(typeref, &typeDef));
// Make sure it is a typedef
if (TypeFromToken(typeDef) != mdtTypeDef)
diff --git a/src/vm/method.hpp b/src/vm/method.hpp
index 68626c7bc4..cf532f8102 100644
--- a/src/vm/method.hpp
+++ b/src/vm/method.hpp
@@ -210,16 +210,13 @@ class MethodDesc
public:
- enum
- {
#ifdef _WIN64
- ALIGNMENT_SHIFT = 3,
+ static const int ALIGNMENT_SHIFT = 3;
#else
- ALIGNMENT_SHIFT = 2,
+ static const int ALIGNMENT_SHIFT = 2;
#endif
- ALIGNMENT = (1<<ALIGNMENT_SHIFT),
- ALIGNMENT_MASK = (ALIGNMENT-1)
- };
+ static const size_t ALIGNMENT = (1 << ALIGNMENT_SHIFT);
+ static const size_t ALIGNMENT_MASK = (ALIGNMENT - 1);
#ifdef _DEBUG
diff --git a/src/vm/methodtablebuilder.cpp b/src/vm/methodtablebuilder.cpp
index 609eda0b3f..e8a7e9339f 100644
--- a/src/vm/methodtablebuilder.cpp
+++ b/src/vm/methodtablebuilder.cpp
@@ -2434,7 +2434,7 @@ HRESULT MethodTableBuilder::FindMethodDeclarationForMethodImpl(
if (TypeFromToken(typeref) == mdtMethodDef)
{ // If parent is a method def then this is a varags method
mdTypeDef typeDef;
- hr = pMDInternalImport->GetParentToken(typeref, &typeDef);
+ IfFailRet(pMDInternalImport->GetParentToken(typeref, &typeDef));
if (TypeFromToken(typeDef) != mdtTypeDef)
{ // A mdtMethodDef must be parented by a mdtTypeDef