112 lines
4.2 KiB
Diff
112 lines
4.2 KiB
Diff
From 57cffcd02ac70148e21ce982be834876b3df87db Mon Sep 17 00:00:00 2001
|
|
From: HanatoK <summersnow9403@gmail.com>
|
|
Date: Sat, 1 May 2021 01:04:38 -0500
|
|
Subject: [PATCH] Fix FTBFS.
|
|
|
|
Previous boost library (1.75) may implicitly include cmath, but the
|
|
latest version (1.76) does not, so the calls to exp are undefined. This
|
|
commit include cmath in script_translator.cc and table_translator.cc to
|
|
fix the issue (#462).
|
|
---
|
|
src/rime/gear/script_translator.cc | 1 +
|
|
src/rime/gear/table_translator.cc | 1 +
|
|
2 files changed, 2 insertions(+)
|
|
|
|
diff --git a/src/rime/gear/script_translator.cc b/src/rime/gear/script_translator.cc
|
|
index 4a45f05e6..250616593 100644
|
|
--- a/src/rime/gear/script_translator.cc
|
|
+++ b/src/rime/gear/script_translator.cc
|
|
@@ -8,6 +8,7 @@
|
|
//
|
|
#include <algorithm>
|
|
#include <stack>
|
|
+#include <cmath>
|
|
#include <boost/algorithm/string/join.hpp>
|
|
#include <boost/range/adaptor/reversed.hpp>
|
|
#include <rime/composition.h>
|
|
diff --git a/src/rime/gear/table_translator.cc b/src/rime/gear/table_translator.cc
|
|
index 162ac0244..c95e5e24b 100644
|
|
--- a/src/rime/gear/table_translator.cc
|
|
+++ b/src/rime/gear/table_translator.cc
|
|
@@ -6,6 +6,7 @@
|
|
//
|
|
#include <boost/algorithm/string.hpp>
|
|
#include <boost/range/adaptor/reversed.hpp>
|
|
+#include <cmath>
|
|
#include <utf8.h>
|
|
#include <rime/candidate.h>
|
|
#include <rime/common.h>
|
|
From bc589fd45eca349b7ca408f9b85a85474745abb0 Mon Sep 17 00:00:00 2001
|
|
From: Chen Gong <chen.sst@gmail.com>
|
|
Date: Sun, 16 Jan 2022 01:06:29 +0800
|
|
Subject: [PATCH] fix: qualify std::exp after including <cmath>
|
|
|
|
As noted in #462, including <cmath> only guarantees that std::exp is
|
|
declared, so calling exp(double) unqualified is not portable.
|
|
|
|
Squashed commit with a style change to the original PR:
|
|
|
|
commit 8b9d48c0340f3fb82de59a6f7ec71ddfd86a602f
|
|
Author: Chen Gong <chen.sst@gmail.com>
|
|
Date: Sun Jan 16 00:49:47 2022 +0800
|
|
|
|
commit df4fe3ea11e0222426b98e489db36d32856b3361
|
|
Author: Jonathan Wakely <jwakely@redhat.com>
|
|
Date: Tue Aug 10 10:18:38 2021 +0100
|
|
|
|
Closes #476
|
|
---
|
|
src/rime/gear/script_translator.cc | 12 ++++++------
|
|
src/rime/gear/table_translator.cc | 8 ++++----
|
|
2 files changed, 10 insertions(+), 10 deletions(-)
|
|
|
|
diff --git a/src/rime/gear/script_translator.cc b/src/rime/gear/script_translator.cc
|
|
index 250616593..e220aed9c 100644
|
|
--- a/src/rime/gear/script_translator.cc
|
|
+++ b/src/rime/gear/script_translator.cc
|
|
@@ -488,9 +488,9 @@ void ScriptTranslation::PrepareCandidate() {
|
|
start_,
|
|
start_ + user_phrase_code_length,
|
|
entry);
|
|
- cand->set_quality(exp(entry->weight) +
|
|
- translator_->initial_quality() +
|
|
- (IsNormalSpelling() ? 0.5 : -0.5));
|
|
+ cand->set_quality(std::exp(entry->weight) +
|
|
+ translator_->initial_quality() +
|
|
+ (IsNormalSpelling() ? 0.5 : -0.5));
|
|
}
|
|
else if (phrase_code_length > 0) {
|
|
DictEntryIterator& iter = phrase_iter_->second;
|
|
@@ -502,9 +502,9 @@ void ScriptTranslation::PrepareCandidate() {
|
|
start_,
|
|
start_ + phrase_code_length,
|
|
entry);
|
|
- cand->set_quality(exp(entry->weight) +
|
|
- translator_->initial_quality() +
|
|
- (IsNormalSpelling() ? 0 : -1));
|
|
+ cand->set_quality(std::exp(entry->weight) +
|
|
+ translator_->initial_quality() +
|
|
+ (IsNormalSpelling() ? 0 : -1));
|
|
}
|
|
candidate_ = cand;
|
|
}
|
|
diff --git a/src/rime/gear/table_translator.cc b/src/rime/gear/table_translator.cc
|
|
index c95e5e24b..97cfc96e5 100644
|
|
--- a/src/rime/gear/table_translator.cc
|
|
+++ b/src/rime/gear/table_translator.cc
|
|
@@ -81,10 +81,10 @@ an<Candidate> TableTranslation::Peek() {
|
|
if (phrase) {
|
|
phrase->set_comment(comment);
|
|
phrase->set_preedit(preedit_);
|
|
- phrase->set_quality(exp(e->weight) +
|
|
- options_->initial_quality() +
|
|
- (incomplete ? -1 : 0) +
|
|
- (is_user_phrase ? 0.5 : 0));
|
|
+ phrase->set_quality(std::exp(e->weight) +
|
|
+ options_->initial_quality() +
|
|
+ (incomplete ? -1 : 0) +
|
|
+ (is_user_phrase ? 0.5 : 0));
|
|
}
|
|
return phrase;
|
|
}
|