@@ -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