Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
5d429290e7
!17 [sync] PR-16: [sync] PR-15: pwl.c: allow the PWL APIs to be passed -1 as word length
From: @openeuler-sync-bot 
Reviewed-by: @lyn1001 
Signed-off-by: @lyn1001
2023-11-28 11:17:10 +00:00
liubo
d3e1a9f91e pwl.c: allow the PWL APIs to be passed -1 as word length
Signed-off-by: liubo <liubo1@xfusion.com>
(cherry picked from commit 4a7ac3c89b9d272e0dd4eb712d4f15ddb5a65bef)
(cherry picked from commit e8a0e02bc1b5eb5bc38ba26f9cab3787ac46014a)
2023-11-27 14:21:49 +08:00
openeuler-ci-bot
1e017aa1f7 !6 split aspell and voikko subpackage & backport patch that enchant2 use hunspell
From: @dowzyx
Reviewed-by: @orange-snn
Signed-off-by: @orange-snn
2021-05-12 15:07:41 +08:00
zhaoyuxing
5c97565ff0 split aspell and voikko subpackage & backport patch that enchant2 use hunspell 2021-04-29 14:10:42 +08:00
openeuler-ci-bot
68b1fb173c !5 enchant2:update to 2.2.15
From: @chengguipeng_xian
Reviewed-by: @orange-snn
Signed-off-by: @orange-snn
2021-02-01 16:29:29 +08:00
chengguipeng
28699164c5 enchant2:update to 2.2.15
Signed-off-by: chengguipeng <chengguipeng1@huawei.com>
2021-02-01 14:29:43 +08:00
openeuler-ci-bot
e3a78315a4 !3 add yaml file
Merge pull request !3 from Captain.Wei/master
2020-05-11 20:16:32 +08:00
Captain Wei
b9ea63eabe add yaml file 2020-05-11 11:30:10 +08:00
openeuler-ci-bot
b6d6a14b5c !2 delete extra patch
Merge pull request !2 from jackie_wu123/master
2020-01-20 10:19:44 +08:00
jackie_wu123
a42921c74c changelog 2020-01-19 17:31:33 +08:00
6 changed files with 209 additions and 5 deletions

View File

