Skip to content

Commit a4c8386

Browse files
committed
[sipify] Replace std::numeric_limits with old style DBL_MAX/etc
1 parent 47e7a10 commit a4c8386

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

python/core/auto_generated/processing/qgsprocessingparameters.sip.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,8 +1264,8 @@ to determine what units the distance values are in.
12641264
const QVariant &defaultValue = QVariant(),
12651265
const QString &parentParameterName = QString(),
12661266
bool optional = false,
1267-
double minValue = std::numeric_limits<double>::lowest() + 1,
1268-
double maxValue = std::numeric_limits<double>::max() );
1267+
double minValue = -DBL_MAX + 1,
1268+
double maxValue = DBL_MAX );
12691269
%Docstring
12701270
Constructor for QgsProcessingParameterDistance.
12711271
%End

python/core/auto_generated/qgis.sip.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Returns a string representation of a double
100100
:param precision: number of decimal places to retain
101101
%End
102102

103-
bool qgsDoubleNear( double a, double b, double epsilon = 4 * std::numeric_limits<double>::epsilon() );
103+
bool qgsDoubleNear( double a, double b, double epsilon = 4 * DBL_EPSILON );
104104
%Docstring
105105
Compare two doubles (but allow some difference)
106106

scripts/sipify.pl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,14 @@ sub fix_annotations {
432432
return $line;
433433
}
434434

435+
sub fix_constants {
436+
my $line = $_[0];
437+
$line =~ s/\bstd::numeric_limits<double>::max\(\)/DBL_MAX/;
438+
$line =~ s/\bstd::numeric_limits<double>::lowest\(\)/-DBL_MAX/;
439+
$line =~ s/\bstd::numeric_limits<double>::epsilon\(\)/DBL_EPSILON/;
440+
return $line;
441+
}
442+
435443
# detect a comment block, return 1 if found
436444
# if STRICT comment block shall begin at beginning of line (no code in front)
437445
sub detect_comment_block{
@@ -1087,6 +1095,7 @@ sub detect_non_method_member{
10871095
$IS_OVERRIDE = 0;
10881096
}
10891097

1098+
$LINE = fix_constants($LINE);
10901099
$LINE = fix_annotations($LINE);
10911100

10921101
# fix astyle placing space after % character

0 commit comments

Comments
 (0)