Add pointer casts for C89 compatibility

Related to:

  <https://fedoraproject.org/wiki/Changes/PortingToModernC>
  <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>
This commit is contained in:
Florian Weimer 2024-01-21 14:39:52 +01:00
parent 91ece45354
commit 651d366bca
2 changed files with 34 additions and 1 deletions

28
ibus-libpinyin-c89.patch Normal file
View File

@ -0,0 +1,28 @@
Lua plugin: Add pointer casts for C89 compatibility
This addresses a build failure with GCC 14.
Submitted upstream: <https://github.com/libpinyin/ibus-libpinyin/pull/449>
diff --git a/lua/lua-plugin-init.c b/lua/lua-plugin-init.c
index c6fa9bac806167a4..e6e86ec8c2511a1c 100644
--- a/lua/lua-plugin-init.c
+++ b/lua/lua-plugin-init.c
@@ -409,7 +409,7 @@ static int ime_utf8_to_utf16(lua_State* L){
gunichar2 * str = g_utf8_to_utf16(s, l, NULL, &written, NULL);
/* not includes trailing-zero */
- luaL_addlstring(&buf, str, written * sizeof(gunichar2));
+ luaL_addlstring(&buf, (const char *)str, written * sizeof(gunichar2));
luaL_pushresult(&buf);
g_free(str);
@@ -419,7 +419,7 @@ static int ime_utf8_to_utf16(lua_State* L){
static int ime_utf16_to_utf8(lua_State* L){
size_t l;
- const gunichar2 * s = luaL_checklstring(L, 1, &l);
+ const gunichar2 * s = (const gunichar2 *)luaL_checklstring(L, 1, &l);
luaL_Buffer buf;
luaL_buffinit(L, &buf);

View File

@ -2,7 +2,7 @@
Name: ibus-libpinyin
Version: 1.15.6
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Intelligent Pinyin engine based on libpinyin for IBus
License: GPL-3.0-or-later
URL: https://github.com/libpinyin/ibus-libpinyin
@ -10,6 +10,7 @@ Source0: http://downloads.sourceforge.net/libpinyin/ibus-libpinyin/%{name}-%{
%if %snapshot
Patch0: ibus-libpinyin-1.15.x-head.patch
%endif
Patch1: ibus-libpinyin-c89.patch
Requires: python3-gobject
Requires: ibus >= 1.5.11
@ -41,6 +42,7 @@ input method based on libpinyin for IBus.
%if %snapshot
%patch0 -p1 -b .head
%endif
%patch1 -p1
%build
%configure --disable-static \
@ -81,6 +83,9 @@ desktop-file-validate $RPM_BUILD_ROOT%{_datadir}/applications/ibus-setup-libbopo
%{_datadir}/ibus/component/*
%changelog
* Sun Jan 21 2024 Florian Weimer <fweimer@redhat.com> - 1.15.6-3
- Add pointer casts for C89 compatibility
* Sat Jan 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.15.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild