From b11d9210743c2e34538c3e4a053eaccae7b8f75c Mon Sep 17 00:00:00 2001 From: Pentalimbed Date: Sun, 6 Oct 2024 17:44:44 +0100 Subject: [PATCH] refactor: remove unnecessary `#pragma warning` --- src/Features/LightLimitFIx/ParticleLights.cpp | 10 ++-------- src/Features/LightLimitFix.cpp | 5 +---- src/ShaderCache.cpp | 10 ++-------- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/src/Features/LightLimitFIx/ParticleLights.cpp b/src/Features/LightLimitFIx/ParticleLights.cpp index c95f9cb79..fdd810acb 100644 --- a/src/Features/LightLimitFIx/ParticleLights.cpp +++ b/src/Features/LightLimitFIx/ParticleLights.cpp @@ -47,10 +47,7 @@ void ParticleLights::GetConfigs() } filename.erase(filename.length() - 4); // Remove ".ini" -#pragma warning(push) -#pragma warning(disable: 4244) - std::transform(filename.begin(), filename.end(), filename.begin(), ::tolower); -#pragma warning(pop) + std::transform(filename.begin(), filename.end(), filename.begin(), [](auto c) { return (char)::tolower(c); }); logger::debug("[LLF] Inserting {}", filename); @@ -126,10 +123,7 @@ void ParticleLights::GetConfigs() } filename.erase(filename.length() - 4); // Remove ".ini" -#pragma warning(push) -#pragma warning(disable: 4244) - std::transform(filename.begin(), filename.end(), filename.begin(), ::tolower); -#pragma warning(pop) + std::transform(filename.begin(), filename.end(), filename.begin(), [](auto c) { return (char)::tolower(c); }); logger::debug("[LLF] Inserting {}", filename); diff --git a/src/Features/LightLimitFix.cpp b/src/Features/LightLimitFix.cpp index 05d9d2bdf..bab9d1447 100644 --- a/src/Features/LightLimitFix.cpp +++ b/src/Features/LightLimitFix.cpp @@ -452,11 +452,8 @@ std::string ExtractTextureStem(std::string_view a_path) a_path = a_path.substr(lastSeparatorPos + 1); a_path.remove_suffix(4); // Remove ".dds" -#pragma warning(push) -#pragma warning(disable: 4244) - auto textureNameView = a_path | std::views::transform(::tolower); + auto textureNameView = a_path | std::views::transform([](auto c) { return (char)::tolower(c); }); std::string textureName = { textureNameView.begin(), textureNameView.end() }; -#pragma warning(pop) return textureName; } diff --git a/src/ShaderCache.cpp b/src/ShaderCache.cpp index 781fb2045..f7a903fed 100644 --- a/src/ShaderCache.cpp +++ b/src/ShaderCache.cpp @@ -1475,10 +1475,7 @@ namespace SIE descriptor); } else { std::array bufferSizes = { 0, 0, 0 }; -#pragma warning(push) -#pragma warning(disable: 4244) - std::fill(newShader->constantTable.begin(), newShader->constantTable.end(), 0); -#pragma warning(pop) + std::ranges::fill(newShader->constantTable, (int8_t)0); ReflectConstantBuffers(*reflector.Get(), bufferSizes, newShader->constantTable, newShader->shaderDesc, ShaderClass::Vertex, descriptor, shader); if (bufferSizes[0] != 0) { @@ -1530,10 +1527,7 @@ namespace SIE descriptor); } else { std::array bufferSizes = { 0, 0, 0 }; -#pragma warning(push) -#pragma warning(disable: 4244) - std::fill(newShader->constantTable.begin(), newShader->constantTable.end(), 0); -#pragma warning(pop) + std::ranges::fill(newShader->constantTable, (int8_t)0); uint64_t dummy; ReflectConstantBuffers(*reflector.Get(), bufferSizes, newShader->constantTable, dummy,