File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change 11cmake_minimum_required (VERSION 3.6.0)
22project (fcitx5-skk VERSION 5.1.6)
33
4- set (REQUIRED_FCITX_VERSION 5.1.12 )
4+ set (REQUIRED_FCITX_VERSION 5.1.13 )
55find_package (ECM 1.0.0 REQUIRED)
66set (CMAKE_MODULE_PATH ${ECM_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR} /cmake" ${CMAKE_MODULE_PATH} )
77option (ENABLE_QT "Enable Qt for GUI configuration" On )
Original file line number Diff line number Diff line change 1212#include < cstdint>
1313#include < cstdio>
1414#include < cstring>
15+ #include < istream>
1516#include < memory>
1617#include < stdexcept>
1718#include < string>
1819#include < utility>
1920#include < vector>
2021#include < fcitx-config/iniparser.h>
2122#include < fcitx-utils/capabilityflags.h>
23+ #include < fcitx-utils/fdstreambuf.h>
2224#include < fcitx-utils/i18n.h>
2325#include < fcitx-utils/key.h>
2426#include < fcitx-utils/keysym.h>
@@ -466,17 +468,16 @@ void SkkEngine::loadDictionary() {
466468 auto file = StandardPath::global ().open (StandardPath::Type::PkgData,
467469 " skk/dictionary_list" , O_RDONLY);
468470
469- UniqueFilePtr fp (fdopen (file.fd (), " rb" ));
470- if (!fp) {
471+ if (!file.isValid ()) {
471472 return ;
472473 }
473- file.release ();
474474
475- UniqueCPtr<char > buf;
476- size_t len = 0 ;
475+ IFDStreamBuf buf (file.fd ());
476+ std::istream in (&buf);
477+ std::string line;
477478
478- while (getline (buf, &len, fp. get ()) != - 1 ) {
479- const auto trimmed = stringutils::trim (buf. get () );
479+ while (std:: getline (in, line) ) {
480+ const auto trimmed = stringutils::trimView (line );
480481 const auto tokens = stringutils::split (trimmed, " ," );
481482
482483 if (tokens.size () < 3 ) {
You can’t perform that action at this time.
0 commit comments