From 15de86ed76791c09a4142a0329b7abecfd212ec1 Mon Sep 17 00:00:00 2001 From: Chuck Atkins <chuck.atkins@kitware.com> Date: Wed, 5 Apr 2017 14:19:41 -0400 Subject: [PATCH] Reinstate the use of reinterpret_cast --- .clang-tidy | 2 +- source/format/BP1Writer.cpp | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index de0e30acc..9a497cb87 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,4 +1,4 @@ -Checks: -*,cppcoreguidelines-*,google-*,llvm-*,misc-*,modernize-*,performance-*,-cppcoreguidelines-pro-type-vararg,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-google-runtime-int +Checks: -*,cppcoreguidelines-*,google-*,llvm-*,misc-*,modernize-*,performance-*,-cppcoreguidelines-pro-type-vararg,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-type-reinterpret-cast,-google-runtime-int CheckOptions: - key: google-runtime-int.TypeSuffix diff --git a/source/format/BP1Writer.cpp b/source/format/BP1Writer.cpp index caafd8e86..47b1ab716 100644 --- a/source/format/BP1Writer.cpp +++ b/source/format/BP1Writer.cpp @@ -72,7 +72,7 @@ void BP1Writer::WriteProcessGroupIndex( // offset to pg in data in metadata which is the current absolute position CopyToBuffer(metadataBuffer, - static_cast<uint64_t *>(&heap.m_DataAbsolutePosition)); + reinterpret_cast<uint64_t *>(&heap.m_DataAbsolutePosition)); // Back to writing metadata pg index length (length of group) const std::uint16_t metadataPGIndexLength = @@ -206,7 +206,7 @@ void BP1Writer::WriteDimensionsRecord( auto lf_WriteFlaggedDim = [](std::vector<char> &buffer, const char no, const std::size_t dimension) { CopyToBuffer(buffer, &no); - CopyToBuffer(buffer, static_cast<const uint64_t *>(&dimension)); + CopyToBuffer(buffer, reinterpret_cast<const uint64_t *>(&dimension)); }; // BODY Starts here @@ -227,8 +227,8 @@ void BP1Writer::WriteDimensionsRecord( { for (const auto &localDimension : localDimensions) { - CopyToBuffer(buffer, - static_cast<const uint64_t *>(&localDimension)); + CopyToBuffer(buffer, reinterpret_cast<const uint64_t *>( + &localDimension)); buffer.insert(buffer.end(), skip, 0); } } @@ -250,12 +250,12 @@ void BP1Writer::WriteDimensionsRecord( { for (unsigned int d = 0; d < localDimensions.size(); ++d) { - CopyToBuffer( - buffer, static_cast<const uint64_t *>(&localDimensions[d])); - CopyToBuffer(buffer, static_cast<const uint64_t *>( + CopyToBuffer(buffer, reinterpret_cast<const uint64_t *>( + &localDimensions[d])); + CopyToBuffer(buffer, reinterpret_cast<const uint64_t *>( &globalDimensions[d])); - CopyToBuffer(buffer, - static_cast<const uint64_t *>(&globalOffsets[d])); + CopyToBuffer(buffer, reinterpret_cast<const uint64_t *>( + &globalOffsets[d])); } } } -- GitLab