mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-06 04:24:29 +00:00
Fixed failing is_finite tests on the latest clang
Signed-off-by: Alexander Borsuk <me@alex.bio>
This commit is contained in:
committed by
Konstantin Pastbin
parent
8fe788c98d
commit
82133c5743
@@ -7,7 +7,6 @@
|
||||
#include "base/assert.hpp"
|
||||
#include "base/bits.hpp"
|
||||
#include "base/logging.hpp"
|
||||
#include "base/macros.hpp"
|
||||
#include "base/math.hpp"
|
||||
#include "base/string_utils.hpp"
|
||||
|
||||
@@ -193,8 +192,8 @@ double MpsToUnits(double metersPerSecond, Units units)
|
||||
{
|
||||
switch (units)
|
||||
{
|
||||
case Units::Imperial: return KmphToMiph(MpsToKmph(metersPerSecond)); break;
|
||||
case Units::Metric: return MpsToKmph(metersPerSecond); break;
|
||||
case Units::Imperial: return KmphToMiph(MpsToKmph(metersPerSecond));
|
||||
case Units::Metric: return MpsToKmph(metersPerSecond);
|
||||
}
|
||||
UNREACHABLE();
|
||||
}
|
||||
@@ -235,8 +234,6 @@ std::string FormatOsmLink(double lat, double lon, int zoom)
|
||||
|
||||
bool OSMDistanceToMeters(std::string const & osmRawValue, double & outMeters)
|
||||
{
|
||||
using strings::is_finite;
|
||||
|
||||
char * stop;
|
||||
char const * s = osmRawValue.c_str();
|
||||
outMeters = strtod(s, &stop);
|
||||
@@ -245,7 +242,7 @@ bool OSMDistanceToMeters(std::string const & osmRawValue, double & outMeters)
|
||||
if (s == stop)
|
||||
return false;
|
||||
|
||||
if (!is_finite(outMeters))
|
||||
if (!math::is_finite(outMeters))
|
||||
return false;
|
||||
|
||||
switch (*stop)
|
||||
@@ -259,7 +256,7 @@ bool OSMDistanceToMeters(std::string const & osmRawValue, double & outMeters)
|
||||
outMeters = FeetToMeters(outMeters);
|
||||
s = stop + 1;
|
||||
double const inches = strtod(s, &stop);
|
||||
if (s != stop && *stop == '"' && is_finite(inches))
|
||||
if (s != stop && *stop == '"' && math::is_finite(inches))
|
||||
outMeters += InchesToMeters(inches);
|
||||
|
||||
return true;
|
||||
@@ -273,7 +270,7 @@ bool OSMDistanceToMeters(std::string const & osmRawValue, double & outMeters)
|
||||
{
|
||||
s = stop + 1;
|
||||
double const newValue = strtod(s, &stop);
|
||||
if (s != stop && is_finite(newValue))
|
||||
if (s != stop && math::is_finite(newValue))
|
||||
outMeters = newValue;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -31,7 +31,7 @@ inline double NauticalMilesToMeters(double nmi) { return nmi * 1852; }
|
||||
inline double constexpr KmphToMps(double kmph) { return kmph * 1000 / 3600; }
|
||||
|
||||
double ToSpeedKmPH(double speed, Units units);
|
||||
double MpsToUnits(double mps, Units units);
|
||||
double MpsToUnits(double metersPerSecond, Units units);
|
||||
|
||||
/// @return Speed value in km/h for Metric and in mph for Imperial.
|
||||
int FormatSpeed(double metersPerSecond, Units units);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "geometry/any_rect2d.hpp"
|
||||
#include "geometry/rect2d.hpp"
|
||||
|
||||
#include "base/string_utils.hpp"
|
||||
#include "base/math.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
@@ -58,7 +58,7 @@ bool FromStringArray(string const & s, T(&arr)[N])
|
||||
size_t count = 0;
|
||||
while (count < N && in >> arr[count])
|
||||
{
|
||||
if (!strings::is_finite(arr[count]))
|
||||
if (!math::is_finite(arr[count]))
|
||||
return false;
|
||||
++count;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user