From 196f8550298a9e05b4c9739a6022f81349473d13 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 8 Jan 2025 20:00:00 +0100 Subject: [PATCH] Fix Coverity warnings --- apps/gdalalg_abstract_pipeline.h | 4 ++-- frmts/libertiff/libertiffdataset.cpp | 11 +++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/apps/gdalalg_abstract_pipeline.h b/apps/gdalalg_abstract_pipeline.h index 5ac5a2ea5c85..f2eb0589a8a4 100644 --- a/apps/gdalalg_abstract_pipeline.h +++ b/apps/gdalalg_abstract_pipeline.h @@ -218,14 +218,14 @@ template std::string GDALAbstractPipelineAlgorithm::GetUsageAsJSON() const { CPLJSONDocument oDoc; - oDoc.LoadMemory(GDALAlgorithm::GetUsageAsJSON()); + CPL_IGNORE_RET_VAL(oDoc.LoadMemory(GDALAlgorithm::GetUsageAsJSON())); CPLJSONArray jPipelineSteps; for (const std::string &name : m_stepRegistry.GetNames()) { auto alg = GetStepAlg(name); CPLJSONDocument oStepDoc; - oStepDoc.LoadMemory(alg->GetUsageAsJSON()); + CPL_IGNORE_RET_VAL(oStepDoc.LoadMemory(alg->GetUsageAsJSON())); jPipelineSteps.Add(oStepDoc.GetRoot()); } oDoc.GetRoot().Add("pipeline_algorithms", jPipelineSteps); diff --git a/frmts/libertiff/libertiffdataset.cpp b/frmts/libertiff/libertiffdataset.cpp index 6e88b572423b..e4bb50be16bd 100644 --- a/frmts/libertiff/libertiffdataset.cpp +++ b/frmts/libertiff/libertiffdataset.cpp @@ -58,16 +58,11 @@ struct LIBERTIFFDatasetFileReader final : public LIBERTIFF_NS::FileReader uint64_t size() const override { - // coverity[missing_lock,lock_evasion] + std::lock_guard oLock(m_oMutex); if (m_nFileSize == 0) { - std::lock_guard oLock(m_oMutex); - // cppcheck-suppress identicalInnerCondition - if (m_nFileSize == 0) - { - m_fp->Seek(0, SEEK_END); - m_nFileSize = m_fp->Tell(); - } + m_fp->Seek(0, SEEK_END); + m_nFileSize = m_fp->Tell(); } return m_nFileSize; }