summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2015-12-01 16:45:39 +0100
committerKonstantin Käfer <mail@kkaefer.com>2015-12-03 15:38:36 +0100
commitdc620f48de48d500298044d8da0ba946b3b0c566 (patch)
tree60110336706627dea9f18821f5d8fc6e9713210a
parente12cd6aef4858b09c8ca449e779a58d15e878932 (diff)
downloadqtlocation-mapboxgl-dc620f48de48d500298044d8da0ba946b3b0c566.tar.gz
[core] Fix std::move() misuse that disables copy elision
-rw-r--r--platform/default/headless_view.cpp2
-rw-r--r--platform/default/sqlite3.cpp2
-rw-r--r--platform/default/sqlite_cache.cpp4
-rw-r--r--src/mbgl/map/map_context.cpp2
-rw-r--r--src/mbgl/map/vector_tile.cpp2
-rw-r--r--src/mbgl/text/get_anchors.cpp2
-rw-r--r--src/mbgl/util/premultiply.cpp4
-rw-r--r--test/api/annotations.cpp2
-rw-r--r--test/api/repeated_render.cpp4
-rw-r--r--test/fixtures/mock_file_source.cpp4
10 files changed, 14 insertions, 14 deletions
diff --git a/platform/default/headless_view.cpp b/platform/default/headless_view.cpp
index d6fd892700..98d3a38ee7 100644
--- a/platform/default/headless_view.cpp
+++ b/platform/default/headless_view.cpp
@@ -185,7 +185,7 @@ PremultipliedImage HeadlessView::readStillImage() {
std::memcpy(rgba + j * stride, tmp.get(), stride);
}
- return std::move(image);
+ return image;
}
void HeadlessView::clearBuffers() {
diff --git a/platform/default/sqlite3.cpp b/platform/default/sqlite3.cpp
index 41e5814a70..196839bea4 100644
--- a/platform/default/sqlite3.cpp
+++ b/platform/default/sqlite3.cpp
@@ -69,7 +69,7 @@ void Database::exec(const std::string &sql) {
Statement Database::prepare(const char *query) {
assert(db);
- return std::move(Statement(db, query));
+ return Statement(db, query);
}
Statement::Statement(sqlite3 *db, const char *sql) {
diff --git a/platform/default/sqlite_cache.cpp b/platform/default/sqlite_cache.cpp
index 1ca278b8f5..45fab70aa1 100644
--- a/platform/default/sqlite_cache.cpp
+++ b/platform/default/sqlite_cache.cpp
@@ -121,9 +121,9 @@ void SQLiteCache::Impl::get(const Resource &resource, Callback callback) {
response->modified = Seconds(getStmt->get<Seconds::rep>(1));
response->etag = getStmt->get<std::string>(2);
response->expires = Seconds(getStmt->get<Seconds::rep>(3));
- response->data = std::make_shared<std::string>(std::move(getStmt->get<std::string>(4)));
+ response->data = std::make_shared<std::string>(getStmt->get<std::string>(4));
if (getStmt->get<int>(5)) { // == compressed
- response->data = std::make_shared<std::string>(std::move(util::decompress(*response->data)));
+ response->data = std::make_shared<std::string>(util::decompress(*response->data));
}
callback(std::move(response));
} else {
diff --git a/src/mbgl/map/map_context.cpp b/src/mbgl/map/map_context.cpp
index c78a1b771d..e6588f5b36 100644
--- a/src/mbgl/map/map_context.cpp
+++ b/src/mbgl/map/map_context.cpp
@@ -246,7 +246,7 @@ bool MapContext::renderSync(const TransformState& state, const FrameData& frame)
painter->render(*style, frame, data.getAnnotationManager()->getSpriteAtlas());
if (data.mode == MapMode::Still) {
- callback(nullptr, std::move(view.readStillImage()));
+ callback(nullptr, view.readStillImage());
callback = nullptr;
}
diff --git a/src/mbgl/map/vector_tile.cpp b/src/mbgl/map/vector_tile.cpp
index 5144919348..6271322bc4 100644
--- a/src/mbgl/map/vector_tile.cpp
+++ b/src/mbgl/map/vector_tile.cpp
@@ -164,7 +164,7 @@ VectorTileLayer::VectorTileLayer(pbf layer_pbf) {
} else if (layer_pbf.tag == 3) { // keys
keys.emplace(layer_pbf.string(), keys.size());
} else if (layer_pbf.tag == 4) { // values
- values.emplace_back(std::move(parseValue(layer_pbf.message())));
+ values.emplace_back(parseValue(layer_pbf.message()));
} else if (layer_pbf.tag == 5) { // extent
extent = layer_pbf.varint();
} else {
diff --git a/src/mbgl/text/get_anchors.cpp b/src/mbgl/text/get_anchors.cpp
index 6492fd0679..c19bc24958 100644
--- a/src/mbgl/text/get_anchors.cpp
+++ b/src/mbgl/text/get_anchors.cpp
@@ -49,7 +49,7 @@ Anchors resample(const std::vector<Coordinate> &line, const float offset, const
// This has the most effect for short lines in overscaled tiles, since the
// initial offset used in overscaled tiles is calculated to align labels with positions in
// parent tiles instead of placing the label as close to the beginning as possible.
- anchors = std::move(resample(line, distance / 2, spacing, angleWindowSize, maxAngle, labelLength, continuedLine, true));
+ anchors = resample(line, distance / 2, spacing, angleWindowSize, maxAngle, labelLength, continuedLine, true);
}
return anchors;
diff --git a/src/mbgl/util/premultiply.cpp b/src/mbgl/util/premultiply.cpp
index 8a62012251..c7be9a26cd 100644
--- a/src/mbgl/util/premultiply.cpp
+++ b/src/mbgl/util/premultiply.cpp
@@ -23,7 +23,7 @@ PremultipliedImage premultiply(UnassociatedImage&& src) {
b = (b * a + 127) / 255;
}
- return std::move(dst);
+ return dst;
}
UnassociatedImage unpremultiply(PremultipliedImage&& src) {
@@ -46,7 +46,7 @@ UnassociatedImage unpremultiply(PremultipliedImage&& src) {
}
}
- return std::move(dst);
+ return dst;
}
}
diff --git a/test/api/annotations.cpp b/test/api/annotations.cpp
index 5c4e201fd7..d944887f20 100644
--- a/test/api/annotations.cpp
+++ b/test/api/annotations.cpp
@@ -36,7 +36,7 @@ PremultipliedImage render(Map& map) {
map.renderStill([&](std::exception_ptr, PremultipliedImage&& image) {
promise.set_value(std::move(image));
});
- return std::move(promise.get_future().get());
+ return promise.get_future().get();
}
void checkRendering(Map& map, const char * name) {
diff --git a/test/api/repeated_render.cpp b/test/api/repeated_render.cpp
index d92dcf2909..d3d3926a49 100644
--- a/test/api/repeated_render.cpp
+++ b/test/api/repeated_render.cpp
@@ -33,7 +33,7 @@ TEST(API, RepeatedRender) {
map.renderStill([&promise](std::exception_ptr, PremultipliedImage&& image) {
promise.set_value(std::move(image));
});
- auto result = std::move(promise.get_future().get());
+ auto result = promise.get_future().get();
ASSERT_EQ(256, result.width);
ASSERT_EQ(512, result.height);
util::write_file("test/fixtures/api/1.png", encodePNG(result));
@@ -45,7 +45,7 @@ TEST(API, RepeatedRender) {
map.renderStill([&promise](std::exception_ptr, PremultipliedImage&& image) {
promise.set_value(std::move(image));
});
- auto result = std::move(promise.get_future().get());
+ auto result = promise.get_future().get();
ASSERT_EQ(256, result.width);
ASSERT_EQ(512, result.height);
util::write_file("test/fixtures/api/2.png", encodePNG(result));
diff --git a/test/fixtures/mock_file_source.cpp b/test/fixtures/mock_file_source.cpp
index 021ddfa8df..7b4ca82e04 100644
--- a/test/fixtures/mock_file_source.cpp
+++ b/test/fixtures/mock_file_source.cpp
@@ -67,7 +67,7 @@ void MockFileSource::Impl::replyWithSuccess(Resource resource, Callback callback
Response res;
try {
- res.data = std::make_shared<const std::string>(std::move(util::read_file(resource.url)));
+ res.data = std::make_shared<const std::string>(util::read_file(resource.url));
} catch (const std::exception& err) {
res.error = std::make_unique<Response::Error>(Response::Error::Reason::Other, err.what());
}
@@ -103,7 +103,7 @@ void MockFileSource::Impl::replyWithCorruptedData(Resource resource, Callback ca
}
Response res;
- auto data = std::make_shared<std::string>(std::move(util::read_file(resource.url)));
+ auto data = std::make_shared<std::string>(util::read_file(resource.url));
data->insert(0, "CORRUPTED");
res.data = std::move(data);
callback(res);