Skip to content

Commit

Permalink
Merge pull request #10762 from rouault/GDALDoublePointsCache
Browse files Browse the repository at this point in the history
Fix build issue of external code including gdal_priv.h with MSVC (master only)
  • Loading branch information
rouault authored Sep 11, 2024
2 parents 912dcf2 + 515fbf0 commit 1e48b77
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gcore/gdal_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1625,7 +1625,7 @@ class CPL_DLL GDALRasterBand : public GDALMajorObject
void InitRWLock();
void SetValidPercent(GUIntBig nSampleCount, GUIntBig nValidCount);

mutable std::unique_ptr<GDALDoublePointsCache> m_oPointsCache{};
mutable GDALDoublePointsCache *m_poPointsCache = nullptr;

//! @endcond

Expand Down
8 changes: 5 additions & 3 deletions gcore/gdalrasterband.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ GDALRasterBand::~GDALRasterBand()

InvalidateMaskBand();
nBand = -nBand;

delete m_poPointsCache;
}

/************************************************************************/
Expand Down Expand Up @@ -9398,11 +9400,11 @@ CPLErr GDALRasterBand::InterpolateAtPoint(double dfPixel, double dfLine,
}

GDALRasterBand *pBand = const_cast<GDALRasterBand *>(this);
if (!m_oPointsCache)
m_oPointsCache = std::make_unique<GDALDoublePointsCache>();
if (!m_poPointsCache)
m_poPointsCache = new GDALDoublePointsCache();

const bool res =
GDALInterpolateAtPoint(pBand, eInterpolation, m_oPointsCache->cache,
GDALInterpolateAtPoint(pBand, eInterpolation, m_poPointsCache->cache,
dfPixel, dfLine, pdfRealValue, pdfImagValue);

return res ? CE_None : CE_Failure;
Expand Down

0 comments on commit 1e48b77

Please sign in to comment.