From 648843d403dbc8d2c1d4455bc876cc65234a0559 Mon Sep 17 00:00:00 2001 From: Vicente Adolfo Bolea Sanchez Date: Fri, 29 Dec 2023 16:34:35 -0500 Subject: [PATCH] bp: workaround for char overflow in bp vers --- source/adios2/engine/bp5/BP5Writer.cpp | 3 ++- source/adios2/toolkit/format/bp/BPSerializer.cpp | 3 ++- source/adios2/toolkit/format/bp/bp4/BP4Serializer.cpp | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/source/adios2/engine/bp5/BP5Writer.cpp b/source/adios2/engine/bp5/BP5Writer.cpp index 82a82886f4..69c0c4ec86 100644 --- a/source/adios2/engine/bp5/BP5Writer.cpp +++ b/source/adios2/engine/bp5/BP5Writer.cpp @@ -1236,7 +1236,8 @@ void BP5Writer::MakeHeader(std::vector &buffer, size_t &position, const st } const std::string majorVersion(std::to_string(ADIOS2_VERSION_MAJOR)); - const std::string minorVersion(std::to_string(ADIOS2_VERSION_MINOR)); + const char minorVersionChar = '0' + ADIOS2_VERSION_MINOR; + const std::string minorVersion(1, minorVersionChar); const std::string patchVersion(std::to_string(ADIOS2_VERSION_PATCH)); // byte 0-31: Readable tag diff --git a/source/adios2/toolkit/format/bp/BPSerializer.cpp b/source/adios2/toolkit/format/bp/BPSerializer.cpp index 57c9100fc9..51b9a224f5 100644 --- a/source/adios2/toolkit/format/bp/BPSerializer.cpp +++ b/source/adios2/toolkit/format/bp/BPSerializer.cpp @@ -232,7 +232,8 @@ void BPSerializer::PutMinifooter(const uint64_t pgIndexStart, const uint64_t var }; const std::string majorVersion(std::to_string(ADIOS2_VERSION_MAJOR)); - const std::string minorVersion(std::to_string(ADIOS2_VERSION_MINOR)); + const char minorVersionChar = '0' + ADIOS2_VERSION_MINOR; + const std::string minorVersion(1, minorVersionChar); const std::string patchVersion(std::to_string(ADIOS2_VERSION_PATCH)); const std::string versionLongTag("ADIOS-BP v" + majorVersion + "." + minorVersion + "." + diff --git a/source/adios2/toolkit/format/bp/bp4/BP4Serializer.cpp b/source/adios2/toolkit/format/bp/bp4/BP4Serializer.cpp index fc28640bae..46e8c59b45 100644 --- a/source/adios2/toolkit/format/bp/bp4/BP4Serializer.cpp +++ b/source/adios2/toolkit/format/bp/bp4/BP4Serializer.cpp @@ -61,7 +61,8 @@ void BP4Serializer::MakeHeader(BufferSTL &b, const std::string fileType, const b } const std::string majorVersion(std::to_string(ADIOS2_VERSION_MAJOR)); - const std::string minorVersion(std::to_string(ADIOS2_VERSION_MINOR)); + const char minorVersionChar = '0' + ADIOS2_VERSION_MINOR; + const std::string minorVersion(1, minorVersionChar); const std::string patchVersion(std::to_string(ADIOS2_VERSION_PATCH)); // byte 0-31: Readable tag