Skip to content

Commit 8633052

Browse files
Avoid redundant move (#1476)
The argument is constant reference Resolves: GCC13-WARNING Signed-off-by: Rustam Gamidov <ext-rustam.gamidov@here.com>
1 parent 15de03d commit 8633052

File tree

7 files changed

+31
-22
lines changed

7 files changed

+31
-22
lines changed

olp-cpp-sdk-authentication/src/AuthenticationClientImpl.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2020-2023 HERE Europe B.V.
2+
* Copyright (C) 2020-2024 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,8 +21,10 @@
2121

2222
#include <chrono>
2323
#include <iomanip>
24+
#include <limits>
2425
#include <sstream>
2526
#include <thread>
27+
#include <utility>
2628

2729
#include <rapidjson/document.h>
2830
#include <rapidjson/istreamwrapper.h>
@@ -590,7 +592,7 @@ client::CancellationToken AuthenticationClientImpl::SignUpHereUser(
590592
};
591593

592594
return AddTask(settings_.task_scheduler, pending_requests_,
593-
std::move(signup_task), std::move(callback));
595+
std::move(signup_task), callback);
594596
}
595597

596598
client::CancellationToken AuthenticationClientImpl::SignOut(
@@ -635,7 +637,7 @@ client::CancellationToken AuthenticationClientImpl::SignOut(
635637
};
636638

637639
return AddTask(settings_.task_scheduler, pending_requests_,
638-
std::move(sign_out_task), std::move(callback));
640+
std::move(sign_out_task), callback);
639641
}
640642

