File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change 11cmake_minimum_required (VERSION 3.13)
22cmake_policy (SET CMP0063 NEW)
33project (fcitx5-cskk VERSION 1.2.0)
4+ set (REQUIIRED_FCITX_VERSION 5.1.13)
45set (CMAKE_CXX_FLAGS "-Wall" )
56set (CMAKE_CXX_STANDARD 17)
67IF (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
@@ -20,8 +21,8 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
2021# See Fcitx5UtilsConfig.cmake
2122add_definitions (-DFCITX_INSTALL_USE_FCITX_SYS_PATHS=ON )
2223find_package (PkgConfig REQUIRED)
23- find_package (Fcitx5Core 5.0.6 REQUIRED)
24- find_package (Fcitx5Utils 5.0.6 REQUIRED)
24+ find_package (Fcitx5Core ${REQUIIRED_FCITX_VERSION} REQUIRED)
25+ find_package (Fcitx5Utils ${REQUIIRED_FCITX_VERSION} REQUIRED)
2526
2627# GITHUB_ACTION_BUILD_CSKK_VERSION=3.0.0
2728pkg_check_modules(LIBCSKK REQUIRED IMPORTED_TARGET "cskk>=3.0" )
Original file line number Diff line number Diff line change 1717#include < cstdlib>
1818#include < cstring>
1919#include < fcitx-config/iniparser.h>
20+ #include < fcitx-utils/fdstreambuf.h>
21+ #include < fcitx-utils/stringutils.h>
2022#include < fcitx/addonmanager.h>
2123#include < fcitx/inputpanel.h>
2224#include < filesystem>
25+ #include < istream>
2326#include < string>
2427#include < vector>
2528
@@ -112,16 +115,16 @@ void FcitxCskkEngine::loadDictionary() {
112115 auto dict_config_file = StandardPath::global ().open (
113116 StandardPath::Type::PkgData, " cskk/dictionary_list" , O_RDONLY);
114117
115- UniqueFilePtr fp (fdopen (dict_config_file.fd (), " rb" ));
116- if (!fp) {
118+ if (!dict_config_file.isValid ()) {
117119 return ;
118120 }
119121
120- UniqueCPtr<char > buf;
121- size_t len = 0 ;
122+ IFDStreamBuf buf (dict_config_file.fd ());
123+ std::istream in (&buf);
124+ std::string line;
122125
123- while (getline (buf, &len, fp. get ()) != - 1 ) {
124- const auto trimmed = stringutils::trim (buf. get () );
126+ while (std:: getline (in, line) ) {
127+ const auto trimmed = stringutils::trimView (line );
125128 const auto tokens = stringutils::split (trimmed, " ," );
126129
127130 if (tokens.size () < 3 ) {
You can’t perform that action at this time.
0 commit comments