diff --git a/frmts/libertiff/libertiffdataset.cpp b/frmts/libertiff/libertiffdataset.cpp index df1a276877c8..099ecad3abc0 100644 --- a/frmts/libertiff/libertiffdataset.cpp +++ b/frmts/libertiff/libertiffdataset.cpp @@ -58,6 +58,7 @@ struct LIBERTIFFDatasetFileReader final : public LIBERTIFF_NS::FileReader uint64_t size() const override { + // coverity[missing_lock,lock_evasion] if (m_nFileSize == 0) { std::lock_guard oLock(m_oMutex); @@ -342,6 +343,7 @@ class LIBERTIFFBand final : public GDALPamRasterBand CPLDebug("LIBERTIFF", "GetLockedBlockRef() called"); } std::lock_guard oLock(m_oMutexBlockCache); + // coverity[sleep] return GDALRasterBand::GetLockedBlockRef(nXBlockOff, nYBlockOff, bJustInitialize); } @@ -1246,7 +1248,7 @@ bool LIBERTIFFDataset::ReadBlock(GByte *pabyBlockData, int nBlockXOff, if constexpr (sizeof(size_t) < sizeof(uint64_t)) { - if (size64 > std::numeric_limits::max()) + if (size64 > std::numeric_limits::max() - 1) { CPLError(CE_Failure, CPLE_NotSupported, "Too large strile"); return false; diff --git a/gcore/gdalalgorithm.cpp b/gcore/gdalalgorithm.cpp index 5fbc3ba7b21f..9f138cf5683a 100644 --- a/gcore/gdalalgorithm.cpp +++ b/gcore/gdalalgorithm.cpp @@ -2258,7 +2258,7 @@ GDALAlgorithm::AddOpenOptionsArg(std::vector *pValue) { auto poDM = GetGDALDriverManager(); auto &datasetValue = inputArg->Get(); - const auto osDSName = datasetValue.GetName(); + const auto &osDSName = datasetValue.GetName(); const std::string osExt = CPLGetExtension(osDSName.c_str()); if (!osExt.empty()) { @@ -2575,7 +2575,7 @@ GDALAlgorithm::AddCreationOptionsArg(std::vector *pValue) { auto poDM = GetGDALDriverManager(); auto &datasetValue = outputArg->Get(); - const auto osDSName = datasetValue.GetName(); + const auto &osDSName = datasetValue.GetName(); const std::string osExt = CPLGetExtension(osDSName.c_str()); if (!osExt.empty()) { @@ -2665,7 +2665,7 @@ GDALAlgorithm::AddLayerCreationOptionsArg(std::vector *pValue) { auto poDM = GetGDALDriverManager(); auto &datasetValue = outputArg->Get(); - const auto osDSName = datasetValue.GetName(); + const auto &osDSName = datasetValue.GetName(); const std::string osExt = CPLGetExtension(osDSName.c_str()); if (!osExt.empty()) { @@ -3247,7 +3247,7 @@ std::string GDALAlgorithm::GetUsageAsJSON() const if (subAlg->m_displayInJSONUsage) { CPLJSONDocument oSubDoc; - oSubDoc.LoadMemory(subAlg->GetUsageAsJSON()); + CPL_IGNORE_RET_VAL(oSubDoc.LoadMemory(subAlg->GetUsageAsJSON())); jSubAlgorithms.Add(oSubDoc.GetRoot()); } } diff --git a/gcore/gdalalgorithm.h b/gcore/gdalalgorithm.h index 44d0a9ecbf73..a42024f971d5 100644 --- a/gcore/gdalalgorithm.h +++ b/gcore/gdalalgorithm.h @@ -1627,7 +1627,7 @@ class CPL_DLL GDALInConstructionAlgorithmArg final : public GDALAlgorithmArg GDALInConstructionAlgorithmArg &SetAutoCompleteFunction( std::function(const std::string &)> f) { - m_autoCompleteFunction = f; + m_autoCompleteFunction = std::move(f); return *this; } diff --git a/gcore/gdalmultidim.cpp b/gcore/gdalmultidim.cpp index cda4be4d99f7..c47f215896bf 100644 --- a/gcore/gdalmultidim.cpp +++ b/gcore/gdalmultidim.cpp @@ -9514,12 +9514,12 @@ GDALDatasetFromArray *GDALDatasetFromArray::Create( BandImageryMetadata &item = aoBandImageryMetadata[iExtraDimIdx]; if (oJsonItem.GetName() == "CENTRAL_WAVELENGTH_UM") { - item.poCentralWavelengthArray = poArray; + item.poCentralWavelengthArray = std::move(poArray); item.dfCentralWavelengthToMicrometer = dfConvToUM; } else { - item.poFWHMArray = poArray; + item.poFWHMArray = std::move(poArray); item.dfFWHMToMicrometer = dfConvToUM; } }