641643
client::CancellationToken AuthenticationClientImpl::IntrospectApp(

olp-cpp-sdk-core/src/client/OlpClient.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019-2023 HERE Europe B.V.
2+
* Copyright (C) 2019-2024 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -560,8 +560,7 @@ CancellationToken OlpClient::OlpClientImpl::CallApi(
560560

561561
if (merge) {
562562
// Add callback and prepare CancellationToken
563-
auto call_id =
564-
pending_requests->Append(url, std::move(callback), request_ptr);
563+
auto call_id = pending_requests->Append(url, callback, request_ptr);
565564
cancellation_token =
566565
CancellationToken([=] { pending_requests->Cancel(url, call_id); });
567566

@@ -577,7 +576,7 @@ CancellationToken OlpClient::OlpClientImpl::CallApi(
577576
request_ptr = std::make_shared<PendingUrlRequest>();
578577

579578
// Add callback and prepare CancellationToken
580-
auto call_id = request_ptr->Append(std::move(callback));
579+
auto call_id = request_ptr->Append(callback);
581580
cancellation_token =
582581
CancellationToken([=] { request_ptr->Cancel(call_id); });
583582
}

olp-cpp-sdk-dataservice-read/src/generated/api/StreamApi.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2020 HERE Europe B.V.
2+
* Copyright (C) 2020-2024 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,6 +20,9 @@
2020
#include "StreamApi.h"
2121

2222
#include <map>
23+
#include <memory>
24+
#include <utility>
25+
#include <vector>
2326

2427
#include <olp/core/client/CancellationContext.h>
2528
#include <olp/core/client/HttpResponse.h>
@@ -93,7 +96,7 @@ StreamApi::SubscribeApiResponse StreamApi::Subscribe(
9396

9497
auto http_response = client.CallApi(
9598
metadata_uri, "POST", std::move(query_params), std::move(header_params),
96-
{}, data, "application/json", std::move(context));
99+
{}, data, "application/json", context);
97100
if (http_response.status != http::HttpStatusCode::CREATED) {
98101
return client::ApiError(http_response.status, http_response.response.str());
99102
}
@@ -127,7 +130,7 @@ StreamApi::ConsumeDataApiResponse StreamApi::ConsumeData(
127130

128131
auto http_response = client.CallApi(
129132
metadata_uri, "GET", std::move(query_params), std::move(header_params),
130-
{}, nullptr, std::string{}, std::move(context));
133+
{}, nullptr, std::string{}, context);
131134
if (http_response.status != http::HttpStatusCode::OK) {
132135
return client::ApiError(http_response.status, http_response.response.str());
133136
}
@@ -178,7 +181,7 @@ StreamApi::UnsubscribeApiResponse StreamApi::DeleteSubscription(
178181

179182
const auto http_response = client.CallApi(
180183
metadata_uri, "DELETE", std::move(query_params), std::move(header_params),
181-
{}, nullptr, std::string{}, std::move(context));
184+
{}, nullptr, std::string{}, context);
182185
if (http_response.status != http::HttpStatusCode::OK) {
183186
return client::ApiError(http_response.status, http_response.response.str());
184187
}
@@ -217,7 +220,7 @@ Response<int> StreamApi::HandleOffsets(
217220

218221
const auto http_response = client.CallApi(
219222
metadata_uri, "PUT", std::move(query_params), std::move(header_params),
220-
{}, data, "application/json", std::move(context));
223+
{}, data, "application/json", context);
221224
if (http_response.status != http::HttpStatusCode::OK) {
222225
return client::ApiError(http_response.status, http_response.response.str());
223226
}

olp-cpp-sdk-dataservice-write/src/IndexLayerClientImpl.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019-2021 HERE Europe B.V.
2+
* Copyright (C) 2019-2024 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -33,6 +33,8 @@
3333
#include "generated/IndexApi.h"
3434

3535
#include <atomic>
36+
#include <string>
37+
#include <utility>
3638

3739
namespace {
3840
std::string GenerateUuid() {
@@ -208,7 +210,7 @@ client::CancellationToken IndexLayerClientImpl::PublishIndex(
208210
};
209211

210212
return AddTask(settings_.task_scheduler, pending_requests_,
211-
std::move(publish_task), std::move(callback));
213+
std::move(publish_task), callback);
212214
}
213215

214216
client::CancellableFuture<DeleteIndexDataResponse>

olp-cpp-sdk-dataservice-write/src/generated/BlobApi.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019-2021 HERE Europe B.V.
2+
* Copyright (C) 2019-2024 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,8 +19,11 @@
1919

2020
#include "BlobApi.h"
2121

22+
#include <map>
2223
#include <memory>
2324
#include <sstream>
25+
#include <utility>
26+
#include <vector>
2427

2528
#include <olp/core/client/HttpResponse.h>
2629
#include <olp/core/http/HttpStatusCode.h>
@@ -87,7 +90,7 @@ PutBlobResponse BlobApi::PutBlob(
8790
header_params.insert(std::make_pair("Accept", "application/json"));
8891

8992
if (!content_encoding.empty()) {
90-
header_params.insert(std::make_pair("Content-Encoding", content_encoding));
93+
header_params.insert(std::make_pair("Content-Encoding", content_encoding));
9194
}
9295

9396
if (billing_tag) {
@@ -99,8 +102,8 @@ PutBlobResponse BlobApi::PutBlob(
99102

100103
auto http_response =
101104
client.CallApi(std::move(put_blob_uri), "PUT", std::move(query_params),
102-
std::move(header_params), std::move(form_params),
103-
std::move(data), std::move(content_type), cancel_context);
105+
std::move(header_params), std::move(form_params), data,
106+
content_type, cancel_context);
104107

105108
if (http_response.status != olp::http::HttpStatusCode::OK &&
106109
http_response.status != olp::http::HttpStatusCode::NO_CONTENT) {

olp-cpp-sdk-dataservice-write/tests/VersionedLayerClientImplPublishToBatchTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2020-2021 HERE Europe B.V.
2+
* Copyright (C) 2020-2024 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -158,7 +158,7 @@ class VersionedLayerClientImplPublishToBatchTest : public ::testing::Test {
158158
ReturnHttpResponse(olp::http::NetworkResponse().WithStatus(status),
159159
olp::serializer::serialize(apis)));
160160

161-
return std::move(service_api);
161+
return service_api;
162162
}
163163

164164
write::model::Apis CreateApiResponse(const std::string& service) {

tests/integration/olp-cpp-sdk-dataservice-write/VersionedLayerClientPublishToBatchTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2020-2021 HERE Europe B.V.
2+
* Copyright (C) 2020-2024 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -155,7 +155,7 @@ class VersionedLayerClientPublishToBatchTest : public ::testing::Test {
155155
ReturnHttpResponse(olp::http::NetworkResponse().WithStatus(status),
156156
olp::serializer::serialize(apis)));
157157

158-
return std::move(service_api);
158+
return service_api;
159159
}
160160

161161
write::model::Apis CreateApiResponse(const std::string& service) {

0 commit comments

Comments
 (0)