Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / external / hunspell / 0001-cppcheck-rv-is-reassigned-before-old-value-used.patch
blobbfcdf490a0a9abf3dbeba092e10bfe3230efa840
1 From 93156ba9a8e644f8b0b724880668714adcb0d094 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
3 Date: Mon, 23 Jan 2017 12:05:07 +0000
4 Subject: [PATCH] cppcheck: rv is reassigned before old value used
6 ---
7 src/hunspell/affixmgr.cxx | 6 ++----
8 src/hunspell/suggestmgr.cxx | 3 +--
9 2 files changed, 3 insertions(+), 6 deletions(-)
11 diff --git a/src/hunspell/affixmgr.cxx b/src/hunspell/affixmgr.cxx
12 index 680cbe9..21cf384 100644
13 --- a/src/hunspell/affixmgr.cxx
14 +++ b/src/hunspell/affixmgr.cxx
15 @@ -1494,9 +1494,8 @@ int AffixMgr::defcpd_check(hentry*** words,
18 inline int AffixMgr::candidate_check(const char* word, int len) {
19 - struct hentry* rv = NULL;
21 - rv = lookup(word);
22 + struct hentry* rv = lookup(word);
23 if (rv)
24 return 1;
26 @@ -3045,10 +3044,9 @@ struct hentry* AffixMgr::affix_check(const char* word,
27 int len,
28 const FLAG needflag,
29 char in_compound) {
30 - struct hentry* rv = NULL;
32 // check all prefixes (also crossed with suffixes if allowed)
33 - rv = prefix_check(word, len, in_compound, needflag);
34 + struct hentry* rv = prefix_check(word, len, in_compound, needflag);
35 if (rv)
36 return rv;
38 diff --git a/src/hunspell/suggestmgr.cxx b/src/hunspell/suggestmgr.cxx
39 index 8d46dd6..54a474f 100644
40 --- a/src/hunspell/suggestmgr.cxx
41 +++ b/src/hunspell/suggestmgr.cxx
42 @@ -1675,11 +1675,10 @@ std::string SuggestMgr::suggest_hentry_gen(hentry* rv, const char* pattern) {
43 if (HENTRY_DATA(rv))
44 p = (char*)strstr(HENTRY_DATA2(rv), MORPH_ALLOMORPH);
45 while (p) {
46 - struct hentry* rv2 = NULL;
47 p += MORPH_TAG_LEN;
48 int plen = fieldlen(p);
49 std::string allomorph(p, plen);
50 - rv2 = pAMgr->lookup(allomorph.c_str());
51 + struct hentry* rv2 = pAMgr->lookup(allomorph.c_str());
52 while (rv2) {
53 // if (HENTRY_DATA(rv2) && get_sfxcount(HENTRY_DATA(rv2)) <=
54 // sfxcount) {
55 --
56 2.9.3