Skip to content

Commit

Permalink
GDALBufferHasOnlyNoData() / GTiff SPARSE_OK=YES: recognize negative f…
Browse files Browse the repository at this point in the history
…loating point 0 as 0 (fixes OSGeo#8025)
  • Loading branch information
rouault committed Jul 4, 2023
1 parent f11a55b commit 4724959
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion gcore/rasterio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5110,7 +5110,10 @@ bool GDALBufferHasOnlyNoData(const void *pBuffer, double dfNoDataValue,
#else
typedef std::uint32_t WordType;
#endif
if (dfNoDataValue == 0.0 && nWidth == nLineStride)
if (dfNoDataValue == 0.0 && nWidth == nLineStride &&
// Do not use this optimized code path for floating point numbers,
// as it can't detect negative zero.
nSampleFormat != GSF_FLOATING_POINT)
{
const GByte *pabyBuffer = static_cast<const GByte *>(pBuffer);
const size_t nSize =
Expand Down

0 comments on commit 4724959

Please sign in to comment.