From 8c7654f492d2570d6b61536478dcbd3d6ce46e24 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Sun, 12 Apr 2020 15:00:30 -0700 Subject: [PATCH] quiet some MSVC warnings --- src/bitmask.cpp | 2 +- src/bitmask.h | 2 +- src/data.cpp | 16 ++++++++-------- src/log.cpp | 2 +- src/pvaproto.h | 2 +- src/sharedarray.cpp | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/bitmask.cpp b/src/bitmask.cpp index af1cb3e..61f5f84 100644 --- a/src/bitmask.cpp +++ b/src/bitmask.cpp @@ -45,7 +45,7 @@ void BitMask::resize(size_t bits) { // round up to multiple of 64 size_t storebits = ((bits-1u)|0x3f)+1u; _words.resize(storebits/64u, 0u); - _size = bits; + _size = uint16_t(bits); } size_t BitMask::findSet(size_t start) const diff --git a/src/bitmask.h b/src/bitmask.h index 0456e29..72c6c35 100644 --- a/src/bitmask.h +++ b/src/bitmask.h @@ -95,7 +95,7 @@ class BitMask : public detail::BitBase { std::vector _words; // actual size in bits // _words.size()*64u >= _size - uint8_t _size=0u; + uint16_t _size=0u; public: diff --git a/src/data.cpp b/src/data.cpp index 5e573f4..8a389a4 100644 --- a/src/data.cpp +++ b/src/data.cpp @@ -302,10 +302,10 @@ template bool copyOutScalar(const Src& src, void *ptr, StoreType type) { switch(type) { - case StoreType::Real: *reinterpret_cast(ptr) = src; return true; - case StoreType::Integer: *reinterpret_cast(ptr) = src; return true; - case StoreType::UInteger: *reinterpret_cast(ptr) = src; return true; - case StoreType::Bool: *reinterpret_cast(ptr) = src; return true; + case StoreType::Real: *reinterpret_cast(ptr) = double(src); return true; + case StoreType::Integer: *reinterpret_cast(ptr) = int64_t(src); return true; + case StoreType::UInteger: *reinterpret_cast(ptr) = uint64_t(src); return true; + case StoreType::Bool: *reinterpret_cast(ptr) = bool(src); return true; case StoreType::String: *reinterpret_cast(ptr) = SB()< bool copyInScalar(Dest& dest, const void *ptr, StoreType type) { switch(type) { - case StoreType::Real: dest = *reinterpret_cast(ptr); return true; - case StoreType::Integer: dest = *reinterpret_cast(ptr); return true; - case StoreType::UInteger: dest = *reinterpret_cast(ptr); return true; - case StoreType::Bool: dest = *reinterpret_cast(ptr); return true; + case StoreType::Real: dest = Dest(*reinterpret_cast(ptr)); return true; + case StoreType::Integer: dest = Dest(*reinterpret_cast(ptr)); return true; + case StoreType::UInteger: dest = Dest(*reinterpret_cast(ptr)); return true; + case StoreType::Bool: dest = Dest(*reinterpret_cast(ptr)); return true; case StoreType::String: return parseScalar(dest, *reinterpret_cast(ptr)); case StoreType::Null: case StoreType::Compound: diff --git a/src/log.cpp b/src/log.cpp index c112d90..621fd20 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -252,7 +252,7 @@ void xerrlogHexPrintf(const void *buf, size_t buflen) // printed line (4 groups of 4 bytes) // addr : AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD char buf[4][9] = {"","","",""}; - const unsigned addr = pos; + const unsigned addr = unsigned(pos); for(unsigned grp=0; grp<4 && pos(sbase); auto D = static_cast(dbase); for(auto i : range(count)) - D[i] = S[i]; + D[i] = Dest(S[i]); } void printValue(std::string& dest, const bool& src)