Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package fcitx5-m17n for openSUSE:Leap:16.0 
checked in at 2025-07-15 17:55:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:16.0/fcitx5-m17n (Old)
 and      /work/SRC/openSUSE:Leap:16.0/.fcitx5-m17n.new.7373 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "fcitx5-m17n"

Tue Jul 15 17:55:08 2025 rev:2 rq:1293344 version:5.1.4

Changes:
--------
--- /work/SRC/openSUSE:Leap:16.0/fcitx5-m17n/fcitx5-m17n.changes        
2025-03-19 11:42:46.019756722 +0100
+++ /work/SRC/openSUSE:Leap:16.0/.fcitx5-m17n.new.7373/fcitx5-m17n.changes      
2025-07-15 17:55:47.820249300 +0200
@@ -1,0 +2,22 @@
+Sun Jun 22 04:00:35 UTC 2025 - Marguerite Su <i...@marguerite.su>
+
+- update to 5.1.4
+  * get rid of C getling usage
+  * port away from fmt to std::format
+  * use new macro for i18n string format
+  * port to standardpaths
+
+-------------------------------------------------------------------
+Wed Jan 29 07:09:35 UTC 2025 - Marguerite Su <i...@marguerite.su>
+
+- update to 5.1.3
+  * use addon factory v2
+
+-------------------------------------------------------------------
+Sun Jan  5 06:13:04 UTC 2025 - Marguerite Su <i...@marguerite.su>
+
+- update to 5.1.2
+  * Workaround test failure with latest m17n-db since wijesekera is
+    renamed to wijesekara
+
+-------------------------------------------------------------------

Old:
----
  fcitx5-m17n-5.1.1.tar.zst

New:
----
  fcitx5-m17n-5.1.4.tar.zst

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ fcitx5-m17n.spec ++++++
--- /var/tmp/diff_new_pack.4aMBeK/_old  2025-07-15 17:55:48.040258490 +0200
+++ /var/tmp/diff_new_pack.4aMBeK/_new  2025-07-15 17:55:48.044258657 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package fcitx5-m17n
 #
-# Copyright (c) 2024 SUSE LLC
+# Copyright (c) 2025 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,17 +17,22 @@
 
 
 Name:           fcitx5-m17n
-Version:        5.1.1
+Version:        5.1.4
 Release:        0
 Summary:        M17n input method engine for Fcitx5
 License:        LGPL-2.1-or-later
+Group:          System/I18n/Chinese
 URL:            https://github.com/fcitx/fcitx5-m17n
 Source:         
https://download.fcitx-im.org/fcitx5/%{name}/%{name}-%{version}.tar.zst
 BuildRequires:  cmake
 BuildRequires:  extra-cmake-modules
 BuildRequires:  fcitx5-devel
 BuildRequires:  fmt-devel
+%if 0%{?suse_version} >= 1550
 BuildRequires:  gcc-c++
+%else
+BuildRequires:  gcc13-c++
+%endif
 BuildRequires:  m17n-lib-devel
 BuildRequires:  pkgconfig
 BuildRequires:  zstd
@@ -46,6 +51,10 @@
 %setup -q
 
 %build
+%if 0%{?suse_version} < 1550
+export CC=%{_bindir}/gcc-13
+export CXX=%{_bindir}/g++-13
+%endif
 %cmake
 %make_build
 
@@ -56,7 +65,7 @@
 %files -f %{name}.lang
 %license LICENSES
 %doc README.md
-%{_fcitx5_libdir}/m17n.so
+%{_fcitx5_libdir}/libm17n.so
 %{_fcitx5_addondir}/m17n.conf
 %{_fcitx5_datadir}/m17n
 %{_datadir}/metainfo/org.fcitx.Fcitx5.Addon.M17N.metainfo.xml

++++++ fcitx5-m17n-5.1.1.tar.zst -> fcitx5-m17n-5.1.4.tar.zst ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fcitx5-m17n-5.1.1/.github/workflows/check.yml 
new/fcitx5-m17n-5.1.4/.github/workflows/check.yml
--- old/fcitx5-m17n-5.1.1/.github/workflows/check.yml   2024-04-22 
09:58:03.000000000 +0200
+++ new/fcitx5-m17n-5.1.4/.github/workflows/check.yml   2025-06-16 
08:25:47.000000000 +0200
@@ -1,5 +1,4 @@
 name: CI
-
 on:
   push:
     branches:
@@ -7,10 +6,21 @@
   pull_request:
     branches:
       - master
-
 jobs:
+  clang-format:
+    name: Check clang-format
+    runs-on: ubuntu-latest
+    container: archlinux:latest
+    steps:
+      - name: Install dependencies
+        run: |
+          pacman -Syu --noconfirm git clang diffutils
+          git config --global --add safe.directory $GITHUB_WORKSPACE
+      - uses: actions/checkout@v4
+      - uses: fcitx/github-actions@clang-format
   check:
     name: Build and test
+    needs: clang-format
     runs-on: ubuntu-latest
     container: archlinux:latest
     strategy:
@@ -37,20 +47,15 @@
         uses: actions/cache@v4
         with:
           path: 'fcitx5/**/*.tar.*'
-          key: ${{ runner.os }}-${{ 
hashFiles('fcitx5/src/modules/spell/CMakeLists.txt') }}
+          key: ${{ runner.os }}-${{ 
hashFiles('fcitx5/src/modules/spell/CMakeLists.txt')
+            }}
       - name: Build and Install fcitx5
         uses: fcitx/github-actions@cmake
         with:
           path: fcitx5
           cmake-option: >-
