void-packages/srcpkgs/librime/patches/opencc-1.1.0.patch

87 lines
2.9 KiB
Diff

From beae5b1d4e990aeb05eb86db5eefec50fa03750b Mon Sep 17 00:00:00 2001
From: Chen Gong <chen.sst@gmail.com>
Date: Fri, 15 May 2020 01:42:52 +0800
Subject: [PATCH] fix(simplifier): opencc::DictEntry::Values() type change in
opencc 1.1.0
Closes #367
---
src/rime/gear/simplifier.cc | 14 ++++++--------
src/rime/gear/simplifier.h | 5 +++--
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git src/rime/gear/simplifier.cc src/rime/gear/simplifier.cc
index 98a1c5a9..feb7f50b 100644
--- src/rime/gear/simplifier.cc
+++ src/rime/gear/simplifier.cc
@@ -8,6 +8,7 @@
#include <boost/filesystem.hpp>
#include <stdint.h>
#include <utf8.h>
+#include <utility>
#include <rime/candidate.h>
#include <rime/common.h>
#include <rime/config.h>
@@ -45,8 +46,7 @@ class Opencc {
}
}
- bool ConvertWord(const string& text,
- vector<string>* forms) {
+ bool ConvertWord(const string& text, vector<string>* forms) {
if (dict_ == nullptr) return false;
opencc::Optional<const opencc::DictEntry*> item = dict_->Match(text);
if (item.IsNull()) {
@@ -54,15 +54,14 @@ class Opencc {
return false;
} else {
const opencc::DictEntry* entry = item.Get();
- for (const char* value : entry->Values()) {
- forms->push_back(value);
+ for (auto&& value : entry->Values()) {
+ forms->push_back(std::move(value));
}
return forms->size() > 0;
}
}
- bool RandomConvertText(const string& text,
- string* simplified) {
+ bool RandomConvertText(const string& text, string* simplified) {
if (dict_ == nullptr) return false;
const char *phrase = text.c_str();
std::ostringstream buffer;
@@ -83,8 +82,7 @@ class Opencc {
return *simplified != text;
}
- bool ConvertText(const string& text,
- string* simplified) {
+ bool ConvertText(const string& text, string* simplified) {
if (converter_ == nullptr) return false;
*simplified = converter_->Convert(text);
return *simplified != text;
diff --git src/rime/gear/simplifier.h src/rime/gear/simplifier.h
index c68e4c7d..f70344e7 100644
--- src/rime/gear/simplifier.h
+++ src/rime/gear/simplifier.h
@@ -20,7 +20,7 @@ class Simplifier : public Filter, TagMatching {
explicit Simplifier(const Ticket& ticket);
virtual an<Translation> Apply(an<Translation> translation,
- CandidateList* candidates);
+ CandidateList* candidates);
virtual bool AppliesToSegment(Segment* segment) {
@@ -35,7 +35,8 @@ class Simplifier : public Filter, TagMatching {
void Initialize();
void PushBack(const an<Candidate>& original,
- CandidateQueue* result, const string& simplified);
+ CandidateQueue* result,
+ const string& simplified);
bool initialized_ = false;
the<Opencc> opencc_;