@ -0,0 +1,113 @@
From f6659579ec8f165db7f931eb05717f9f93ef27ef Mon Sep 17 00:00:00 2001
From: Reuben Thomas <rrt@sc3d.org>
Date: Mon, 14 Jun 2021 15:22:33 +0100
Subject: [PATCH] pwl.c: allow the PWL APIs to be passed -1 as word length
This is strictly an API/ABI change, but bump only the minor version, as in
practice it is simply an extension that makes the enchant_pwl_* APIs work
like the enchant_dict_* APIs.
---
configure.ac | 2 +-
src/pwl.c | 22 +++++++++++++++++-----
src/pwl.h | 8 ++++----
3 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/configure.ac b/configure.ac
index 4877edc..e67163e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([enchant],[2.2.15])
+AC_INIT([enchant],[2.3.0])
AC_CONFIG_SRCDIR(src/enchant.h)
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([subdir-objects])
diff --git a/src/pwl.c b/src/pwl.c
index 4f118a1..db645d5 100644
--- a/src/pwl.c
+++ b/src/pwl.c
@@ -313,8 +313,11 @@ static void enchant_pwl_remove_from_trie(EnchantPWL *pwl,
}
void enchant_pwl_add(EnchantPWL *pwl,
- const char *const word, size_t len)
+ const char *const word, ssize_t len)
{
+ if (len < 0)
+ len = strlen (word);
+
enchant_pwl_refresh_from_file(pwl);
enchant_pwl_add_to_trie(pwl, word, len);
@@ -342,7 +345,7 @@ void enchant_pwl_add(EnchantPWL *pwl,
putc ('\n', f);
}
- if (fwrite (word, sizeof(char), len, f) == len)
+ if (fwrite (word, sizeof(char), len, f) == (size_t)len)
{
putc ('\n', f);
}
@@ -353,8 +356,11 @@ void enchant_pwl_add(EnchantPWL *pwl,
}
void enchant_pwl_remove(EnchantPWL *pwl,
- const char *const word, size_t len)
+ const char *const word, ssize_t len)
{
+ if (len < 0)
+ len = strlen (word);
+
if(enchant_pwl_check(pwl, word, len) == 1)
return;
@@ -525,8 +531,11 @@ static gchar* enchant_utf8_strtitle(const gchar*str, gssize len)
return result;
}
-int enchant_pwl_check(EnchantPWL *pwl, const char *const word, size_t len)
+int enchant_pwl_check(EnchantPWL *pwl, const char *const word, ssize_t len)
{
+ if (len < 0)
+ len = strlen (word);
+
enchant_pwl_refresh_from_file(pwl);
int exists = enchant_pwl_contains(pwl, word, len);
@@ -609,8 +618,11 @@ static int best_distance(char** suggs, const char *const word, size_t len)
/* gives the best set of suggestions from pwl that are at least as good as the
* given suggs (if suggs == NULL just best from pwl) */
char** enchant_pwl_suggest(EnchantPWL *pwl, const char *const word,
- size_t len, char** suggs, size_t* out_n_suggs)
+ ssize_t len, char** suggs, size_t* out_n_suggs)
{
+ if (len < 0)
+ len = strlen (word);
+
int max_dist = suggs ? best_distance(suggs, word, len) : ENCHANT_PWL_MAX_ERRORS;
max_dist = MIN (max_dist, ENCHANT_PWL_MAX_ERRORS);
diff --git a/src/pwl.h b/src/pwl.h
index f713b29..c945e3c 100644
--- a/src/pwl.h
+++ b/src/pwl.h
@@ -42,12 +42,12 @@ typedef struct str_enchant_pwl EnchantPWL;
EnchantPWL* enchant_pwl_init(void);
EnchantPWL* enchant_pwl_init_with_file(const char * file);
-void enchant_pwl_add(EnchantPWL * me, const char *const word, size_t len);
-void enchant_pwl_remove(EnchantPWL * me, const char *const word, size_t len);
-int enchant_pwl_check(EnchantPWL * me,const char *const word, size_t len);
+void enchant_pwl_add(EnchantPWL * me, const char *const word, ssize_t len);
+void enchant_pwl_remove(EnchantPWL * me, const char *const word, ssize_t len);
+int enchant_pwl_check(EnchantPWL * me, const char *const word, ssize_t len);
/*gives the best set of suggestions from pwl that are at least as good as the given suggs*/
char** enchant_pwl_suggest(EnchantPWL *me, const char *const word,
- size_t len, char ** suggs, size_t* out_n_suggs);
+ ssize_t len, char ** suggs, size_t* out_n_suggs);
void enchant_pwl_free(EnchantPWL* me);
#ifdef __cplusplus
--
2.42.0.windows.2

View File

