diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f7eccafde6b87eec5bfb4e128d352af8a6c5630..4ec9430b34e55ff21a3c576274da290691f64c4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ release. - Fixed bugs in downloadIsisData script [#5024](https://github.com/USGS-Astrogeology/ISIS3/issues/5024) - Fixed shadow shifting image by 2 pixels to the upper left corner. [#5035](https://github.com/USGS-Astrogeology/ISIS3/issues/5035) +- Fixed compiler warnings on ubuntu [#4911](https://github.com/USGS-Astrogeology/ISIS3/issues/4911) ## [7.1.0] - 2022-07-27 diff --git a/isis/src/base/apps/isisimport/CassiniImportUtils.h b/isis/src/base/apps/isisimport/CassiniImportUtils.h index 6ef28005325834b9cdfd2d20e94dafc3aa251a25..21737980358e3d49a119c8a88486c6a9bd6fcf3b 100644 --- a/isis/src/base/apps/isisimport/CassiniImportUtils.h +++ b/isis/src/base/apps/isisimport/CassiniImportUtils.h @@ -39,7 +39,7 @@ namespace Isis { */ CassiniIssFixDnFunctor(PvlKeyword &stretchPairs, QString dataConversionType, int validMax) { m_stretch = Stretch(); - for (size_t i = 0; i < stretchPairs.size(); i+=2) { + for (size_t i = 0; i < (size_t)stretchPairs.size(); i+=2) { m_stretch.AddPair(toDouble(stretchPairs[i]), toDouble(stretchPairs[i + 1])); } @@ -192,7 +192,7 @@ namespace Isis { //Adjust Table-encoded values from 8 bit back to 12 bit. PvlKeyword stretchPairs = translation["stretchPairs"]; Stretch stretch; - for (size_t i = 0; i < stretchPairs.size(); i+=2) { + for (size_t i = 0; i < (size_t)stretchPairs.size(); i+=2) { stretch.AddPair(toDouble(stretchPairs[i]), toDouble(stretchPairs[i + 1])); } diff --git a/isis/src/mgs/apps/mocuncompress/image_io.cpp b/isis/src/mgs/apps/mocuncompress/image_io.cpp index 744459ec84f6e129c2ed391d31087540341fc96c..34ad7e36e5a6352325da4f4041b980dea910a948 100644 --- a/isis/src/mgs/apps/mocuncompress/image_io.cpp +++ b/isis/src/mgs/apps/mocuncompress/image_io.cpp @@ -100,7 +100,7 @@ void image_open(char *filename, struct image_header *header, char *mode) header->bpe = hdr_buf[3]; if(header->bpe == 0) header->bpe = 8; - text_ptr = (char *) malloc(strlen(((char *)hdr_buf) + IMAGE_LABEL_OFFSET)); + text_ptr = (char *) malloc(strlen(((char *)hdr_buf) + IMAGE_LABEL_OFFSET)+1); strcpy(text_ptr, (char *)(((char *)hdr_buf) + IMAGE_LABEL_OFFSET)); header->label = text_ptr; header->fd = fd; diff --git a/isis/src/mro/apps/hical/hical.cpp b/isis/src/mro/apps/hical/hical.cpp index 8a43d8e7ca8066b59e5c7da0fd7a9a2321a189f4..2e6444a94755fa2fdae771a73bf1771c43511617 100644 --- a/isis/src/mro/apps/hical/hical.cpp +++ b/isis/src/mro/apps/hical/hical.cpp @@ -207,7 +207,7 @@ namespace Isis { zdr.Dump(hiconf.getMatrixSource("DumpModuleFile",hiprof)); } } - catch(IException e){ + catch(IException &e){ if (hiprof.exists("Fallback") && IsTrueValue(hiprof, "Fallback")){ zdrFallback = true; calVars->add(hiconf.getProfileName(), HiVector(nsamps, 0.0)); diff --git a/isis/tests/FunctionalTestsCkwriter.cpp b/isis/tests/FunctionalTestsCkwriter.cpp index dea94624a31bdc0aa33fe51fdc9ead0f85d5167c..248965dd6c21915e0945873cef997a72fea53b66 100644 --- a/isis/tests/FunctionalTestsCkwriter.cpp +++ b/isis/tests/FunctionalTestsCkwriter.cpp @@ -69,12 +69,12 @@ TEST_F(DefaultCube, FunctionalTestCkwriterDefault) { ASSERT_EQ(newKernelRotation->cacheSize(), originalRotation->cacheSize()); - for (int i = 0; i < newKernelRotation->TimeBasedMatrix().size(); i++) { + for (size_t i = 0; i < newKernelRotation->TimeBasedMatrix().size(); i++) { ASSERT_DOUBLE_EQ(newKernelRotation->TimeBasedMatrix()[i], originalRotation->TimeBasedMatrix()[i]); } - for (int i = 0; i < newKernelRotation->AngularVelocity().size(); i++) { + for (size_t i = 0; i < newKernelRotation->AngularVelocity().size(); i++) { ASSERT_DOUBLE_EQ(newKernelRotation->AngularVelocity()[i], originalRotation->AngularVelocity()[i]); } @@ -138,12 +138,12 @@ TEST_F(DefaultCube, FunctionalTestCkwriterFromlist) { ASSERT_EQ(newKernelRotation->cacheSize(), originalRotation->cacheSize()); - for (int i = 0; i < newKernelRotation->TimeBasedMatrix().size(); i++) { + for (size_t i = 0; i < newKernelRotation->TimeBasedMatrix().size(); i++) { ASSERT_DOUBLE_EQ(newKernelRotation->TimeBasedMatrix()[i], originalRotation->TimeBasedMatrix()[i]); } - for (int i = 0; i < newKernelRotation->AngularVelocity().size(); i++) { + for (size_t i = 0; i < newKernelRotation->AngularVelocity().size(); i++) { ASSERT_DOUBLE_EQ(newKernelRotation->AngularVelocity()[i], originalRotation->AngularVelocity()[i]); } diff --git a/isis/tests/FunctionalTestsFootprintinit.cpp b/isis/tests/FunctionalTestsFootprintinit.cpp index 1c23a050b7d7d1227ddbe5de486308c6a8de0c0f..bc218f54f14d6704ade70b8722c5fdb206e85ef0 100644 --- a/isis/tests/FunctionalTestsFootprintinit.cpp +++ b/isis/tests/FunctionalTestsFootprintinit.cpp @@ -38,7 +38,7 @@ TEST_F(DefaultCube, FunctionalTestFootprintinitDefault) { std::vector<double> lats = {9.928502, 9.928502, 10.434859, 10.434859, 9.928502}; geos::geom::CoordinateArraySequence coordArray = geos::geom::CoordinateArraySequence(*(boundary->getCoordinates())); - for (int i = 0; i < coordArray.getSize(); i++) { + for (size_t i = 0; i < coordArray.getSize(); i++) { EXPECT_NEAR(lons[i], coordArray.getAt(i).x, 1e-6); EXPECT_NEAR(lats[i], coordArray.getAt(i).y, 1e-6); } @@ -60,7 +60,7 @@ TEST_F(DefaultCube, FunctionalTestFootprintinitLincSinc) { std::vector<double> lats = {9.928500, 9.928500, 10.434861, 10.434861, 9.928500}; geos::geom::CoordinateArraySequence coordArray = geos::geom::CoordinateArraySequence(*(boundary->getCoordinates())); - for (int i = 0; i < coordArray.getSize(); i++) { + for (size_t i = 0; i < coordArray.getSize(); i++) { EXPECT_NEAR(lons[i], coordArray.getAt(i).x, 1e-6); EXPECT_NEAR(lats[i], coordArray.getAt(i).y, 1e-6); } @@ -82,7 +82,7 @@ TEST_F(DefaultCube, FunctionalTestFootprintinitVertices) { std::vector<double> lats = {9.928456, 9.928456, 10.434903, 10.434903, 9.928456}; geos::geom::CoordinateArraySequence coordArray = geos::geom::CoordinateArraySequence(*(boundary->getCoordinates())); - for (int i = 0; i < coordArray.getSize(); i++) { + for (size_t i = 0; i < coordArray.getSize(); i++) { EXPECT_NEAR(lons[i], coordArray.getAt(i).x, 1e-6); EXPECT_NEAR(lats[i], coordArray.getAt(i).y, 1e-6); } @@ -104,7 +104,7 @@ TEST_F(DefaultCube, FunctionalTestFootprintinitCamera) { std::vector<double> lats = {9.924583, 9.924583, 10.329275, 10.329275, 9.924583}; geos::geom::CoordinateArraySequence coordArray = geos::geom::CoordinateArraySequence(*(boundary->getCoordinates())); - for (int i = 0; i < coordArray.getSize(); i++) { + for (size_t i = 0; i < coordArray.getSize(); i++) { EXPECT_NEAR(lons[i], coordArray.getAt(i).x, 1e-6); EXPECT_NEAR(lats[i], coordArray.getAt(i).y, 1e-6); } @@ -126,7 +126,7 @@ TEST_F(DefaultCube, FunctionalTestFootprintinitTestXY) { std::vector<double> lats = {9.928502, 9.928502, 10.434859, 10.434859, 9.928502}; geos::geom::CoordinateArraySequence coordArray = geos::geom::CoordinateArraySequence(*(boundary->getCoordinates())); - for (int i = 0; i < coordArray.getSize(); i++) { + for (size_t i = 0; i < coordArray.getSize(); i++) { EXPECT_NEAR(lons[i], coordArray.getAt(i).x, 1e-6); EXPECT_NEAR(lats[i], coordArray.getAt(i).y, 1e-6); } @@ -154,7 +154,7 @@ TEST_F(DefaultCube, FunctionalTestFootprintinitPrecision) { std::vector<double> lats = {9.928502, 9.928502, 10.434859, 10.434859, 9.928502}; geos::geom::CoordinateArraySequence coordArray = geos::geom::CoordinateArraySequence(*(boundary->getCoordinates())); - for (int i = 0; i < coordArray.getSize(); i++) { + for (size_t i = 0; i < coordArray.getSize(); i++) { EXPECT_NEAR(lons[i], coordArray.getAt(i).x, 1e-6); EXPECT_NEAR(lats[i], coordArray.getAt(i).y, 1e-6); } diff --git a/isis/tests/FunctionalTestsJigsaw.cpp b/isis/tests/FunctionalTestsJigsaw.cpp index c2e47e561a2979c1d5ffa4dc176e24db0673eb25..fbcecb66cd08479ee12c834ca00f5806438efd5d 100644 --- a/isis/tests/FunctionalTestsJigsaw.cpp +++ b/isis/tests/FunctionalTestsJigsaw.cpp @@ -82,7 +82,7 @@ TEST_F(ApolloNetwork, FunctionalTestJigsawApollo) { EXPECT_EQ(numRows-3, points.length()); - ControlPoint* outputPoint; + ControlPoint* outputPoint = nullptr; for (int i=3; i < numRows; i++) { csvLine = line.getRow(i); EXPECT_NO_THROW({ @@ -174,10 +174,10 @@ TEST_F(ApolloNetwork, FunctionalTestJigsawApollo) { ControlMeasure* measure; for (int i=3; i < numRows; i++) { csvLine = line.getRow(i); - EXPECT_NO_THROW({ + ASSERT_NO_THROW({ outputPoint = outputNet.GetPoint(csvLine[0]); }) << "Point in residuals.csv is not present in output network."; - EXPECT_NO_THROW({ + ASSERT_NO_THROW({ measure = outputPoint->GetMeasure(csvLine[2]); }) << "Point in residuals.csv is not present in output network."; // Compare sample, line, residuals diff --git a/isis/tests/FunctionalTestsSpkwriter.cpp b/isis/tests/FunctionalTestsSpkwriter.cpp index 859a15b5085bea8dd49bcdf6744b453072a29d9b..e581ff21b152c7d469e112822d8f2f665489a7ed 100644 --- a/isis/tests/FunctionalTestsSpkwriter.cpp +++ b/isis/tests/FunctionalTestsSpkwriter.cpp @@ -52,10 +52,8 @@ TEST_F(DefaultCube, FunctionalTestSpkwriterDefault) { newKernelCube.reopen("rw"); - Camera *newCamera = nullptr; - try { - newCamera = newKernelCube.camera(); + newKernelCube.camera(); } catch(IException &e) { FAIL() << "Unable to generate camera with new spk kernel: " << e.toString().toStdString().c_str() << std::endl; } @@ -111,10 +109,8 @@ TEST_F(DefaultCube, FunctionalTestSpkwriterFromlist) { newKernelCube.reopen("rw"); - Camera *newCamera = nullptr; - try { - newCamera = newKernelCube.camera(); + newKernelCube.camera(); } catch(IException &e) { FAIL() << "Unable to generate camera with new spk kernel: " << e.toString().toStdString().c_str() << std::endl; } diff --git a/isis/tests/PvlKeywordTests.cpp b/isis/tests/PvlKeywordTests.cpp index d4d474e4c67683eaabc90140b15498c55700b78b..b06d5c16dd14f011bfe1d3029513c4d1322eea18 100644 --- a/isis/tests/PvlKeywordTests.cpp +++ b/isis/tests/PvlKeywordTests.cpp @@ -431,13 +431,13 @@ void comparePvlKeywords(PvlKeyword pvlKeyword1, PvlKeyword pvlKeyword2) EXPECT_TRUE(PvlKeyword::stringEqual(pvlKeyword1.name(), pvlKeyword2.name())); ASSERT_EQ(pvlKeyword1.comments(), pvlKeyword2.comments()); - for (unsigned int comment = 0; comment < pvlKeyword1.comments(); comment++) + for (unsigned int comment = 0; comment < (unsigned int)pvlKeyword1.comments(); comment++) { EXPECT_TRUE(PvlKeyword::stringEqual(pvlKeyword1.comment(comment), pvlKeyword2.comment(comment))); } ASSERT_EQ(pvlKeyword1.size(), pvlKeyword2.size()); - for (unsigned int value = 0; value < pvlKeyword1.size(); value++) + for (unsigned int value = 0; value < (unsigned int)pvlKeyword1.size(); value++) { EXPECT_TRUE(PvlKeyword::stringEqual(pvlKeyword1[value], pvlKeyword2[value])); EXPECT_TRUE(PvlKeyword::stringEqual(pvlKeyword1.unit(value), pvlKeyword2.unit(value)));