Skip to content

Commit ab06e90

Browse files
committed
Fix Coverity Scan warnings
1 parent 1ff139b commit ab06e90

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

autotest/cpp/test_ogr.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ void testSpatialReferenceLeakOnCopy(OGRSpatialReference *poSRS)
7171
nLastCount = nCurCount;
7272

7373
value3 = value;
74-
value.getSpatialReference(); // avoid Coverity Scan warning
74+
// avoid Coverity Scan warning about above assignment being better
75+
// replaced with a move.
76+
EXPECT_NE(value.getSpatialReference(), nullptr);
7577
ASSERT_EQ(nLastCount, poSRS->GetReferenceCount());
7678
}
7779
ASSERT_EQ(1, poSRS->GetReferenceCount());
@@ -330,7 +332,8 @@ TEST_F(test_ogr, OGRGeometryCollection_copy_constructor_illegal_use)
330332
{
331333
CPLErrorHandlerPusher oPusher(CPLQuietErrorHandler);
332334
*mp_as_gc = gc;
333-
gc.getSpatialReference(); // avoid Coverity Scan warning
335+
// avoid Coverity Scan warning
336+
EXPECT_EQ(gc.getSpatialReference(), nullptr);
334337
}
335338
EXPECT_STREQ(CPLGetLastErrorMsg(),
336339
"Illegal use of OGRGeometryCollection::operator=(): trying to "
@@ -364,7 +367,8 @@ TEST_F(test_ogr, OGRCurvePolygon_copy_constructor_illegal_use)
364367
{
365368
CPLErrorHandlerPusher oPusher(CPLQuietErrorHandler);
366369
*poly_as_cp = cp;
367-
cp.getSpatialReference(); // avoid Coverity Scan warning
370+
// avoid Coverity Scan warning
371+
EXPECT_EQ(cp.getSpatialReference(), nullptr);
368372
}
369373
EXPECT_STREQ(CPLGetLastErrorMsg(),
370374
"Illegal use of OGRCurvePolygon::operator=(): trying to "

0 commit comments

Comments
 (0)