-            -DENABLE_KEYBOARD=Off
-            -DENABLE_X11=Off
-            -DENABLE_WAYLAND=Off
-            -DENABLE_ENCHANT=Off
-            -DENABLE_DBUS=Off
-            -DENABLE_SERVER=Off
-            -DENABLE_EMOJI=Off
-            -DUSE_SYSTEMD=Off
+            -DENABLE_KEYBOARD=Off -DENABLE_X11=Off -DENABLE_WAYLAND=Off 
-DENABLE_ENCHANT=Off
+            -DENABLE_DBUS=Off -DENABLE_SERVER=Off -DENABLE_EMOJI=Off 
-DUSE_SYSTEMD=Off
       - uses: actions/checkout@v4
         with:
           path: fcitx5-m17n
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fcitx5-m17n-5.1.1/CMakeLists.txt 
new/fcitx5-m17n-5.1.4/CMakeLists.txt
--- old/fcitx5-m17n-5.1.1/CMakeLists.txt        2024-04-22 09:58:03.000000000 
+0200
+++ new/fcitx5-m17n-5.1.4/CMakeLists.txt        2025-06-16 08:25:47.000000000 
+0200
@@ -1,7 +1,8 @@
 cmake_minimum_required(VERSION 3.6)
 
-project(fcitx-m17n VERSION 5.1.1)
+project(fcitx-m17n VERSION 5.1.4)
 
+set(REQUIRED_FCITX_VERSION 5.1.13)
 find_package(ECM REQUIRED 1.0.0)
 set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake" 
${CMAKE_MODULE_PATH})
 include(FeatureSummary)
@@ -12,21 +13,21 @@
 option(ENABLE_COVERAGE "Build the project with gcov support (Need 
ENABLE_TEST=On)" Off)
 set(GCOV_TOOL "gcov" CACHE STRING "Path to gcov tool used by coverage.")
 
-find_package(Fcitx5Core 5.0.2 REQUIRED)
+find_package(Fcitx5Core ${REQUIRED_FCITX_VERSION} REQUIRED)
 find_package(Fcitx5Module REQUIRED COMPONENTS TestFrontend)
 find_package(Gettext REQUIRED)
-find_package(Pthread REQUIRED)
-find_package(fmt REQUIRED)
 find_package(PkgConfig REQUIRED)
-pkg_check_modules(M17NGui IMPORTED_TARGET "m17n-gui>=1.6.3" REQUIRED)
-# Required for data and testing
-pkg_check_modules(M17NDB "m17n-db" REQUIRED)
-
-if (TARGET fmt::fmt-header-only)
-  set(FMT_TARGET fmt::fmt-header-only)
-else()
-  set(FMT_TARGET fmt::fmt)
-endif ()
+
+if (NOT DEFINED M17N_TARGET)
+    pkg_check_modules(M17NGui IMPORTED_TARGET "m17n-gui>=1.6.3" REQUIRED)
+    # Required for data and testing
+    pkg_check_modules(M17NDB "m17n-db" REQUIRED)
+    set(M17N_TARGET PkgConfig::M17NGui)
+endif()
+
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
 
 
include("${FCITX_INSTALL_CMAKECONFIG_DIR}/Fcitx5Utils/Fcitx5CompilerSettings.cmake")
 add_definitions(-DFCITX_GETTEXT_DOMAIN=\"fcitx5-m17n\" -D_GNU_SOURCE)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fcitx5-m17n-5.1.1/cmake/FindPthread.cmake 
new/fcitx5-m17n-5.1.4/cmake/FindPthread.cmake
--- old/fcitx5-m17n-5.1.1/cmake/FindPthread.cmake       2024-04-22 
09:58:03.000000000 +0200
+++ new/fcitx5-m17n-5.1.4/cmake/FindPthread.cmake       1970-01-01 
01:00:00.000000000 +0100
@@ -1,59 +0,0 @@
-# Try to find Pthread functionality
-# Once done this will define
-#
-#  PTHREAD_FOUND - system has Pthread
-#  PTHREAD_INCLUDE_DIR - Pthread include directory
-#  PTHREAD_LIBRARIES - Libraries needed to use Pthread
-#
-# TODO: This will enable translations only if Gettext functionality is
-# present in libc. Must have more robust system for release, where Gettext
-# functionality can also reside in standalone Gettext library, or the one
-# embedded within kdelibs (cf. gettext.m4 from Gettext source).
-#
-# Copyright (c) 2006, Chusslove Illich, <caslav.i...@gmx.net>
-# Copyright (c) 2007, Alexander Neundorf, <neund...@kde.org>
-# Copyright (c) 2016, Xuetian Weng <wen...@gmail.com>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-find_path(PTHREAD_INCLUDE_DIR NAMES pthread.h)
-
-if(PTHREAD_INCLUDE_DIR)
-  include(CheckFunctionExists)
-  check_function_exists(pthread_create PTHREAD_LIBC_HAS_PTHREAD_CREATE)
-
-  if (PTHREAD_LIBC_HAS_PTHREAD_CREATE)
-    set(PTHREAD_LIBRARIES)
-    set(PTHREAD_LIB_FOUND TRUE)
-  else (PTHREAD_LIBC_HAS_PTHREAD_CREATE)
-    find_library(PTHREAD_LIBRARIES NAMES pthread libpthread )
-    if(PTHREAD_LIBRARIES)
-      set(PTHREAD_LIB_FOUND TRUE)
-    endif(PTHREAD_LIBRARIES)
-  endif (PTHREAD_LIBC_HAS_PTHREAD_CREATE)
-
-endif(PTHREAD_INCLUDE_DIR)
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(Pthread
-    FOUND_VAR
-        PTHREAD_FOUND
-    REQUIRED_VARS
-        PTHREAD_INCLUDE_DIR  PTHREAD_LIB_FOUND
-)
-
-if(PTHREAD_FOUND AND NOT TARGET Pthread::Pthread)
-    if (PTHREAD_LIBRARIES)
-        add_library(Pthread::Pthread UNKNOWN IMPORTED)
-        set_target_properties(Pthread::Pthread PROPERTIES
-            IMPORTED_LOCATION "${PTHREAD_LIBRARIES}")
-    else()
-        add_library(Pthread::Pthread INTERFACE IMPORTED )
-    endif()
-    set_target_properties(Pthread::Pthread PROPERTIES
-        INTERFACE_INCLUDE_DIRECTORIES "${PTHREAD_INCLUDE_DIR}"
-    )
-endif()
-
-mark_as_advanced(PTHREAD_INCLUDE_DIR  PTHREAD_LIBRARIES  
PTHREAD_LIBC_HAS_PTHREAD_CREATE  PTHREAD_LIB_FOUND)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fcitx5-m17n-5.1.1/im/CMakeLists.txt 
new/fcitx5-m17n-5.1.4/im/CMakeLists.txt
--- old/fcitx5-m17n-5.1.1/im/CMakeLists.txt     2024-04-22 09:58:03.000000000 
+0200
+++ new/fcitx5-m17n-5.1.4/im/CMakeLists.txt     2025-06-16 08:25:47.000000000 
+0200
@@ -4,13 +4,12 @@
     keysymname.cpp
     )
 
