[gdal-dev] GDAL/OGR 2.4.1 is released

Greg Troxel gdt at lexort.com
Fri Mar 22 07:12:38 PDT 2019


Even Rouault <even.rouault at spatialys.com> writes:

> On behalf of the GDAL/OGR development team, I am pleased to announce the 
> release of the GDAL/OGR 2.4.1 bug fix version. This adds 52 bug fixes on top 
> of 2.4.0. The C and C++ API and ABI are unchanged.

Sorry I didn't get to test RC1.  Aside from one problem, it built fine
on netbsd-8 amd64, and postgis tests passed using it, so I have updated
pkgsrc.


I got an error (gcc 5.5.0) about fabs not being in std:

ogrlinestring.cpp: In member function 'virtual void OGRSimpleCurve::segmentize(double)':
ogrlinestring.cpp:2554:13: error: 'fabs' is not a member of 'std'
         if( std::fabs(dfSquareDist - dfSquareMaxLength) > 1e-5 * dfSquareMaxLength )
             ^

I did not get this when building 2.4.0 on the same system (but I did do
a tiny update along the branch, and am rechecking 2.4.0).

I'm not 100% clear on the C++ standard; cmath has some ifdefs I don't
understand:

#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
  inline _GLIBCXX_CONSTEXPR float
  fabs(float __x)
  { return __builtin_fabsf(__x); }

  inline _GLIBCXX_CONSTEXPR long double
  fabs(long double __x)
  { return __builtin_fabsl(__x); }
#endif
      
and searching about this leads to some complicated discussion.  In
general, it seems std::abs is required to be overloaded for float and
that's the recommended usage, but I also see that some prefer std::fabs
for arguments know to be floats.

I applied the following patch for now; I suspect it's not right longer
term.

It's of course possible my g++ 5 headers are broken, but I would expect
this may have shown up elsewhere and been fixed by now if so.


Perhaps I should have switched to std::abs instead.



--- ogr/ogrlinestring.cpp.orig	2019-03-15 12:35:19.000000000 +0000
+++ ogr/ogrlinestring.cpp
@@ -2551,7 +2551,7 @@ void OGRSimpleCurve::segmentize( double 
         const double dfX = paoPoints[i+1].x - paoPoints[i].x;
         const double dfY = paoPoints[i+1].y - paoPoints[i].y;
         const double dfSquareDist = dfX * dfX + dfY * dfY;
-        if( std::fabs(dfSquareDist - dfSquareMaxLength) > 1e-5 * dfSquareMaxLength )
+        if( fabs(dfSquareDist - dfSquareMaxLength) > 1e-5 * dfSquareMaxLength )
         {
             const double dfIntermediatePoints =
                 floor(sqrt(dfSquareDist / dfSquareMaxLength) - 1e-2);




More information about the gdal-dev mailing list