Skip to content

Commit

Permalink
Update to C++17 (#560)
Browse files Browse the repository at this point in the history
* Upgrading to C++17

* Code Quality: Address compiler warnings

- Fixing narrowing issues
- Removing useless copies
- Removing unused lines
- unused-lambda-capture
- Removes unused variables
- Fix some casts (modernize c-style, or simply remove useless casts)
- Explicitly deleting unused endpoint_impl copy and move constructors
- Removing redundant std::bind
- Improving const correctness
- Moving thread init to constructor body
- Moved check_routing_credentials_ inside vsomeip security section where it's used
- Using =default destructor instead of empty destructor

Thread init:
Moving the initialization of these threads into the constructor body to
ensure that they do not start with an incomplete "this".  As they
capture this, it is possible that if the new thread begins before the
object is fully constructed, the new thread might operate on
uninitialized members of "this".

* Attempting to fix syntax error on MSVC

* Adjusting PR to conform to Covesa style

* Using curly brace initialization

* Using static_cast to narrow its_device.size() to a socklen_t

* Avoided double integer promotion
  • Loading branch information
kheaactua committed Apr 10, 2024
1 parent 38f9c54 commit cf49723
Show file tree
Hide file tree
Showing 30 changed files with 129 additions and 125 deletions.
2 changes: 1 addition & 1 deletion Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ libvsomeip_sd_srcs = [

cc_defaults {
name: "vsomeip_defaults",
cpp_std: "c++17",

cppflags: [
"-std=c++14",
"-fexceptions",
"-Wno-non-virtual-dtor",
"-Wno-unused-const-variable",
Expand Down
11 changes: 9 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ if(NOT CMAKE_BUILD_TYPE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()

set(CMAKE_CXX_STANDARD 17)

# OS
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(DL_LIBRARY "dl")
Expand Down Expand Up @@ -248,13 +250,13 @@ if (MSVC)
# add_definitions(-DVSOMEIP_DLL_COMPILATION) now it is controlled per target
SET(BOOST_WINDOWS_VERSION "0x600" CACHE STRING "Set the same Version as the Version with which Boost was built, otherwise there will be errors. (normaly 0x600 is for Windows 7 and 0x501 is for Windows XP)")
# Disable warning C4250 since it warns that the compiler is correctly following the C++ Standard. It's a "We-Are-Doing-Things-By-The-Book" notice, not a real warning.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS -D_WIN32_WINNT=${BOOST_WINDOWS_VERSION} -DWIN32 -DBOOST_ASIO_DISABLE_IOCP /EHsc /std:c++14 /wd4250")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS -D_WIN32_WINNT=${BOOST_WINDOWS_VERSION} -DWIN32 -DBOOST_ASIO_DISABLE_IOCP /EHsc /wd4250")
set(USE_RT "")
link_directories(${Boost_LIBRARY_DIR_DEBUG})
elseif(${CMAKE_SYSTEM_NAME} MATCHES "QNX")
set(USE_RT "")
else()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OS_CXX_FLAGS} -g ${OPTIMIZE} -std=c++14 ${NO_DEPRECATED} ${EXPORTSYMBOLS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OS_CXX_FLAGS} -g ${OPTIMIZE} ${NO_DEPRECATED} ${EXPORTSYMBOLS}")
set(USE_RT "rt")
endif()

Expand All @@ -268,6 +270,7 @@ list(SORT ${VSOMEIP_NAME}-cfg_SRC)
if (VSOMEIP_ENABLE_MULTIPLE_ROUTING_MANAGERS EQUAL 0)
add_library(${VSOMEIP_NAME}-cfg SHARED ${${VSOMEIP_NAME}-cfg_SRC})
set_target_properties (${VSOMEIP_NAME}-cfg PROPERTIES VERSION ${VSOMEIP_VERSION} SOVERSION ${VSOMEIP_MAJOR_VERSION})
target_compile_features(${VSOMEIP_NAME}-cfg PRIVATE cxx_std_17)
if (MSVC)
set_target_properties(${VSOMEIP_NAME}-cfg PROPERTIES COMPILE_DEFINITIONS "VSOMEIP_DLL_COMPILATION_PLUGIN")
endif()
Expand Down Expand Up @@ -302,6 +305,7 @@ list(SORT ${VSOMEIP_NAME}_SRC)

add_library(${VSOMEIP_NAME} SHARED ${${VSOMEIP_NAME}_SRC})
set_target_properties (${VSOMEIP_NAME} PROPERTIES VERSION ${VSOMEIP_VERSION} SOVERSION ${VSOMEIP_MAJOR_VERSION})
target_compile_features(${VSOMEIP_NAME} PRIVATE cxx_std_17)
if (MSVC)
set_target_properties(${VSOMEIP_NAME} PROPERTIES COMPILE_DEFINITIONS "VSOMEIP_DLL_COMPILATION")
else ()
Expand Down Expand Up @@ -331,6 +335,7 @@ file(GLOB ${VSOMEIP_NAME}-sd_SRC
list(SORT ${VSOMEIP_NAME}-sd_SRC)

add_library(${VSOMEIP_NAME}-sd SHARED ${${VSOMEIP_NAME}-sd_SRC})
target_compile_features(${VSOMEIP_NAME}-sd PRIVATE cxx_std_17)
set_target_properties (${VSOMEIP_NAME}-sd PROPERTIES VERSION ${VSOMEIP_VERSION} SOVERSION ${VSOMEIP_MAJOR_VERSION})
if (MSVC)
set_target_properties(${VSOMEIP_NAME}-sd PROPERTIES COMPILE_DEFINITIONS "VSOMEIP_DLL_COMPILATION_PLUGIN")
Expand All @@ -348,6 +353,7 @@ file(GLOB_RECURSE ${VSOMEIP_NAME}-e2e_SRC
list(SORT ${VSOMEIP_NAME}-e2e_SRC)

add_library(${VSOMEIP_NAME}-e2e SHARED ${${VSOMEIP_NAME}-e2e_SRC})
target_compile_features(${VSOMEIP_NAME}-e2e PRIVATE cxx_std_17)
set_target_properties (${VSOMEIP_NAME}-e2e PROPERTIES VERSION ${VSOMEIP_VERSION} SOVERSION ${VSOMEIP_MAJOR_VERSION})
if (MSVC)
set_target_properties(${VSOMEIP_NAME}-e2e PROPERTIES COMPILE_DEFINITIONS "VSOMEIP_DLL_COMPILATION_PLUGIN")
Expand Down Expand Up @@ -375,6 +381,7 @@ file(GLOB_RECURSE ${VSOMEIP_COMPAT_NAME}_SRC
list(SORT ${VSOMEIP_COMPAT_NAME}_SRC)

add_library(${VSOMEIP_COMPAT_NAME} SHARED ${${VSOMEIP_COMPAT_NAME}_SRC})
target_compile_features(${VSOMEIP_COMPAT_NAME} PRIVATE cxx_std_17)
set_target_properties (${VSOMEIP_COMPAT_NAME} PROPERTIES VERSION ${VSOMEIP_COMPAT_VERSION} SOVERSION ${VSOMEIP_COMPAT_MAJOR_VERSION})
if (MSVC)
set_target_properties(${VSOMEIP_COMPAT_NAME} PROPERTIES COMPILE_DEFINITIONS "VSOMEIP_DLL_COMPILATION_PLUGIN")
Expand Down
12 changes: 6 additions & 6 deletions examples/hello_world/hello_world_service.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
#if defined ANDROID || defined __ANDROID__
#include "android/log.h"
#define LOG_TAG "hello_world_service"
#define LOG_INF(...) fprintf(stdout, __VA_ARGS__), fprintf(stdout, "\n"), (void)__android_log_print(ANDROID_LOG_INFO, LOG_TAG, ##__VA_ARGS__)
#define LOG_ERR(...) fprintf(stderr, __VA_ARGS__), fprintf(stderr, "\n"), (void)__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, ##__VA_ARGS__)
#define LOG_INF(...) std::fprintf(stdout, __VA_ARGS__), std::fprintf(stdout, "\n"), (void)__android_log_print(ANDROID_LOG_INFO, LOG_TAG, ##__VA_ARGS__)
#define LOG_ERR(...) std::fprintf(stderr, __VA_ARGS__), std::fprintf(stderr, "\n"), (void)__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, ##__VA_ARGS__)
#else
#include <cstdio>
#define LOG_INF(...) fprintf(stdout, __VA_ARGS__), fprintf(stdout, "\n")
#define LOG_ERR(...) fprintf(stderr, __VA_ARGS__), fprintf(stderr, "\n")
#define LOG_INF(...) std::fprintf(stdout, __VA_ARGS__), std::fprintf(stdout, "\n")
#define LOG_ERR(...) std::fprintf(stderr, __VA_ARGS__), std::fprintf(stderr, "\n")
#endif

static vsomeip::service_t service_id = 0x1111;
Expand All @@ -32,9 +32,9 @@ class hello_world_service {
hello_world_service() :
rtm_(vsomeip::runtime::get()),
app_(rtm_->create_application()),
stop_(false),
stop_thread_(std::bind(&hello_world_service::stop, this))
stop_(false)
{
stop_thread_ = std::thread{&hello_world_service::stop, this};
}

~hello_world_service()
Expand Down
6 changes: 3 additions & 3 deletions implementation/configuration/include/internal.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,14 @@ typedef enum {
IS_SUBSCRIBING
} subscription_state_e;

const std::uint32_t MESSAGE_SIZE_UNLIMITED = (std::numeric_limits<std::uint32_t>::max)();
inline constexpr std::uint32_t MESSAGE_SIZE_UNLIMITED = (std::numeric_limits<std::uint32_t>::max)();

const std::uint32_t QUEUE_SIZE_UNLIMITED = (std::numeric_limits<std::uint32_t>::max)();
inline constexpr std::uint32_t QUEUE_SIZE_UNLIMITED = (std::numeric_limits<std::uint32_t>::max)();

#define VSOMEIP_DEFAULT_NPDU_DEBOUNCING_NANO 2 * 1000 * 1000
#define VSOMEIP_DEFAULT_NPDU_MAXIMUM_RETENTION_NANO 5 * 1000 * 1000

const std::uint32_t MAX_RECONNECTS_UNLIMITED = (std::numeric_limits<std::uint32_t>::max)();
inline constexpr std::uint32_t MAX_RECONNECTS_UNLIMITED = (std::numeric_limits<std::uint32_t>::max)();

const std::uint32_t ANY_UID = 0xFFFFFFFF;
const std::uint32_t ANY_GID = 0xFFFFFFFF;
Expand Down
10 changes: 5 additions & 5 deletions implementation/configuration/include/internal_android.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,17 +130,17 @@ typedef enum {
IS_SUBSCRIBING
} subscription_state_e;

const std::uint32_t MESSAGE_SIZE_UNLIMITED = std::numeric_limits<std::uint32_t>::max();
inline constexpr std::uint32_t MESSAGE_SIZE_UNLIMITED = std::numeric_limits<std::uint32_t>::max();

const std::uint32_t QUEUE_SIZE_UNLIMITED = std::numeric_limits<std::uint32_t>::max();
inline constexpr std::uint32_t QUEUE_SIZE_UNLIMITED = std::numeric_limits<std::uint32_t>::max();

#define VSOMEIP_DEFAULT_NPDU_DEBOUNCING_NANO 2 * 1000 * 1000
#define VSOMEIP_DEFAULT_NPDU_MAXIMUM_RETENTION_NANO 5 * 1000 * 1000

const std::uint32_t MAX_RECONNECTS_UNLIMITED = std::numeric_limits<std::uint32_t>::max();
inline constexpr std::uint32_t MAX_RECONNECTS_UNLIMITED = std::numeric_limits<std::uint32_t>::max();

const std::uint32_t ANY_UID = 0xFFFFFFFF;
const std::uint32_t ANY_GID = 0xFFFFFFFF;
inline constexpr std::uint32_t ANY_UID = 0xFFFFFFFF;
inline constexpr std::uint32_t ANY_GID = 0xFFFFFFFF;

enum class port_type_e {
PT_OPTIONAL,
Expand Down
13 changes: 7 additions & 6 deletions implementation/configuration/src/configuration_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ bool configuration_impl::load(const std::string &_name) {

// Tell, if reading of configuration file(s) failed.
// (This may file if the logger configuration is incomplete/missing).
for (auto f : its_failed)
for (const auto& f : its_failed)
VSOMEIP_WARNING << "Reading of configuration file \""
<< f << "\" failed. Configuration may be incomplete.";

Expand All @@ -342,7 +342,7 @@ bool configuration_impl::load(const std::string &_name) {

std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();

for (auto i : its_input) {
for (const auto& i : its_input) {
if (utility::is_file(i))
VSOMEIP_INFO << "Using configuration file: \"" << i << "\".";

Expand Down Expand Up @@ -561,7 +561,7 @@ bool configuration_impl::load_data(const std::vector<configuration_element> &_el

if (is_logging_loaded_) {
logger::logger_impl::init(shared_from_this());
for (auto w : its_warnings)
for (const auto& w : its_warnings)
VSOMEIP_WARNING << w;
}
}
Expand Down Expand Up @@ -3255,16 +3255,17 @@ void configuration_impl::trim(std::string &_s) {
std::find_if(
_s.begin(),
_s.end(),
[](unsigned char ch) { return !std::isspace(ch); }
[](const auto ch) { return !std::isspace(ch); }
)
);

_s.erase(
std::find_if(
_s.rbegin(),
_s.rend(),
[](unsigned char ch) { return !std::isspace(ch); }).base(),
_s.end()
[](const auto ch) { return !std::isspace(ch); }
).base(),
_s.end()
);
}

Expand Down
3 changes: 3 additions & 0 deletions implementation/endpoints/include/endpoint_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ class endpoint_impl: public virtual endpoint {
std::uint32_t _max_message_size,
configuration::endpoint_queue_limit_t _queue_limit,
const std::shared_ptr<configuration>& _configuration);
endpoint_impl(endpoint_impl<Protocol> const&) = delete;
endpoint_impl(endpoint_impl<Protocol> const&&) = delete;

virtual ~endpoint_impl();

void enable_magic_cookies();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ struct storage :
{
socket_type_t &socket_;
receive_handler_t handler_;
byte_t *buffer_;
std::size_t length_;
byte_t *buffer_ = nullptr;
size_t length_;
uid_t uid_;
gid_t gid_;
size_t bytes_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class local_uds_client_endpoint_impl: public local_uds_client_endpoint_base_impl
const endpoint_type& _remote,
boost::asio::io_context &_io,
const std::shared_ptr<configuration>& _configuration);
virtual ~local_uds_client_endpoint_impl();
virtual ~local_uds_client_endpoint_impl() = default;

void start();
void stop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class local_uds_server_endpoint_impl: public local_uds_server_endpoint_base_impl
const std::shared_ptr<configuration>& _configuration,
bool _is_routing_endpoint);

virtual ~local_uds_server_endpoint_impl();
virtual ~local_uds_server_endpoint_impl() = default;

void start();
void stop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct storage :
socket_type_t &socket_;
endpoint_type_t &sender_;
receive_handler_t handler_;
byte_t *buffer_;
byte_t *buffer_ = nullptr;
size_t length_;
std::uint8_t multicast_id_;
bool is_v4_;
Expand Down
2 changes: 1 addition & 1 deletion implementation/endpoints/src/endpoint_manager_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ std::shared_ptr<endpoint> endpoint_manager_base::create_local(client_t _client)
return create_local_unlocked(_client);
}

void endpoint_manager_base::remove_local(client_t _client) {
void endpoint_manager_base::remove_local(const client_t _client) {
std::shared_ptr<endpoint> its_endpoint(find_local(_client));
if (its_endpoint) {
its_endpoint->register_error_handler(nullptr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,7 @@ local_uds_client_endpoint_impl::local_uds_client_endpoint_impl(
is_supporting_magic_cookies_ = false;
}

local_uds_client_endpoint_impl::~local_uds_client_endpoint_impl() {

}

bool local_uds_client_endpoint_impl::is_local() const {

return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,11 @@ local_uds_server_endpoint_impl::local_uds_server_endpoint_impl(
#endif
}

local_uds_server_endpoint_impl::~local_uds_server_endpoint_impl() {

}

bool local_uds_server_endpoint_impl::is_local() const {

return true;
}

void local_uds_server_endpoint_impl::start() {

std::lock_guard<std::mutex> its_lock(acceptor_mutex_);
if (acceptor_.is_open()) {
connection::ptr new_connection = connection::create(
Expand Down
2 changes: 1 addition & 1 deletion implementation/endpoints/src/tcp_client_endpoint_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ void tcp_client_endpoint_impl::connect() {
std::string its_device(configuration_->get_device());
if (its_device != "") {
if (setsockopt(socket_->native_handle(),
SOL_SOCKET, SO_BINDTODEVICE, its_device.c_str(), (socklen_t)its_device.size()) == -1) {
SOL_SOCKET, SO_BINDTODEVICE, its_device.c_str(), static_cast<socklen_t>(its_device.size())) == -1) {
VSOMEIP_WARNING << "TCP Client: Could not bind to device \"" << its_device << "\"";
}
}
Expand Down
14 changes: 7 additions & 7 deletions implementation/endpoints/src/tcp_server_endpoint_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ tcp_server_endpoint_impl::tcp_server_endpoint_impl(
std::string its_device(configuration_->get_device());
if (its_device != "") {
if (setsockopt(acceptor_.native_handle(),
SOL_SOCKET, SO_BINDTODEVICE, its_device.c_str(), (socklen_t)its_device.size()) == -1) {
SOL_SOCKET, SO_BINDTODEVICE, its_device.c_str(), static_cast<socklen_t>(its_device.size())) == -1) {
VSOMEIP_WARNING << "TCP Server: Could not bind to device \"" << its_device << "\"";
}
}
Expand Down Expand Up @@ -295,8 +295,8 @@ void tcp_server_endpoint_impl::accept_cbk(const connection::ptr& _connection,
auto its_ep = std::dynamic_pointer_cast<tcp_server_endpoint_impl>(
shared_from_this());
its_timer->async_wait([its_timer, its_ep]
(const boost::system::error_code& _error) {
if (!_error) {
(const boost::system::error_code& _error_inner) {
if (!_error_inner) {
its_ep->start();
}
});
Expand Down Expand Up @@ -853,12 +853,12 @@ void tcp_server_endpoint_impl::connection::handle_recv_buffer_exception(
<< std::setfill('0') << std::hex;

for (std::size_t i = 0; i < recv_buffer_size_ && i < 16; i++) {
its_message << std::setw(2) << (int) (recv_buffer_[i]) << " ";
its_message << std::setw(2) << static_cast<int>(recv_buffer_[i]) << " ";
}

its_message << " Last 16 Bytes captured: ";
for (int i = 15; recv_buffer_size_ > 15 && i >= 0; i--) {
its_message << std::setw(2) << (int) (recv_buffer_[static_cast<size_t>(i)]) << " ";
its_message << std::setw(2) << static_cast<int>(recv_buffer_[static_cast<size_t>(i)]) << " ";
}
VSOMEIP_ERROR << its_message.str();
recv_buffer_.clear();
Expand Down Expand Up @@ -954,7 +954,7 @@ void tcp_server_endpoint_impl::print_status() {
std::lock_guard<std::mutex> its_lock(mutex_);
connections_t its_connections;
{
std::lock_guard<std::mutex> its_lock(connections_mutex_);
std::lock_guard<std::mutex> its_lock_inner(connections_mutex_);
its_connections = connections_;
}

Expand Down Expand Up @@ -1027,7 +1027,7 @@ void tcp_server_endpoint_impl::connection::wait_until_sent(const boost::system::
}
}
{
std::lock_guard<std::mutex> its_lock(its_server->connections_mutex_);
std::lock_guard<std::mutex> its_lock_inner(its_server->connections_mutex_);
stop();
}
its_server->remove_connection(this);
Expand Down
2 changes: 1 addition & 1 deletion implementation/endpoints/src/udp_client_endpoint_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void udp_client_endpoint_impl::connect() {
<< get_address_port_remote();
}
socket_->set_option(boost::asio::socket_base::receive_buffer_size(
udp_receive_buffer_size_), its_error);
static_cast<int>(udp_receive_buffer_size_)), its_error);
if (its_error) {
VSOMEIP_WARNING << "udp_client_endpoint_impl::connect: couldn't set "
<< "SO_RCVBUF: " << its_error.message()
Expand Down
4 changes: 2 additions & 2 deletions implementation/endpoints/src/udp_server_endpoint_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ udp_server_endpoint_impl::udp_server_endpoint_impl(
std::string its_device(configuration_->get_device());
if (its_device != "") {
if (setsockopt(unicast_socket_.native_handle(),
SOL_SOCKET, SO_BINDTODEVICE, its_device.c_str(), (socklen_t)its_device.size()) == -1) {
SOL_SOCKET, SO_BINDTODEVICE, its_device.c_str(), static_cast<socklen_t>(its_device.size())) == -1) {
VSOMEIP_WARNING << "UDP Server: Could not bind to device \"" << its_device << "\"";
}
}
Expand Down Expand Up @@ -108,7 +108,7 @@ udp_server_endpoint_impl::udp_server_endpoint_impl(
const int its_udp_recv_buffer_size =
configuration_->get_udp_receive_buffer_size();
unicast_socket_.set_option(boost::asio::socket_base::receive_buffer_size(
its_udp_recv_buffer_size), ec);
static_cast<int>(its_udp_recv_buffer_size)), ec);

if (ec) {
VSOMEIP_WARNING << "udp_server_endpoint_impl: couldn't set "
Expand Down
2 changes: 0 additions & 2 deletions implementation/message/include/message_base_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#ifndef VSOMEIP_V3_MESSAGE_BASE_IMPL_HPP
#define VSOMEIP_V3_MESSAGE_BASE_IMPL_HPP

#include <boost/thread.hpp>

#include <vsomeip/export.hpp>
#include <vsomeip/message.hpp>

Expand Down
4 changes: 2 additions & 2 deletions implementation/message/src/deserializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ bool deserializer::deserialize(std::string &_target, std::size_t _length) {
if (_length > remaining_ || _length > _target.capacity()) {
return false;
}
_target.assign(position_, position_ + long(_length));
position_ += long(_length);
_target.assign(position_, position_ + static_cast<std::vector<byte_t>::difference_type>(_length));
position_ += static_cast<std::vector<byte_t>::difference_type>(_length);
remaining_ -= _length;

return true;
Expand Down
2 changes: 1 addition & 1 deletion implementation/plugin/src/plugin_manager_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ bool plugin_manager_impl::unload_plugin(plugin_type_e _type) {
}
} else {
VSOMEIP_ERROR << "plugin_manager_impl::unload_plugin didn't find plugin"
<< " type:" << (int)_type;
<< " type:" << static_cast<int>(_type);
return false;
}
return plugins_.erase(_type);
Expand Down
Loading

0 comments on commit cf49723

Please sign in to comment.