Skip to content

Commit c5c3a86

Browse files
committed
Coverity Scan fixes
1 parent 784a8ea commit c5c3a86

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

src/iso19111/c_api.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ PJ *pj_obj_create(PJ_CONTEXT *ctx, const BaseObjectNNPtr &objIn) {
217217
? ctx->get_cpp_context()->getDatabaseContextIfOpen()
218218
: nullptr;
219219
auto formatter = PROJStringFormatter::create(
220-
PROJStringFormatter::Convention::PROJ_5, dbContext);
220+
PROJStringFormatter::Convention::PROJ_5,
221+
std::move(dbContext));
221222
auto projString = coordop->exportToPROJString(formatter.get());
222223
const bool defer_grid_opening_backup = ctx->defer_grid_opening;
223224
if (!defer_grid_opening_backup &&

src/iso19111/common.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,7 @@ UnitOfMeasure &UnitOfMeasure::operator=(const UnitOfMeasure &other) {
119119
// ---------------------------------------------------------------------------
120120

121121
//! @cond Doxygen_Suppress
122-
UnitOfMeasure &UnitOfMeasure::operator=(UnitOfMeasure &&other) {
123-
*d = std::move(*(other.d));
124-
other.d = nullptr;
125-
BaseObject::operator=(std::move(static_cast<BaseObject &&>(other)));
126-
return *this;
127-
}
122+
UnitOfMeasure &UnitOfMeasure::operator=(UnitOfMeasure &&) = default;
128123
//! @endcond
129124

130125
// ---------------------------------------------------------------------------

test/unit/test_common.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,16 @@ TEST(common, unit_of_measure) {
6767
EXPECT_EQ(Angle(2.5969213, UnitOfMeasure::GRAD)
6868
.convertToUnit(UnitOfMeasure::DEGREE),
6969
2.5969213 / 100.0 * 90.0);
70+
71+
{
72+
UnitOfMeasure myUOM("myUOM", 123);
73+
UnitOfMeasure myUOM_copy;
74+
myUOM_copy = myUOM;
75+
EXPECT_TRUE(myUOM == myUOM_copy);
76+
UnitOfMeasure otherUOM("otherUOM", 456);
77+
otherUOM = std::move(myUOM);
78+
EXPECT_TRUE(otherUOM == myUOM_copy);
79+
}
7080
}
7181

7282
// ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)