From f455050d8f4668060c63d063ff26be7329272ce0 Mon Sep 17 00:00:00 2001 From: Ryan Shepherd Date: Wed, 11 Dec 2024 20:53:36 -0800 Subject: [PATCH] Fix warnings in natvis project --- natvis/cppwinrt_visualizer.cpp | 14 +++++++------- natvis/object_visualizer.cpp | 2 +- natvis/pch.h | 3 +++ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/natvis/cppwinrt_visualizer.cpp b/natvis/cppwinrt_visualizer.cpp index f6affd566..7aa845e53 100644 --- a/natvis/cppwinrt_visualizer.cpp +++ b/natvis/cppwinrt_visualizer.cpp @@ -12,7 +12,7 @@ using namespace winrt; using namespace winmd::reader; std::vector db_files; -std::unique_ptr db; +std::unique_ptr db_cache; void MetadataDiagnostic(DkmProcess* process, std::wstring const& status, std::filesystem::path const& path) { @@ -105,7 +105,7 @@ void LoadMetadata(DkmProcess* process, WCHAR const* processPath, std::string_vie if (std::find(db_files.begin(), db_files.end(), path_string) == db_files.end()) { - db->add_database(path_string, [](TypeDef const& type) { return type.Flags().WindowsRuntime(); }); + db_cache->add_database(path_string, [](TypeDef const& type) { return type.Flags().WindowsRuntime(); }); db_files.push_back(path_string); } } @@ -120,12 +120,12 @@ void LoadMetadata(DkmProcess* process, WCHAR const* processPath, std::string_vie TypeDef FindType(DkmProcess* process, std::string_view const& typeName) { - auto type = db->find(typeName); + auto type = db_cache->find(typeName); if (!type) { auto processPath = process->Path()->Value(); LoadMetadata(process, processPath, typeName); - type = db->find(typeName); + type = db_cache->find(typeName); if (!type) { NatvisDiagnostic(process, @@ -137,7 +137,7 @@ TypeDef FindType(DkmProcess* process, std::string_view const& typeName) TypeDef FindType(DkmProcess* process, std::string_view const& typeNamespace, std::string_view const& typeName) { - auto type = db->find(typeNamespace, typeName); + auto type = db_cache->find(typeNamespace, typeName); if (!type) { std::string fullName(typeNamespace); @@ -165,7 +165,7 @@ cppwinrt_visualizer::cppwinrt_visualizer() db_files.push_back(file.path().string()); } } - db.reset(new cache(db_files, [](TypeDef const& type) { return type.Flags().WindowsRuntime(); })); + db_cache.reset(new cache(db_files, [](TypeDef const& type) { return type.Flags().WindowsRuntime(); })); } catch (...) { @@ -188,7 +188,7 @@ cppwinrt_visualizer::~cppwinrt_visualizer() { ClearTypeResolver(); db_files.clear(); - db.reset(); + db_cache.reset(); } HRESULT cppwinrt_visualizer::EvaluateVisualizedExpression( diff --git a/natvis/object_visualizer.cpp b/natvis/object_visualizer.cpp index 5308c33fc..a0803871a 100644 --- a/natvis/object_visualizer.cpp +++ b/natvis/object_visualizer.cpp @@ -671,7 +671,7 @@ HRESULT object_visualizer::GetItems( auto pParent = pVisualizedExpression; auto childCount = std::min(m_propertyData.size() - StartIndex, (size_t)Count); - for(auto i = 0; i < childCount; ++i) + for(size_t i = 0; i < childCount; ++i) { auto& prop = m_propertyData[i + (size_t)StartIndex]; com_ptr pPropertyVisualized; diff --git a/natvis/pch.h b/natvis/pch.h index c687b1f09..824d3aac1 100644 --- a/natvis/pch.h +++ b/natvis/pch.h @@ -4,7 +4,10 @@ #define NOMINMAX #include +#pragma warning(push) +#pragma warning(disable : 4471) #include +#pragma warning(pop) #include #include #include "base_includes.h"