Skip to content

Commit

Permalink
Fix build issue of external code including gdal_priv.h with MSVC (mas…
Browse files Browse the repository at this point in the history
…ter only)

MSVC complains about "use of undefined type 'GDALDoublePointsCache'"
since presumably it tries to locate the destructor of
GDALDoublePointsCache, to which it doesn't have access
  • Loading branch information
rouault committed Sep 10, 2024
1 parent 54bec3d commit 515fbf0
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 515fbf0

Please sign in to comment.