diff --git a/include/message.h b/include/message.h index 21a5767..5b1bb02 100644 --- a/include/message.h +++ b/include/message.h @@ -94,10 +94,10 @@ protected: size = std::min(size, _bodySize - _filled); // append more data - memcpy(_body + _filled, buffer, size); + memcpy(_body + _filled, buffer, (size_t)size); // update filled data - _filled += size; + _filled += (size_t)size; } else if (size >= _bodySize) { @@ -108,16 +108,16 @@ protected: else { // allocate the buffer - _body = (char *)malloc(_bodySize); + _body = (char *)malloc((size_t)_bodySize); // remember that the buffer was allocated, so that the destructor can get rid of it _allocated = true; // append more data - memcpy(_body, buffer, std::min(size, _bodySize)); + memcpy(_body, buffer, std::min((size_t)size, (size_t)_bodySize)); // update filled data - _filled = std::min(size, _bodySize); + _filled = std::min((size_t)size, (size_t)_bodySize); } // check if we're done diff --git a/src/connectionimpl.cpp b/src/connectionimpl.cpp index 756e084..332e106 100644 --- a/src/connectionimpl.cpp +++ b/src/connectionimpl.cpp @@ -125,7 +125,7 @@ uint64_t ConnectionImpl::parse(const Buffer &buffer) try { // try to recognize the frame - ReducedBuffer reduced_buf(buffer, processed); + ReducedBuffer reduced_buf(buffer, (size_t)processed); ReceivedFrame receivedFrame(reduced_buf, _maxFrame); // do we have the full frame?