-add_library(m17n MODULE ${fcitx_m17n_sources})
-target_link_libraries(m17n Fcitx5::Core Fcitx5::Config ${FMT_TARGET} 
PkgConfig::M17NGui)
+add_fcitx5_addon(m17n ${fcitx_m17n_sources})
+target_link_libraries(m17n Fcitx5::Core Fcitx5::Config ${M17N_TARGET})
 target_include_directories(m17n PRIVATE ${PROJECT_BINARY_DIR})
-set_target_properties(m17n PROPERTIES PREFIX "")
 install(TARGETS m17n DESTINATION "${CMAKE_INSTALL_LIBDIR}/fcitx5")
 configure_file(m17n.conf.in.in m17n.conf.in)
 fcitx5_translate_desktop_file("${CMAKE_CURRENT_BINARY_DIR}/m17n.conf.in" 
m17n.conf)
-install(FILES "${CMAKE_CURRENT_BINARY_DIR}/m17n.conf" DESTINATION 
"${FCITX_INSTALL_PKGDATADIR}/addon")
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/m17n.conf" DESTINATION 
"${FCITX_INSTALL_PKGDATADIR}/addon" COMPONENT config)
 
-install(FILES default DESTINATION "${CMAKE_INSTALL_DATADIR}/fcitx5/m17n")
+install(FILES default DESTINATION "${CMAKE_INSTALL_DATADIR}/fcitx5/m17n" 
COMPONENT config)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fcitx5-m17n-5.1.1/im/engine.cpp 
new/fcitx5-m17n-5.1.4/im/engine.cpp
--- old/fcitx5-m17n-5.1.1/im/engine.cpp 2024-04-22 09:58:03.000000000 +0200
+++ new/fcitx5-m17n-5.1.4/im/engine.cpp 2025-06-16 08:25:47.000000000 +0200
@@ -7,18 +7,38 @@
 #include "engine.h"
 #include "keysymname.h"
 #include "overrideparser.h"
+#include <cstddef>
+#include <cstdint>
+#include <cstdio>
+#include <cstring>
+#include <fcitx-config/iniparser.h>
+#include <fcitx-utils/capabilityflags.h>
+#include <fcitx-utils/cutf8.h>
 #include <fcitx-utils/i18n.h>
+#include <fcitx-utils/key.h>
+#include <fcitx-utils/keysym.h>
 #include <fcitx-utils/log.h>
-#include <fcitx-utils/standardpath.h>
+#include <fcitx-utils/standardpaths.h>
+#include <fcitx-utils/stringutils.h>
+#include <fcitx-utils/textformatflags.h>
 #include <fcitx-utils/utf8.h>
+#include <fcitx/addoninstance.h>
+#include <fcitx/candidatelist.h>
+#include <fcitx/event.h>
 #include <fcitx/inputcontext.h>
 #include <fcitx/inputcontextmanager.h>
 #include <fcitx/inputpanel.h>
 #include <fcitx/instance.h>
+#include <fcitx/text.h>
+#include <fcitx/userinterface.h>
 #include <fcntl.h>
-#include <fmt/format.h>
+#include <format>
+#include <m17n-core.h>
 #include <m17n.h>
+#include <memory>
 #include <string>
+#include <utility>
+#include <vector>
 
 FCITX_DEFINE_LOG_CATEGORY(M17N, "m17n")
 
