diff --git a/cppwinrt/cmd_reader.h b/cppwinrt/cmd_reader.h index c86cfdcc6..376180eb4 100644 --- a/cppwinrt/cmd_reader.h +++ b/cppwinrt/cmd_reader.h @@ -195,11 +195,10 @@ namespace cppwinrt inline std::string get_module_path() { std::string path(100, '?'); - DWORD actual_size{}; while (true) { - actual_size = GetModuleFileNameA(nullptr, path.data(), 1 + static_cast(path.size())); + DWORD actual_size = GetModuleFileNameA(nullptr, path.data(), 1 + static_cast(path.size())); if (actual_size < 1 + path.size()) { @@ -603,7 +602,7 @@ namespace cppwinrt first_arg = true; *argument_count = 0; - for (;;) + while (true) { if (*p) { @@ -621,7 +620,7 @@ namespace cppwinrt if (*p == '\0') break; - for (;;) + while (true) { copy_character = true; diff --git a/cppwinrt/code_writers.h b/cppwinrt/code_writers.h index 748996b1a..c9f99c9ea 100644 --- a/cppwinrt/code_writers.h +++ b/cppwinrt/code_writers.h @@ -417,7 +417,7 @@ namespace cppwinrt static void write_generic_names(writer& w, std::pair const& params) { - bool first{ true }; + bool first = true; for (auto&& param : params) { @@ -2011,7 +2011,7 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable w.write_each(info.type.MethodList(), name); } - }; + } } static void write_class_override_implements(writer& w, get_interfaces_t const& interfaces) @@ -2035,21 +2035,18 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable static void write_class_override_requires(writer& w, get_interfaces_t const& interfaces) { - bool found{}; - for (auto&& [name, info] : interfaces) { if (!info.overridable) { w.write(", %", name); - found = true; } } } static void write_class_override_defaults(writer& w, get_interfaces_t const& interfaces) { - bool first{ true }; + bool first = true; for (auto&& [name, info] : interfaces) { @@ -2769,7 +2766,7 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable static void write_class_requires(writer& w, TypeDef const& type) { - bool first{ true }; + bool first = true; for (auto&& [interface_name, info] : get_interfaces(w, type)) { @@ -2793,7 +2790,7 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable static void write_fast_class_requires(writer& w, TypeDef const& type) { - bool first{ true }; + bool first = true; for (auto&& [interface_name, info] : get_interfaces(w, type)) { @@ -2817,7 +2814,7 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable static void write_class_base(writer& w, TypeDef const& type) { - bool first{ true }; + bool first = true; for (auto&& base : get_bases(type)) { diff --git a/cppwinrt/component_writers.h b/cppwinrt/component_writers.h index acd2b871c..fcfeddac0 100644 --- a/cppwinrt/component_writers.h +++ b/cppwinrt/component_writers.h @@ -27,7 +27,7 @@ namespace cppwinrt } } - bool first{ true }; + bool first = true; for (auto&& name : interfaces) { @@ -45,7 +45,7 @@ namespace cppwinrt static void write_component_class_base(writer& w, TypeDef const& type) { - bool first{ true }; + bool first = true; for (auto&& base : get_bases(type)) { @@ -289,7 +289,7 @@ catch (...) { return winrt::to_hresult(); } bind(signature)); } - void write_component_static_forwarder(writer& w, MethodDef const& method) + static void write_component_static_forwarder(writer& w, MethodDef const& method) { auto format = R"( auto %(%) { @@ -643,8 +643,8 @@ catch (...) { return winrt::to_hresult(); } { if (!info.base && info.is_default) { - auto methods = info.type.MethodList(); - offset += methods.second - methods.first; + auto [first, second] = info.type.MethodList(); + offset += second - first; break; } } diff --git a/cppwinrt/helpers.h b/cppwinrt/helpers.h index b2d783d61..a3b865b6e 100644 --- a/cppwinrt/helpers.h +++ b/cppwinrt/helpers.h @@ -127,7 +127,7 @@ namespace cppwinrt struct separator { writer& w; - bool first{ true }; + bool first = true; void operator()() { diff --git a/cppwinrt/text_writer.h b/cppwinrt/text_writer.h index bde87806e..50e6e6b15 100644 --- a/cppwinrt/text_writer.h +++ b/cppwinrt/text_writer.h @@ -461,7 +461,7 @@ namespace cppwinrt { return [&](auto& writer) { - bool first{ true }; + bool first = true; for (auto&& item : list) { @@ -484,7 +484,7 @@ namespace cppwinrt { return [&](auto& writer) { - bool first{ true }; + bool first = true; for (auto&& item : list) { diff --git a/natvis/cppwinrt_visualizer.cpp b/natvis/cppwinrt_visualizer.cpp index b44be1268..f6affd566 100644 --- a/natvis/cppwinrt_visualizer.cpp +++ b/natvis/cppwinrt_visualizer.cpp @@ -93,7 +93,7 @@ void LoadMetadata(DkmProcess* process, WCHAR const* processPath, std::string_vie { auto winmd_path = path{ processPath }; auto probe_file = std::string{ typeName }; - do + while (true) { winmd_path.replace_filename(probe_file + ".winmd"); MetadataDiagnostic(process, L"Looking for ", winmd_path); @@ -115,7 +115,7 @@ void LoadMetadata(DkmProcess* process, WCHAR const* processPath, std::string_vie break; } probe_file = probe_file.substr(0, pos); - } while (true); + } } TypeDef FindType(DkmProcess* process, std::string_view const& typeName) diff --git a/natvis/object_visualizer.cpp b/natvis/object_visualizer.cpp index 8bcb86877..5308c33fc 100644 --- a/natvis/object_visualizer.cpp +++ b/natvis/object_visualizer.cpp @@ -573,7 +573,7 @@ HRESULT object_visualizer::CreateEvaluationResult(_Deref_out_ DkmEvaluationResul auto address = pPointerValueHome->Address(); com_ptr pValue; - DkmEvaluationResultFlags_t evalResultFlags = DkmEvaluationResultFlags::ReadOnly | DkmEvaluationResultFlags::Expandable;; + DkmEvaluationResultFlags_t evalResultFlags = DkmEvaluationResultFlags::ReadOnly | DkmEvaluationResultFlags::Expandable; if (requires_refresh(address, m_pVisualizedExpression->InspectionContext()->EvaluationFlags())) { IF_FAIL_RET(DkmString::Create(L"", pValue.put())); diff --git a/prebuild/main.cpp b/prebuild/main.cpp index d446c02d4..52a750776 100644 --- a/prebuild/main.cpp +++ b/prebuild/main.cpp @@ -49,7 +49,7 @@ namespace cppwinrt::strings { std::string_view remainder = view; - while (remainder.size()) + while (!remainder.empty()) { auto const size = std::min(size_t{ 16'000 }, remainder.size()); auto const chunk = remainder.substr(0, size); diff --git a/strings/base_collections_input_vector.h b/strings/base_collections_input_vector.h index 2482db968..b5b76de38 100644 --- a/strings/base_collections_input_vector.h +++ b/strings/base_collections_input_vector.h @@ -88,7 +88,7 @@ WINRT_EXPORT namespace winrt::param private: interface_type m_interface; - bool m_owned{ true }; + bool m_owned = true; }; template diff --git a/strings/base_coroutine_foundation.h b/strings/base_coroutine_foundation.h index 3c309256c..71dbb0043 100644 --- a/strings/base_coroutine_foundation.h +++ b/strings/base_coroutine_foundation.h @@ -149,7 +149,7 @@ namespace winrt::impl Async const& async; Windows::Foundation::AsyncStatus status = Windows::Foundation::AsyncStatus::Started; int32_t failure = 0; - std::atomic suspending{ true }; + std::atomic suspending = true; void enable_cancellation(cancellable_promise* promise) { diff --git a/strings/base_implements.h b/strings/base_implements.h index 53826d6b6..8016bef28 100644 --- a/strings/base_implements.h +++ b/strings/base_implements.h @@ -1198,7 +1198,7 @@ namespace winrt::impl uintptr_t const encoding = encode_weak_ref(weak_ref.get()); - for (;;) + while (true) { if (m_references.compare_exchange_weak(count_or_pointer, encoding, std::memory_order_acq_rel, std::memory_order_relaxed)) { diff --git a/test/old_tests/UnitTests/handle.cpp b/test/old_tests/UnitTests/handle.cpp index 1b06aac87..f2e69a54d 100644 --- a/test/old_tests/UnitTests/handle.cpp +++ b/test/old_tests/UnitTests/handle.cpp @@ -76,7 +76,7 @@ static void test_put(HANDLE * value) REQUIRE(value != nullptr); REQUIRE(*value == nullptr); - *value = CreateEvent(nullptr, true, true, nullptr);; + *value = CreateEvent(nullptr, true, true, nullptr); } TEST_CASE("handle, put")