From f7a4566dd3c6f72b909c8ead9ce764c5e83ce748 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Sun, 17 Oct 2021 11:57:49 -0700 Subject: [PATCH 1/3] std::ignore usage instead of (void) for ignoring return values --- DirectXMesh/DirectXMeshP.h | 1 + DirectXMesh/scoped.h | 3 ++- Meshconvert/Meshconvert.cpp | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DirectXMesh/DirectXMeshP.h b/DirectXMesh/DirectXMeshP.h index 24b96d7..086298c 100644 --- a/DirectXMesh/DirectXMeshP.h +++ b/DirectXMesh/DirectXMeshP.h @@ -119,6 +119,7 @@ #include #include #include +#include #include #include diff --git a/DirectXMesh/scoped.h b/DirectXMesh/scoped.h index 20dd23d..d8f768c 100644 --- a/DirectXMesh/scoped.h +++ b/DirectXMesh/scoped.h @@ -13,6 +13,7 @@ #include #include #include +#include #ifndef WIN32 #include @@ -98,7 +99,7 @@ public: { FILE_DISPOSITION_INFO info = {}; info.DeleteFile = TRUE; - (void)SetFileInformationByHandle(m_handle, FileDispositionInfo, &info, sizeof(info)); + std::ignore = SetFileInformationByHandle(m_handle, FileDispositionInfo, &info, sizeof(info)); } } diff --git a/Meshconvert/Meshconvert.cpp b/Meshconvert/Meshconvert.cpp index 08f8a55..b0533b8 100644 --- a/Meshconvert/Meshconvert.cpp +++ b/Meshconvert/Meshconvert.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include "Mesh.h" @@ -994,7 +995,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[]) if (dwOptions & (1 << OPT_TOLOWER)) { - (void)_wcslwr_s(outputPath); + std::ignore = _wcslwr_s(outputPath); } if (~dwOptions & (1 << OPT_OVERWRITE)) From 9908822dd96fe226ddc47a2d76b2f667af13848c Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Tue, 19 Oct 2021 14:58:57 -0700 Subject: [PATCH 2/3] Minor code review --- Utilities/WaveFrontReader.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/WaveFrontReader.h b/Utilities/WaveFrontReader.h index 4cb7787..845d684 100644 --- a/Utilities/WaveFrontReader.h +++ b/Utilities/WaveFrontReader.h @@ -66,7 +66,7 @@ public: { Clear(); - static const size_t MAX_POLY = 64; + constexpr size_t MAX_POLY = 64; using namespace DirectX; From 66451d179b8c14506fa05fde33548967c79b82f1 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Thu, 28 Oct 2021 11:03:26 -0700 Subject: [PATCH 3/3] Fixed locale issue with file parsing --- Meshconvert/Meshconvert.cpp | 2 ++ Utilities/WaveFrontReader.h | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/Meshconvert/Meshconvert.cpp b/Meshconvert/Meshconvert.cpp index b0533b8..23edf9c 100644 --- a/Meshconvert/Meshconvert.cpp +++ b/Meshconvert/Meshconvert.cpp @@ -681,6 +681,8 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[]) return 1; } + inFile.imbue(std::locale::classic()); + ProcessFileList(inFile, conversion); } break; diff --git a/Utilities/WaveFrontReader.h b/Utilities/WaveFrontReader.h index 845d684..64290df 100644 --- a/Utilities/WaveFrontReader.h +++ b/Utilities/WaveFrontReader.h @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -74,6 +75,8 @@ public: if (!InFile) return /* HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) */ static_cast(0x80070002L); + InFile.imbue(std::locale::classic()); + #ifdef WIN32 wchar_t fname[_MAX_FNAME] = {}; _wsplitpath_s(szFileName, nullptr, 0, nullptr, 0, fname, _MAX_FNAME, nullptr, 0); @@ -417,6 +420,8 @@ public: if (!InFile) return /* HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) */ static_cast(0x80070002L); + InFile.imbue(std::locale::classic()); + auto curMaterial = materials.end(); for (;; )