@@ -31,7 +51,8 @@
 
 std::string MTextToUTF8(MText *mt) {
     // TODO Verify that bufsize is "just enough" in worst scenerio.
-    size_t bufsize = (mtext_len(mt) + 1) * FCITX_UTF8_MAX_LENGTH;
+    size_t bufsize =
+        (mtext_len(mt) + 1) * static_cast<size_t>(FCITX_UTF8_MAX_LENGTH);
     std::vector<char> buf;
     buf.resize(bufsize);
     FCITX_M17N_DEBUG() << "MText buf size: " << bufsize;
@@ -111,36 +132,35 @@
         key.states() & KeyStates{KeyState::Mod1, KeyState::Mod5, 
KeyState::Meta,
                                  KeyState::Super, KeyState::Hyper};
 
-    // we have 7 possible below, then 20 is long enough (7 x 2 = 14 < 20)
-    char prefix[20] = "";
+    std::string prefix;
 
     // and we use reverse order here comparing with other implementation since
     // strcat is append.
     // I don't know if it matters, but it's just to make sure it works.
     if (mask & KeyState::Shift) {
-        strcat(prefix, "S-");
+        prefix.append("S-");
     }
     if (mask & KeyState::Ctrl) {
-        strcat(prefix, "C-");
+        prefix.append("C-");
     }
     if (mask & KeyState::Meta) {
-        strcat(prefix, "M-");
+        prefix.append("M-");
     }
     if (mask & KeyState::Alt) {
-        strcat(prefix, "A-");
+        prefix.append("A-");
     }
     // This is mysterious. - xiaq
     if (mask & KeyState::Mod5) {
-        strcat(prefix, "G-");
+        prefix.append("G-");
     }
     if (mask & KeyState::Super) {
-        strcat(prefix, "s-");
+        prefix.append("s-");
     }
     if (mask & KeyState::Hyper) {
-        strcat(prefix, "H-");
+        prefix.append("H-");
     }
 
-    std::string keystr = stringutils::concat(static_cast<char *>(prefix), 
base);
+    std::string keystr = stringutils::concat(prefix, base);
     FCITX_M17N_DEBUG() << "M17n key str: " << keystr << " " << key;
     mkeysym = msymbol(keystr.data());
 
@@ -154,17 +174,14 @@
         if (mlang == Mt && mname == Mnil) {
             // XXX magic number
             return 10;
-        } else {
-            // tail recursion
-            return GetPageSize(Mt, Mnil);
-        }
+        } // tail recursion
+        return GetPageSize(Mt, Mnil);
     }
     MPlist *varinfo = (MPlist *)mplist_value(plist);
     return reinterpret_cast<intptr_t>(MPListIndex(varinfo, 3));
 }
 