@ -0,0 +1,44 @@
Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1574893
Conflict: NA
---
configure.ac | 2 +-
providers/Makefile.am | 1 +
tests/test.pwl.orig | 2 --
3 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 4877edc..eda506e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -210,7 +210,7 @@ build_providers=
dnl Standard providers
ENCHANT_CHECK_PKG_CONFIG_PROVIDER([hunspell], [HUNSPELL])
ENCHANT_CHECK_PKG_CONFIG_PROVIDER([nuspell], [NUSPELL], [nuspell >= 4.1.0])
-ENCHANT_CHECK_LIB_PROVIDER([aspell], [ASPELL], [get_aspell_dict_info_list])
+ENCHANT_CHECK_PKG_CONFIG_PROVIDER([aspell], [ASPELL])
ENCHANT_CHECK_LIB_PROVIDER([hspell], [HSPELL], [hspell_get_dictionary_path],, [-lz])
ENCHANT_CHECK_PKG_CONFIG_PROVIDER([voikko], [VOIKKO], [libvoikko])
dnl FIXME: The test below assumes GCC(-compatible) ObjC++ compiler, but
diff --git a/providers/Makefile.am b/providers/Makefile.am
index 8571dcc..4ba8a94 100644
--- a/providers/Makefile.am
+++ b/providers/Makefile.am
@@ -12,6 +12,7 @@ AM_LDFLAGS = -module -avoid-version -no-undefined $(ENCHANT_LIBS) $(top_builddir
if WITH_ASPELL
provider_LTLIBRARIES += enchant_aspell.la
endif
+enchant_aspell_la_LIBADD = $(ASPELL_LIBS)
if WITH_HSPELL
provider_LTLIBRARIES += enchant_hspell.la
diff --git a/tests/test.pwl.orig b/tests/test.pwl.orig
index c6089a7..e69de29 100644
--- a/tests/test.pwl.orig
+++ b/tests/test.pwl.orig
@@ -1,2 +0,0 @@
-hello
-tag
--
2.23.0

BIN
enchant-2.2.15.tar.gz Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,15 +1,16 @@
Name: enchant2
Version: 2.2.3
Release: 6
Version: 2.2.15
Release: 3
Summary: Generic spell checking library
License: LGPLv2+
URL: https://github.com/AbiWord/enchant
Source0: https://github.com/AbiWord/enchant/releases/download/v%{version}/enchant-%{version}.tar.gz
Patch6000: backport-enchant_aspell.patch
Patch6001: 0001-pwl.c-allow-the-PWL-APIs-to-be-passed-1-as-word-leng.patch
BuildRequires: automake autoconf libtool gcc-c++ glib2-devel aspell-devel hunspell-devel libvoikko-devel
Provides: bundled(gnulib) %{name}-aspell = %{version}-%{release} %{name}-voikko = %{version}-%{release}
Obsoletes: %{name}-aspell < %{version}-%{release} %{name}-voikko < %{version}-%{release}
Provides: bundled(gnulib)
%description
Enchant aims to provide a simple but comprehensive abstraction for dealing
@ -26,6 +27,24 @@ Requires: %{name} = %{version}-%{release} glib2-devel
This package contains some libraries and header files for
development of %{name}.
%package aspell
Summary: Aspell is integrated for libenchant
Requires: %{name} = %{version}-%{release}
Provides: %{name}-aspell = %{version}-%{release}
Obsoletes: %{name}-aspell < %{version}-%{release}
%description aspell
Applications need libraries integrated by using libenchant with aspell.
%package voikko
Summary: voikko is integrated for libenchant
Requires: %{name} = %{version}-%{release}
Provides: %{name}-voikko = %{version}-%{release}
Obsoletes: %{name}-voikko < %{version}-%{release}
%description voikko
Applications need libraries integrated by using libenchant with voikko.
%package help
Summary: Help package for %{name}
Requires: %{name} = %{version}-%{release}
@ -58,9 +77,15 @@ sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g;
%license COPYING.LIB
%{_bindir}/{enchant-2,enchant-lsmod-2}
%{_libdir}/libenchant-2.so.*
%{_libdir}/enchant-2/*
%{_libdir}/enchant-2/enchant_hunspell.so
%{_datadir}/enchant-2
%files aspell
%{_libdir}/enchant-2/enchant_aspell.so*
%files voikko
%{_libdir}/enchant-2/enchant_voikko.so*
%files devel
%{_libdir}/libenchant-2.so
%{_libdir}/pkgconfig/enchant-2.pc
@ -70,5 +95,23 @@ sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g;
%{_mandir}/man1/*
%changelog
* Tue Oct 24 2023 liubo <liubo1@xfusion.com> - 2.2.15-3
- pwl.c: allow the PWL APIs to be passed -1 as word length
* Thu Apr 29 2021 zhaoyuxing <zhaoyuxing2@huawei.com> - 2.2.15-2
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC: split aspell and voikko subpackage & backport patch that enchant2 use hunspell
* Mon Feb 1 2021 chengguipeng1 <chengguipeng1@huawei.com> - 2.2.15-1
- DESC: update to 2.2.15
* Sun Jan 19 2020 wutao <wutao61@huawei.com> - 2.2.3-7
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: modify spec
* Mon Nov 04 2019 huzhiyu <huzhiyu1@huawei.com> - 2.2.3-6
- Package init

4
enchant2.yaml Normal file
View File

@ -0,0 +1,4 @@
version_control: github
src_repo: AbiWord/enchant
tag_prefix: ^v
seperator: .