diff --git a/source/adios2/engine/ssc/SscReader.tcc b/source/adios2/engine/ssc/SscReader.tcc index 8c17d72bc3..991a60d92f 100644 --- a/source/adios2/engine/ssc/SscReader.tcc +++ b/source/adios2/engine/ssc/SscReader.tcc @@ -196,11 +196,13 @@ SscReader::BlocksInfoCommon(const Variable &variable, m_WriterDefinitionsLocked == false || m_ReaderSelectionsLocked == false) { - std::memcpy(&b.Value, v.value.data(), v.value.size()); + std::memcpy(reinterpret_cast(&b.Value), + v.value.data(), v.value.size()); } else { - std::memcpy(&b.Value, m_Buffer.data() + v.bufferStart, + std::memcpy(reinterpret_cast(&b.Value), + m_Buffer.data() + v.bufferStart, v.bufferCount); } } diff --git a/source/adios2/toolkit/format/bp5/BP5Deserializer.cpp b/source/adios2/toolkit/format/bp5/BP5Deserializer.cpp index 2d7cd9404b..5db991f123 100644 --- a/source/adios2/toolkit/format/bp5/BP5Deserializer.cpp +++ b/source/adios2/toolkit/format/bp5/BP5Deserializer.cpp @@ -13,6 +13,8 @@ #include "BP5Deserializer.h" #include "BP5Deserializer.tcc" +#include +#include #include #ifdef _WIN32 @@ -771,12 +773,13 @@ int BP5Deserializer::FindOffset(size_t Dims, const size_t *Size, static int FindOffsetCM(size_t Dims, const size_t *Size, const size_t *Index) { - int Offset = 0; + size_t Offset = 0; for (size_t i = Dims - 1; i >= 0; i--) { Offset = Index[i] + (Size[i] * Offset); } - return Offset; + + return std::min(static_cast(INT_MAX), Offset); } #define MAX(x, y) (((x) > (y)) ? (x) : (y)) @@ -830,7 +833,7 @@ void BP5Deserializer::ExtractSelectionFromPartialRM( BlockSize = 1; OperantDims = Dims; - OperantElementSize = ElementSize; + OperantElementSize = static_cast(ElementSize); for (size_t Dim = Dims - 1; Dim >= 0; Dim--) { if ((GlobalDims[Dim] == PartialCounts[Dim]) && diff --git a/source/h5vol/H5VolError.h b/source/h5vol/H5VolError.h index a924c6a58f..eeeee20aa4 100644 --- a/source/h5vol/H5VolError.h +++ b/source/h5vol/H5VolError.h @@ -11,7 +11,12 @@ void *safe_malloc(size_t n, unsigned long line); #define SAFE_MALLOC(n) safe_malloc(n, __LINE__) void safe_free(void **p); -#define SAFE_FREE(ptr) safe_free(&ptr) + +#ifdef __cplusplus +#define SAFE_FREE(ptr) safe_free(reinterpret_cast(&ptr)) +#else +#define SAFE_FREE(ptr) safe_free((void **)(&ptr)) +#endif void *safe_ralloc(void *ptr, size_t newsize, unsigned long line); #define SAFE_REALLOC(ptr, newsize) safe_ralloc(ptr, newsize, __LINE__)