From 4a430e108eba243c8ec6534acaab6250aacef35d Mon Sep 17 00:00:00 2001 From: xiefangqi Date: Tue, 2 Nov 2021 15:50:59 +0800 Subject: [PATCH] add patch2 to sentencepiece --- fix_of_an_unattainable_condition.patch | 22 ++++++++++++++++++++++ sentencepiece.spec | 5 ++++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 fix_of_an_unattainable_condition.patch diff --git a/fix_of_an_unattainable_condition.patch b/fix_of_an_unattainable_condition.patch new file mode 100644 index 0000000..4882a2d --- /dev/null +++ b/fix_of_an_unattainable_condition.patch @@ -0,0 +1,22 @@ +diff --git a/third_party/esaxx/sais.hxx b/third_party/esaxx/sais.hxx +index f1702f8..b9071c8 100644 +--- a/third_party/esaxx/sais.hxx ++++ b/third_party/esaxx/sais.hxx +@@ -179,7 +179,7 @@ typedef typename std::iterator_traits::value_type char_type; + sort all the S-substrings */ + if(fs < (maxthreads * k)) { + index_type *C, *B; +- if((C = new index_type[maxthreads * k]) == 0) { return -2; } ++ C = new index_type[maxthreads * k]; + B = (1 < maxthreads) ? C + k : C; + getCounts(T, C, n, k); getBuckets(C, B, k, true); /* find ends of buckets */ + #ifdef _OPENMP +@@ -271,7 +271,7 @@ typedef typename std::iterator_traits::value_type char_type; + /* stage 3: induce the result for the original problem */ + if(fs < (maxthreads * k)) { + index_type *B, *C; +- if((C = new index_type[maxthreads * k]) == 0) { return -2; } ++ C = new index_type[maxthreads * k]; + B = (1 < maxthreads) ? C + k : C; + /* put all left-most S characters into their buckets */ + getCounts(T, C, n, k); getBuckets(C, B, k, true); /* find ends of buckets */ diff --git a/sentencepiece.spec b/sentencepiece.spec index 6f1120a..e64956c 100644 --- a/sentencepiece.spec +++ b/sentencepiece.spec @@ -1,11 +1,12 @@ Name: sentencepiece Version: 0.1.92 -Release: 3 +Release: 4 Summary: An unsupervised text tokenizer and detokenizer License: Apache-2.0 URL: https://github.com/google/sentencepiece Source0: https://github.com/google/sentencepiece/archive/v%{version}.tar.gz Patch0: Removed-codes-where-Zero-Width-Joiner-replaced-with-.patch +Patch1: fix_of_an_unattainable_condition.patch BuildRequires: gcc-c++ gcc autoconf pkgconfig protobuf-compiler protobuf BuildRequires: cmake >= 3.14.0 Requires: protobuf protobuf-compiler @@ -48,6 +49,8 @@ make install %{_includedir}/sentencepiece_*.h %changelog +* Tue Nov 2 2021 xiefangqi - 0.1.92-4 +- fix of an unattainable condition * Tue Nov 2 2021 xiefangqi - 0.1.92-3 - Prevent Zero Width Joiner replaced with whitespace * Wed Sep 29 2021 xiefangqi - 0.1.92-2