-inline static void SetPreedit(InputContext *ic, const std::string &s,
-                              int cursor_pos) {
+inline void SetPreedit(InputContext *ic, const std::string &s, int cursor_pos) 
{
     Text preedit;
     preedit.append(s, TextFormatFlag::Underline);
     if (cursor_pos >= 0 && utf8::length(s) >= static_cast<size_t>(cursor_pos)) 
{
@@ -185,7 +202,7 @@
     }
 
     void select(InputContext *inputContext) const override {
-        auto state = inputContext->propertyFor(engine_->factory());
+        auto *state = inputContext->propertyFor(engine_->factory());
         state->select(index_);
     }
 
@@ -198,7 +215,7 @@
 public:
     M17NCandidateList(M17NEngine *engine, InputContext *ic)
         : engine_(engine), ic_(ic) {
-        auto state = ic_->propertyFor(engine_->factory());
+        auto *state = ic_->propertyFor(engine_->factory());
         auto pageSize = GetPageSize(state->mim_->language, state->mim_->name);
 
         const static KeyList selectionKeys{
@@ -244,24 +261,24 @@
     }
 
     void prev() override {
-        auto state = ic_->propertyFor(engine_->factory());
+        auto *state = ic_->propertyFor(engine_->factory());
         state->keyEvent(Key(FcitxKey_Up));
     }
 
     void next() override {
-        auto state = ic_->propertyFor(engine_->factory());
+        auto *state = ic_->propertyFor(engine_->factory());
         state->keyEvent(Key(FcitxKey_Down));
     }
 
     bool usedNextBefore() const override { return true; }
 
     void prevCandidate() override {
-        auto state = ic_->propertyFor(engine_->factory());
+        auto *state = ic_->propertyFor(engine_->factory());
         state->keyEvent(Key(FcitxKey_Left));
     }
 
     void nextCandidate() override {
-        auto state = ic_->propertyFor(engine_->factory());
+        auto *state = ic_->propertyFor(engine_->factory());
         state->keyEvent(Key(FcitxKey_Right));
     }
 
@@ -278,13 +295,10 @@
     reloadConfig();
     M17N_INIT();
 
-    auto file = StandardPath::global().open(StandardPath::Type::PkgData,
-                                            "m17n/default", O_RDONLY);
-    FILE *fp = fdopen(file.fd(), "r");
-    if (fp) {
-        file.release();
-        list_ = ParseDefaultSettings(fp);
-        fclose(fp);
+    auto file = StandardPaths::global().open(StandardPathsType::PkgData,
+                                             "m17n/default");
+    if (file.isValid()) {
+        list_ = ParseDefaultSettings(file.fd());
     }
 
     instance_->inputContextManager().registerProperty("m17nState", &factory_);
@@ -310,8 +324,9 @@
             item = MatchDefaultSettings(list_, lang, name);
         }
 
-        if (item && item->priority < 0 && !*config_.enableDeprecated)
+        if (item && item->priority < 0 && !*config_.enableDeprecated) {
             continue;
+        }
 
         if (msane != Mt) {
             // Not "sane"
@@ -333,9 +348,9 @@
 
         std::string iconName;
         auto uniqueName = stringutils::concat("m17n_", lang, "_", name);
-        auto fxName = fmt::format(
-            _("{0} (M17N)"),
-            (item && item->i18nName.size()) ? _(item->i18nName) : name);
+        const std::string i18nname =
+            (item && item->i18nName.size()) ? _(item->i18nName) : name;
+        auto fxName = _("{0} (M17N)", i18nname);
 
         info = minput_get_title_icon(mlang, mname);
         // head of info is a MText
@@ -364,12 +379,13 @@
     return entries;
 }
 
-void M17NEngine::activate(const InputMethodEntry &, InputContextEvent &) {}
+void M17NEngine::activate(const InputMethodEntry & /*entry*/,
+                          InputContextEvent & /*event*/) {}
 
-void M17NEngine::deactivate(const InputMethodEntry &,
+void M17NEngine::deactivate(const InputMethodEntry & /*entry*/,
                             InputContextEvent &event) {
-    auto inputContext = event.inputContext();
-    auto state = inputContext->propertyFor(&factory_);
+    auto *inputContext = event.inputContext();
+    auto *state = inputContext->propertyFor(&factory_);
     if (event.type() == EventType::InputContextSwitchInputMethod) {
         state->commitPreedit();
     }
@@ -381,15 +397,16 @@
         return;
     }
 
-    auto ic = keyEvent.inputContext();
-    auto state = ic->propertyFor(&factory_);
+    auto *ic = keyEvent.inputContext();
+    auto *state = ic->propertyFor(&factory_);
 
     state->keyEvent(entry, keyEvent);
 }
 
-void M17NEngine::reset(const InputMethodEntry &, InputContextEvent &event) {
-    auto ic = event.inputContext();
-    auto state = ic->propertyFor(&factory_);
+void M17NEngine::reset(const InputMethodEntry & /*entry*/,
+                       InputContextEvent &event) {
+    auto *ic = event.inputContext();
+    auto *state = ic->propertyFor(&factory_);
     state->reset();
 }
 
@@ -400,7 +417,7 @@
     state->command(context, command);
 }
 
-void M17NState::command(MInputContext *context, MSymbol command) {
+void M17NState::command(MInputContext *context, MSymbol command) const {
     if (command == Minput_get_surrounding_text &&
         ic_->capabilityFlags().test(CapabilityFlag::SurroundingText) &&
         ic_->surroundingText().isValid()) {
@@ -408,23 +425,27 @@
         size_t nchars = utf8::length(text);
         size_t nbytes = text.size();
         MText *mt = mconv_decode_buffer(
-                  Mcoding_utf_8,
-                  reinterpret_cast<const unsigned char *>(text.data()), 
nbytes),
-              *surround = nullptr;
-        if (!mt)
+            Mcoding_utf_8, reinterpret_cast<const unsigned char 
*>(text.data()),
+            nbytes);
+        MText *surround = nullptr;
+        if (!mt) {
             return;
+        }
 
-        long len = (long)mplist_value(context->plist), pos;
+        long len = (long)mplist_value(context->plist);
+        long pos;
         auto cursor = ic_->surroundingText().cursor();
         if (len < 0) {
             pos = cursor + len;
-            if (pos < 0)
+            if (pos < 0) {
                 pos = 0;
+            }
             surround = mtext_duplicate(mt, pos, cursor);
         } else if (len > 0) {
             pos = cursor + len;
-            if (pos > static_cast<long>(nchars))
+            if (pos > static_cast<long>(nchars)) {
                 pos = nchars;
+            }
             surround = mtext_duplicate(mt, cursor, pos);
         } else {
             surround = mtext();
@@ -446,7 +467,7 @@
 }
 
 void M17NState::keyEvent(const InputMethodEntry &entry, KeyEvent &keyEvent) {
-    auto data = static_cast<const M17NData *>(entry.userData());
+    const auto *data = static_cast<const M17NData *>(entry.userData());
     if (!mim_ || data->language() != mim_->language ||
         data->name() != mim_->name) {
         mic_.reset();
@@ -528,7 +549,7 @@
     updateUI();
 }
 
-void M17NState::commitPreedit() {
+void M17NState::commitPreedit() const {
     if (!mic_) {
         return;
     }
@@ -558,14 +579,16 @@
             keyEvent(Key(FcitxKey_Left));
         }
         /* though useless, but take care if there is a bug cause freeze */
-        if (lastIdx == mic_->candidate_index)
+        if (lastIdx == mic_->candidate_index) {
             break;
+        }
         lastIdx = mic_->candidate_index;
     } while (mic_->candidate_list && mic_->candidate_show);
 
     if (!mic_->candidate_list || !mic_->candidate_show ||
-        index != mic_->candidate_index)
+        index != mic_->candidate_index) {
         return;
+    }
 
     MPlist *head = mic_->candidate_list;
 
@@ -589,12 +612,13 @@
     int delta = index - i;
 
     KeySym sym = FcitxKey_1;
-    if ((delta + 1) % 10 == 0)
+    if ((delta + 1) % 10 == 0) {
         sym = FcitxKey_0;
-    else
+    } else {
         sym = static_cast<KeySym>(FcitxKey_1 + (delta % 10));
+    }
     keyEvent(Key(sym));
 }
 } // namespace fcitx
 
-FCITX_ADDON_FACTORY(fcitx::M17NEngineFactory)
+FCITX_ADDON_FACTORY_V2(m17n, fcitx::M17NEngineFactory)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fcitx5-m17n-5.1.1/im/engine.h 
new/fcitx5-m17n-5.1.4/im/engine.h
--- old/fcitx5-m17n-5.1.1/im/engine.h   2024-04-22 09:58:03.000000000 +0200
+++ new/fcitx5-m17n-5.1.4/im/engine.h   2025-06-16 08:25:47.000000000 +0200
@@ -8,13 +8,23 @@
 #define _IM_ENGINE_H_
 
 #include "overrideparser.h"
+#include <fcitx-config/configuration.h>
 #include <fcitx-config/iniparser.h>
+#include <fcitx-config/option.h>
+#include <fcitx-config/rawconfig.h>
 #include <fcitx-utils/i18n.h>
+#include <fcitx-utils/key.h>
 #include <fcitx/addonfactory.h>
+#include <fcitx/addoninstance.h>
 #include <fcitx/addonmanager.h>
+#include <fcitx/event.h>
 #include <fcitx/inputcontextproperty.h>
 #include <fcitx/inputmethodengine.h>
+#include <fcitx/inputmethodentry.h>
+#include <m17n-core.h>
 #include <m17n.h>
+#include <memory>
+#include <vector>
 
 namespace fcitx {
 
@@ -44,11 +54,11 @@
           mic_(nullptr, &minput_destroy_ic) {}
 
     void keyEvent(const InputMethodEntry &entry, KeyEvent &keyEvent);
-    void command(MInputContext *context, MSymbol command);
+    void command(MInputContext *context, MSymbol command) const;
     void updateUI();
     void select(int index);
     void reset();
-    void commitPreedit();
+    void commitPreedit() const;
     bool keyEvent(const Key &key);
 
     static void callback(MInputContext *context, MSymbol command);
@@ -63,15 +73,15 @@
 public:
     M17NEngine(Instance *instance);
 
-    void activate(const fcitx::InputMethodEntry &,
-                  fcitx::InputContextEvent &) override;
+    void activate(const fcitx::InputMethodEntry & /*entry*/,
+                  fcitx::InputContextEvent & /*event*/) override;
     void deactivate(const fcitx::InputMethodEntry &entry,
                     fcitx::InputContextEvent &event) override;
     void keyEvent(const fcitx::InputMethodEntry &entry,
                   fcitx::KeyEvent &keyEvent) override;
     void reloadConfig() override;
-    void reset(const fcitx::InputMethodEntry &,
-               fcitx::InputContextEvent &) override;
+    void reset(const fcitx::InputMethodEntry & /*entry*/,
+               fcitx::InputContextEvent & /*event*/) override;
     auto factory() { return &factory_; }
 
     const Configuration *getConfig() const override { return &config_; }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fcitx5-m17n-5.1.1/im/keysymname.cpp 
new/fcitx5-m17n-5.1.4/im/keysymname.cpp
--- old/fcitx5-m17n-5.1.1/im/keysymname.cpp     2024-04-22 09:58:03.000000000 
+0200
+++ new/fcitx5-m17n-5.1.4/im/keysymname.cpp     2025-06-16 08:25:47.000000000 
+0200
@@ -6,6 +6,10 @@
  */
 
 #include "keysymname.h"
+#include <cstdio>
+#include <fcitx-utils/key.h>
+#include <fcitx-utils/keysym.h>
+#include <string>
 
 namespace fcitx {
 std::string KeySymName(KeySym keyval) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fcitx5-m17n-5.1.1/im/keysymname.h 
new/fcitx5-m17n-5.1.4/im/keysymname.h
--- old/fcitx5-m17n-5.1.1/im/keysymname.h       2024-04-22 09:58:03.000000000 
+0200
+++ new/fcitx5-m17n-5.1.4/im/keysymname.h       2025-06-16 08:25:47.000000000 
+0200
@@ -8,6 +8,7 @@
 #define _IM_KEYSYMNAME_H_
 
 #include <fcitx-utils/key.h>
+#include <string>
 
 namespace fcitx {
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fcitx5-m17n-5.1.1/im/m17n.conf.in.in 
new/fcitx5-m17n-5.1.4/im/m17n.conf.in.in
--- old/fcitx5-m17n-5.1.1/im/m17n.conf.in.in    2024-04-22 09:58:03.000000000 
+0200
+++ new/fcitx5-m17n-5.1.4/im/m17n.conf.in.in    2025-06-16 08:25:47.000000000 
+0200
@@ -4,6 +4,9 @@
 Category=InputMethod
 Version=@PROJECT_VERSION@
 Enabled=True
-Library=m17n
+Library=libm17n
 Type=SharedLibrary
 Configurable=True
+
+[Addon/Dependencies]
+0=core:@REQUIRED_FCITX_VERSION@
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fcitx5-m17n-5.1.1/im/overrideparser.cpp 
new/fcitx5-m17n-5.1.4/im/overrideparser.cpp
--- old/fcitx5-m17n-5.1.1/im/overrideparser.cpp 2024-04-22 09:58:03.000000000 
+0200
+++ new/fcitx5-m17n-5.1.4/im/overrideparser.cpp 2025-06-16 08:25:47.000000000 
+0200
@@ -5,24 +5,36 @@
  *
  */
 #include "overrideparser.h"
+#include <algorithm>
+#include <cstddef>
+#include <cstdio>
+#include <cstdlib>
+#include <fcitx-utils/fdstreambuf.h>
 #include <fcitx-utils/stringutils.h>
+#include <istream>
+#include <string>
+#include <vector>
 
 using namespace fcitx;
 
-std::vector<OverrideItem> ParseDefaultSettings(FILE *fp) {
-    char *buf = NULL;
-    size_t bufsize = 0;
+std::vector<OverrideItem> ParseDefaultSettings(int fd) {
     std::vector<OverrideItem> list;
-    while (getline(&buf, &bufsize, fp) != -1) {
+
+    IFDStreamBuf buf(fd);
+    std::istream in(&buf);
+    std::string line;
+    while (std::getline(in, line)) {
         /* ignore comments */
-        if (!buf || buf[0] == '#')
+        if (!line.empty() || line[0] == '#') {
             continue;
-        auto trimmed = stringutils::trim(buf);
+        }
+        const auto trimmed = stringutils::trimView(line);
         auto strList = stringutils::split(trimmed, ":");
 
         do {
-            if (strList.size() < 3)
+            if (strList.size() < 3) {
                 break;
+            }
             const auto &lang = strList[0];
             const auto &name = strList[1];
             const auto &sPriority = strList[2];
@@ -36,14 +48,15 @@
             item.i18nName = strList.size() == 4 ? strList[3] : "";
             item.wildcardCount = 0;
 
-            if (item.name[0] == '*')
+            if (item.name[0] == '*') {
                 item.wildcardCount |= 1;
+            }
 
-            if (item.lang[0] == '*')
+            if (item.lang[0] == '*') {
                 item.wildcardCount |= 2;
+            }
         } while (0);
     }
-    free(buf);
 
     std::stable_sort(list.begin(), list.end(),
                      [](const auto &lhs, const auto &rhs) {
@@ -56,11 +69,13 @@
 const OverrideItem *MatchDefaultSettings(const std::vector<OverrideItem> &list,
                                          const std::string &lang,
                                          const std::string &name) {
-    for (auto &item : list) {
-        if (!((item.wildcardCount & 2) || lang == item.lang))
+    for (const auto &item : list) {
+        if (!((item.wildcardCount & 2) || lang == item.lang)) {
             continue;
-        if (!((item.wildcardCount & 1) || name == item.name))
+        }
+        if (!((item.wildcardCount & 1) || name == item.name)) {
             continue;
+        }
         return &item;
     }
     return nullptr;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fcitx5-m17n-5.1.1/im/overrideparser.h 
new/fcitx5-m17n-5.1.4/im/overrideparser.h
--- old/fcitx5-m17n-5.1.1/im/overrideparser.h   2024-04-22 09:58:03.000000000 
+0200
+++ new/fcitx5-m17n-5.1.4/im/overrideparser.h   2025-06-16 08:25:47.000000000 
+0200
@@ -7,6 +7,7 @@
 #ifndef _IM_OVERRIDEPARSER_H_
 #define _IM_OVERRIDEPARSER_H_
 
+#include <cstdio>
 #include <string>
 #include <vector>
 
@@ -18,7 +19,7 @@
     int wildcardCount;
 };
 
-std::vector<OverrideItem> ParseDefaultSettings(FILE *fp);
+std::vector<OverrideItem> ParseDefaultSettings(int fd);
 const OverrideItem *MatchDefaultSettings(const std::vector<OverrideItem> &list,
                                          const std::string &lang,
                                          const std::string &name);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/fcitx5-m17n-5.1.1/org.fcitx.Fcitx5.Addon.M17N.metainfo.xml.in 
new/fcitx5-m17n-5.1.4/org.fcitx.Fcitx5.Addon.M17N.metainfo.xml.in
--- old/fcitx5-m17n-5.1.1/org.fcitx.Fcitx5.Addon.M17N.metainfo.xml.in   
2024-04-22 09:58:03.000000000 +0200
+++ new/fcitx5-m17n-5.1.4/org.fcitx.Fcitx5.Addon.M17N.metainfo.xml.in   
2025-06-16 08:25:47.000000000 +0200
@@ -14,6 +14,9 @@
   <url type="vcs-browser">https://github.com/fcitx/fcitx5-m17n</url>
   <project_group>Fcitx</project_group>
   <releases>
+    <release version="5.1.4" date="2025-06-15"/>
+    <release version="5.1.3" date="2025-01-22"/>
+    <release version="5.1.2" date="2024-10-08"/>
     <release version="5.1.1" date="2024-04-22"/>
     <release version="5.1.0" date="2023-08-14"/>
     <release version="5.0.11" date="2022-11-19"/>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fcitx5-m17n-5.1.1/po/vi.po 
new/fcitx5-m17n-5.1.4/po/vi.po
--- old/fcitx5-m17n-5.1.1/po/vi.po      2024-04-22 09:58:03.000000000 +0200
+++ new/fcitx5-m17n-5.1.4/po/vi.po      2025-06-16 08:25:47.000000000 +0200
@@ -3,16 +3,17 @@
 # This file is distributed under the same license as the fcitx5-m17n package.
 #
 # Translators:
-# Zen Fas, 2022
+# zenfas, 2022
+# Huy Võ <hoanghuy...@gmail.com>, 2025
 #
 msgid ""
 msgstr ""
 "Project-Id-Version: fcitx5-m17n\n"
 "Report-Msgid-Bugs-To: fcitx-...@googlegroups.com\n"
-"POT-Creation-Date: 2022-10-26 20:25+0000\n"
+"POT-Creation-Date: 2025-03-12 20:24+0000\n"
 "PO-Revision-Date: 2017-12-21 01:32+0000\n"
-"Last-Translator: Zen Fas, 2022\n"
-"Language-Team: Vietnamese (https://www.transifex.com/fcitx/teams/12005/vi/)\n"
+"Last-Translator: Huy Võ <hoanghuy...@gmail.com>, 2025\n"
+"Language-Team: Vietnamese (https://app.transifex.com/fcitx/teams/12005/vi/)\n"
 "Language: vi\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
@@ -31,7 +32,7 @@
 msgid "Chewing Symbol"
 msgstr "Ký tự Chewing"
 
-#: im/engine.h:23
+#: im/engine.h:33
 msgid "Enable Deprecated"
 msgstr "Bật phản đối"
 
@@ -43,11 +44,11 @@
 msgid "Keyboard"
 msgstr "Bàn phím"
 
-#: im/m17n.conf.in.in:3
+#: im/m17n.conf.in.in:2
 msgid "M17N"
 msgstr "M17N"
 
-#: im/m17n.conf.in.in:4
+#: im/m17n.conf.in.in:3
 msgid "M17N IM Support For Fcitx"
 msgstr "Bộ gõ M17N hỗ trợ cho Fcitx"
 
@@ -61,12 +62,12 @@
 
 #: im/i18nname.cpp:14
 msgid "Pinyin"
-msgstr "Pinyin"
+msgstr "Bính âm"
 
 #. remember to update "default" in the same directory.
 #: im/i18nname.cpp:13
 msgid "Pinyin Symbol"
-msgstr "Ký tự Pinyin"
+msgstr "Ký tự Bính âm"
 
 #: im/i18nname.cpp:16
 msgid "Quick"
@@ -80,6 +81,7 @@
 msgid "Tone Pinyin"
 msgstr "Âm điệu Pinyin"
 
-#: im/engine.cpp:337
+#: im/engine.cpp:353
+#, c++-format
 msgid "{0} (M17N)"
 msgstr "{0} (M17N)"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fcitx5-m17n-5.1.1/test/CMakeLists.txt 
new/fcitx5-m17n-5.1.4/test/CMakeLists.txt
--- old/fcitx5-m17n-5.1.1/test/CMakeLists.txt   2024-04-22 09:58:03.000000000 
+0200
+++ new/fcitx5-m17n-5.1.4/test/CMakeLists.txt   2025-06-16 08:25:47.000000000 
+0200
@@ -4,6 +4,6 @@
 
 add_subdirectory(addon)
 add_executable(testm17n testm17n.cpp)
-target_link_libraries(testm17n Fcitx5::Core Fcitx5::Module::TestFrontend 
Pthread::Pthread)
+target_link_libraries(testm17n Fcitx5::Core Fcitx5::Module::TestFrontend)
 add_dependencies(testm17n m17n copy-addon)
-add_test(testm17n testm17n)
+add_test(NAME testm17n COMMAND testm17n)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fcitx5-m17n-5.1.1/test/testm17n.cpp 
new/fcitx5-m17n-5.1.4/test/testm17n.cpp
--- old/fcitx5-m17n-5.1.1/test/testm17n.cpp     2024-04-22 09:58:03.000000000 
+0200
+++ new/fcitx5-m17n-5.1.4/test/testm17n.cpp     2025-06-16 08:25:47.000000000 
+0200
@@ -7,28 +7,40 @@
 #include "testdir.h"
 #include "testfrontend_public.h"
 #include <fcitx-utils/eventdispatcher.h>
+#include <fcitx-utils/key.h>
+#include <fcitx-utils/keysym.h>
 #include <fcitx-utils/log.h>
-#include <fcitx-utils/standardpath.h>
+#include <fcitx-utils/macros.h>
 #include <fcitx-utils/testing.h>
 #include <fcitx/addonmanager.h>
 #include <fcitx/inputcontextmanager.h>
+#include <fcitx/inputmethodgroup.h>
 #include <fcitx/inputmethodmanager.h>
 #include <fcitx/instance.h>
-#include <iostream>
-#include <thread>
+#include <string>
 
 using namespace fcitx;
 
-void scheduleEvent(EventDispatcher *dispatcher, Instance *instance) {
-    dispatcher->schedule([dispatcher, instance]() {
+void scheduleEvent(Instance *instance) {
+    instance->eventDispatcher().schedule([instance]() {
         auto *m17n = instance->addonManager().addon("m17n", true);
         FCITX_ASSERT(m17n);
         auto defaultGroup = instance->inputMethodManager().currentGroup();
+        std::string wijesekaraName;
+        if (instance->inputMethodManager().entry("m17n_si_wijesekera")) {
+            wijesekaraName = "m17n_si_wijesekera";
+        } else if (instance->inputMethodManager().entry("m17n_si_wijesekara")) 
{
+            wijesekaraName = "m17n_si_wijesekara";
+        } else {
+            FCITX_ERROR()
+                << "wijesekara engine is not available, skip the test";
+            return;
+        }
         defaultGroup.inputMethodList().clear();
         defaultGroup.inputMethodList().push_back(
             InputMethodGroupItem("keyboard-us"));
         defaultGroup.inputMethodList().push_back(
-            InputMethodGroupItem("m17n_si_wijesekera"));
+            InputMethodGroupItem(wijesekaraName));
         defaultGroup.setDefaultInputMethod("");
         instance->inputMethodManager().setGroup(defaultGroup);
         auto *testfrontend = instance->addonManager().addon("testfrontend");
@@ -56,18 +68,13 @@
             uuid, Key(FcitxKey_braceright), false);
         testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("Control+space"),
                                                     false);
-
-        dispatcher->schedule([dispatcher, instance]() {
-            dispatcher->detach();
-            instance->exit();
-        });
     });
 }
 
 void runInstance() {}
 
 int main() {
-    setupTestingEnvironment(TESTING_BINARY_DIR, {TESTING_BINARY_DIR "/im"},
+    setupTestingEnvironment(TESTING_BINARY_DIR, {"bin"},
                             {TESTING_BINARY_DIR "/test"});
     // fcitx::Log::setLogRule("default=5,table=5,libime-table=5");
     char arg0[] = "testm17n";
@@ -77,11 +84,9 @@
     fcitx::Log::setLogRule("default=5,m17n=5");
     Instance instance(FCITX_ARRAY_SIZE(argv), argv);
     instance.addonManager().registerDefaultLoader(nullptr);
-    EventDispatcher dispatcher;
-    dispatcher.attach(&instance.eventLoop());
-    std::thread thread(scheduleEvent, &dispatcher, &instance);
+    scheduleEvent(&instance);
+    instance.eventDispatcher().schedule([&instance]() { instance.exit(); });
     instance.exec();
-    thread.join();
 
     return 0;
 }

Reply via email to