Skip to content

Commit 266a4af

Browse files
committed
squash! squash! fixup! squash! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Code Quality: Address shadowing
Removed explicit template from unique_ptr throughout codebase
1 parent f2fb87e commit 266a4af

File tree

92 files changed

+167
-165
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+167
-165
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@
2323
/Testing
2424
/logs
2525
!build_qnx/*
26+
CMakeUserPresets.json

examples/hello_world/hello_world_service.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class hello_world_service {
7979

8080
void stop()
8181
{
82-
std::unique_lock<std::mutex> its_lock(mutex_);
82+
std::unique_lock its_lock{mutex_};
8383
while(!stop_) {
8484
condition_.wait(its_lock);
8585
}

examples/notify-sample.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ class service_sample {
153153
}
154154

155155
void run() {
156-
std::unique_lock<std::mutex> its_lock(mutex_);
156+
std::unique_lock its_lock{mutex_};
157157
while (!blocked_)
158158
condition_.wait(its_lock);
159159

@@ -177,7 +177,7 @@ class service_sample {
177177
uint32_t its_size = 1;
178178

179179
while (running_) {
180-
std::unique_lock<std::mutex> its_lock(notify_mutex_);
180+
std::unique_lock its_lock{notify_mutex_};
181181
while (!is_offered_ && running_)
182182
notify_condition_.wait(its_lock);
183183
while (is_offered_ && running_) {

examples/request-sample.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class client_sample {
151151
void run() {
152152
while (running_) {
153153
{
154-
std::unique_lock<std::mutex> its_lock(mutex_);
154+
std::unique_lock its_lock{mutex_};
155155
while (!blocked_) condition_.wait(its_lock);
156156
if (is_available_) {
157157
app_->send(request_);

examples/response-sample.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class service_sample {
116116
}
117117

118118
void run() {
119-
std::unique_lock<std::mutex> its_lock(mutex_);
119+
std::unique_lock its_lock{mutex_};
120120
while (!blocked_)
121121
condition_.wait(its_lock);
122122

implementation/configuration/src/configuration_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3048,7 +3048,7 @@ const std::string & configuration_impl::get_logfile() const {
30483048
}
30493049

30503050
vsomeip_v3::logger::level_e configuration_impl::get_loglevel() const {
3051-
std::unique_lock<std::mutex> its_lock(mutex_loglevel_);
3051+
std::unique_lock its_lock{mutex_loglevel_};
30523052
return loglevel_;
30533053
}
30543054

implementation/endpoints/src/endpoint_manager_impl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ bool endpoint_manager_impl::on_bind_error(std::shared_ptr<endpoint> _endpoint,
981981
uint16_t its_old_local_port = _endpoint->get_local_port();
982982
uint16_t its_new_local_port(ILLEGAL_PORT);
983983

984-
std::unique_lock<std::mutex> its_lock(used_client_ports_mutex_);
984+
std::unique_lock its_lock{used_client_ports_mutex_};
985985
std::map<bool, std::set<port_t> > its_used_client_ports;
986986
get_used_client_ports(_remote_address, _remote_port, its_used_client_ports);
987987
if (configuration_->get_client_port(
@@ -1364,7 +1364,7 @@ bool endpoint_manager_impl::check_options_queue() {
13641364
void
13651365
endpoint_manager_impl::process_multicast_options() {
13661366

1367-
std::unique_lock<std::mutex> its_lock(options_mutex_);
1367+
std::unique_lock its_lock{options_mutex_};
13681368
while (is_processing_options_) {
13691369
options_condition_.wait(
13701370
its_lock, [this] { return check_options_queue() || !is_processing_options_; });

implementation/endpoints/src/local_tcp_client_endpoint_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ void local_tcp_client_endpoint_impl::stop() {
125125

126126
void local_tcp_client_endpoint_impl::connect() {
127127
boost::system::error_code its_connect_error;
128-
std::unique_lock<std::mutex> its_lock(socket_mutex_);
128+
std::unique_lock its_lock{socket_mutex_};
129129
boost::system::error_code its_error;
130130
socket_->open(remote_.protocol(), its_error);
131131
if (!its_error || its_error == boost::asio::error::already_open) {

implementation/endpoints/src/local_tcp_server_endpoint_impl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ void local_tcp_server_endpoint_impl::accept_cbk(
248248
if (!_error) {
249249
boost::system::error_code its_error;
250250
{
251-
std::unique_lock<std::mutex> its_socket_lock(_connection->get_socket_lock());
251+
std::unique_lock its_socket_lock{_connection->get_socket_lock()};
252252
auto& new_connection_socket = _connection->get_socket();
253253

254254
endpoint_type remote = new_connection_socket.remote_endpoint(its_error);
@@ -930,7 +930,7 @@ void local_tcp_server_endpoint_impl::print_status() {
930930

931931
std::size_t its_recv_size(0);
932932
{
933-
std::unique_lock<std::mutex> c_s_lock(c.second->get_socket_lock());
933+
std::unique_lock c_s_lock{c.second->get_socket_lock()};
934934
its_recv_size = c.second->get_recv_buffer_capacity();
935935
}
936936

implementation/endpoints/src/local_uds_client_endpoint_impl.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void local_uds_client_endpoint_impl::restart(bool _force) {
5757
is_sending_ = false;
5858
}
5959
{
60-
std::lock_guard<std::mutex> its_lock(socket_mutex_);
60+
std::scoped_lock its_lock(socket_mutex_);
6161
shutdown_and_close_socket_unlocked(true);
6262
}
6363
state_ = cei_state_e::CONNECTING;
@@ -78,18 +78,18 @@ void local_uds_client_endpoint_impl::start() {
7878

7979
void local_uds_client_endpoint_impl::stop() {
8080
{
81-
std::lock_guard<std::recursive_mutex> its_lock(mutex_);
81+
std::scoped_lock its_lock(mutex_);
8282
sending_blocked_ = true;
8383
}
8484
{
85-
std::lock_guard<std::mutex> its_lock(connect_timer_mutex_);
85+
std::scoped_lock its_lock(connect_timer_mutex_);
8686
connect_timer_.cancel();
8787
}
8888
connect_timeout_ = VSOMEIP_DEFAULT_CONNECT_TIMEOUT;
8989

9090
bool is_open(false);
9191
{
92-
std::lock_guard<std::mutex> its_lock(socket_mutex_);
92+
std::scoped_lock its_lock(socket_mutex_);
9393
is_open = socket_->is_open();
9494
}
9595
if (is_open) {
@@ -116,7 +116,7 @@ void local_uds_client_endpoint_impl::connect() {
116116
start_connecting_timer();
117117
boost::system::error_code its_connect_error;
118118
{
119-
std::lock_guard<std::mutex> its_lock(socket_mutex_);
119+
std::lock_guard its_lock(socket_mutex_);
120120
boost::system::error_code its_error;
121121
socket_->open(remote_.protocol(), its_error);
122122

@@ -153,7 +153,7 @@ void local_uds_client_endpoint_impl::connect() {
153153
}
154154
std::size_t operations_cancelled;
155155
{
156-
std::lock_guard<std::mutex> its_lock(connecting_timer_mutex_);
156+
std::lock_guard its_lock(connecting_timer_mutex_);
157157
operations_cancelled = connecting_timer_.cancel();
158158
connecting_timer_state_ = connecting_timer_state_e::FINISH_ERROR;
159159
if (operations_cancelled != 0) {
@@ -174,7 +174,7 @@ void local_uds_client_endpoint_impl::connect() {
174174
}
175175

176176
void local_uds_client_endpoint_impl::receive() {
177-
std::lock_guard<std::mutex> its_lock(socket_mutex_);
177+
std::lock_guard its_lock(socket_mutex_);
178178
if (socket_->is_open()) {
179179
socket_->async_receive(
180180
boost::asio::buffer(recv_buffer_),
@@ -232,11 +232,11 @@ void local_uds_client_endpoint_impl::send_queued(std::pair<message_buffer_ptr_t,
232232
bufs.push_back(boost::asio::buffer(its_end_tag));
233233

234234
{
235-
std::lock_guard<std::mutex> its_lock(socket_mutex_);
235+
std::scoped_lock its_lock(socket_mutex_);
236236

237237
auto its_me {std::dynamic_pointer_cast<local_uds_client_endpoint_impl>(shared_from_this())};
238238
auto buffer_ptr = _entry.first; // Capture shared_ptr to ensure it stays alive
239-
239+
240240
if(socket_->is_open()) {
241241
boost::asio::async_write(
242242
*socket_, bufs,
@@ -247,7 +247,7 @@ void local_uds_client_endpoint_impl::send_queued(std::pair<message_buffer_ptr_t,
247247
VSOMEIP_WARNING << "lucei::" << __func__ << ": try to send while socket was not open | endpoint > " << this;
248248
was_not_connected_ = true;
249249
is_sending_ = false;
250-
}
250+
}
251251
}
252252
}
253253

@@ -287,7 +287,7 @@ void local_uds_client_endpoint_impl::receive_cbk(
287287
}
288288
error_handler_t handler;
289289
{
290-
std::lock_guard<std::mutex> its_lock(error_handler_mutex_);
290+
std::scoped_lock its_lock(error_handler_mutex_);
291291
handler = error_handler_;
292292
}
293293
if (handler)
@@ -394,7 +394,7 @@ void local_uds_client_endpoint_impl::max_allowed_reconnects_reached() {
394394
<< get_remote_information();
395395
error_handler_t handler;
396396
{
397-
std::lock_guard<std::mutex> its_lock(error_handler_mutex_);
397+
std::scoped_lock its_lock(error_handler_mutex_);
398398
handler = error_handler_;
399399
}
400400
if (handler)

0 commit comments

Comments
 (0)