SHA256
1
0
forked from pool/kseexpr
kseexpr/Fix-possible-compiler-error.patch

56 lines
2.2 KiB
Diff
Raw Normal View History

From 2d20eb59a09d16cb37f1cc58c916af22c71107c0 Mon Sep 17 00:00:00 2001
From: Wolfgang Bauer <wbauer@tmo.at>
Date: Wed, 13 Jan 2021 13:33:05 +0100
Subject: [PATCH] Fix possible compiler error
`KSeExpr::Utils::parseRangeComment()` is called with `float` parameters
from other parts of the code.
But `float_t` is not necessarily the same as `float` (the standard
defines it as "floating type at least as wide as float").
Worse, it may actually be the same as `double_t`, for which
`KSeExpr::Utils::parseRangeComment()` has an overload as well.
On openSUSE Tumbleweed i586 in particular, both are defined to `long
double`, which means that both overloads are actually the same resulting
in compiler errors.
To avoid the problem, change `float_t` to `float` in the function
signature.
BUG: 431436
---
src/KSeExprUI/Utils.cpp | 2 +-
src/KSeExprUI/Utils.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/KSeExprUI/Utils.cpp b/src/KSeExprUI/Utils.cpp
index ac42022..f23fdbd 100644
--- a/src/KSeExprUI/Utils.cpp
+++ b/src/KSeExprUI/Utils.cpp
@@ -34,7 +34,7 @@ bool KSeExpr::Utils::parseRangeComment(const std::string &comment, double_t &fro
return false;
}
-bool KSeExpr::Utils::parseRangeComment(const std::string &comment, float_t &from, float_t &to)
+bool KSeExpr::Utils::parseRangeComment(const std::string &comment, float &from, float &to)
{
if (comment.find_first_of('#') != 0) {
return false;
diff --git a/src/KSeExprUI/Utils.h b/src/KSeExprUI/Utils.h
index 39f5c2a..a82b699 100644
--- a/src/KSeExprUI/Utils.h
+++ b/src/KSeExprUI/Utils.h
@@ -11,7 +11,7 @@ namespace KSeExpr
namespace Utils
{
bool parseRangeComment(const std::string &comment, double_t &from, double_t &to);
- bool parseRangeComment(const std::string &comment, float_t &from, float_t &to);
+ bool parseRangeComment(const std::string &comment, float &from, float &to);
bool parseRangeComment(const std::string &comment, int32_t &from, int32_t &to);
bool parseTypeNameComment(const std::string &comment, std::string &type, std::string &name);
bool parseLabelComment(const std::string &comment, std::string &label);
--
2.26.2