Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / external / hunspell / 0001-loop-via-iterators.patch
blob6ecdd769e3bf3730ab2d8908b00e66cb5895f70d
1 From f366e97fa8d7ad21060033b733dda15299edf7c5 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
3 Date: Fri, 10 Feb 2017 15:37:11 +0000
4 Subject: [PATCH 1/4] loop via iterators
6 ---
7 src/hunspell/csutil.cxx | 8 ++++++--
8 1 file changed, 6 insertions(+), 2 deletions(-)
10 diff --git a/src/hunspell/csutil.cxx b/src/hunspell/csutil.cxx
11 index c1666a5..2408677 100644
12 --- a/src/hunspell/csutil.cxx
13 +++ b/src/hunspell/csutil.cxx
14 @@ -2537,13 +2537,17 @@ int get_captype_utf8(const std::vector<w_char>& word, int langnum) {
15 size_t ncap = 0;
16 size_t nneutral = 0;
17 size_t firstcap = 0;
18 - for (size_t i = 0; i < word.size(); ++i) {
19 - unsigned short idx = (word[i].h << 8) + word[i].l;
21 + std::vector<w_char>::const_iterator it = word.begin();
22 + std::vector<w_char>::const_iterator it_end = word.end();
23 + while (it != it_end) {
24 + unsigned short idx = (it->h << 8) + it->l;
25 unsigned short lwridx = unicodetolower(idx, langnum);
26 if (idx != lwridx)
27 ncap++;
28 if (unicodetoupper(idx, langnum) == lwridx)
29 nneutral++;
30 + ++it;
32 if (ncap) {
33 unsigned short idx = (word[0].h << 8) + word[0].l;
34 --
35 2.9.3