Gentoo Archives: gentoo-commits

From: "Lars Wendler (polynomial-c)" <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in app-text/hunspell/files: hunspell-1.3.3-multibyte-chars.patch
Date: Fri, 01 Aug 2014 20:00:19
Message-Id: 20140801200013.AE64720035@flycatcher.gentoo.org
1 polynomial-c 14/08/01 20:00:11
2
3 Added: hunspell-1.3.3-multibyte-chars.patch
4 Log:
5 Version bump (bug #518740).
6
7 (Portage version: 2.2.10/cvs/Linux x86_64, signed Manifest commit with key 0x981CA6FC)
8
9 Revision Changes Path
10 1.1 app-text/hunspell/files/hunspell-1.3.3-multibyte-chars.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-text/hunspell/files/hunspell-1.3.3-multibyte-chars.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-text/hunspell/files/hunspell-1.3.3-multibyte-chars.patch?rev=1.1&content-type=text/plain
14
15 Index: hunspell-1.3.3-multibyte-chars.patch
16 ===================================================================
17 http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7781#31
18 https://bugs.gentoo.org/518740
19
20 --- src/tools/hunspell.cxx
21 +++ src/tools/hunspell.cxx
22 @@ -710,13 +748,22 @@ if (pos >= 0) {
23 fflush(stdout);
24 } else {
25 char ** wlst = NULL;
26 - int ns = pMS[d]->suggest(&wlst, token);
27 + int byte_offset = parser->get_tokenpos() + pos;
28 + int char_offset = 0;
29 + if (strcmp(io_enc, "UTF-8") == 0) {
30 + for (int i = 0; i < byte_offset; i++) {
31 + if ((buf[i] & 0xc0) != 0x80)
32 + char_offset++;
33 + }
34 + } else {
35 + char_offset = byte_offset;
36 + }
37 + int ns = pMS[d]->suggest(&wlst, chenc(token, io_enc, dic_enc[d]));
38 if (ns == 0) {
39 - fprintf(stdout,"# %s %d", token,
40 - parser->get_tokenpos() + pos);
41 + fprintf(stdout,"# %s %d", token, char_offset);
42 } else {
43 fprintf(stdout,"& %s %d %d: ", token, ns,
44 - parser->get_tokenpos() + pos);
45 + char_offset);
46 fprintf(stdout,"%s", chenc(wlst[0], dic_enc[d], io_enc));
47 }
48 for (int j = 1; j < ns; j++) {
49 @@ -745,13 +792,23 @@ if (pos >= 0) {
50 if (root) free(root);
51 } else {
52 char ** wlst = NULL;
53 + int byte_offset = parser->get_tokenpos() + pos;
54 + int char_offset = 0;
55 + if (strcmp(io_enc, "UTF-8") == 0) {
56 + for (int i = 0; i < byte_offset; i++) {
57 + if ((buf[i] & 0xc0) != 0x80)
58 + char_offset++;
59 + }
60 + } else {
61 + char_offset = byte_offset;
62 + }
63 int ns = pMS[d]->suggest(&wlst, chenc(token, io_enc, dic_enc[d]));
64 if (ns == 0) {
65 fprintf(stdout,"# %s %d", chenc(token, io_enc, ui_enc),
66 - parser->get_tokenpos() + pos);
67 + char_offset);
68 } else {
69 fprintf(stdout,"& %s %d %d: ", chenc(token, io_enc, ui_enc), ns,
70 - parser->get_tokenpos() + pos);
71 + char_offset);
72 fprintf(stdout,"%s", chenc(wlst[0], dic_enc[d], ui_enc));
73 }
74 for (int j = 1; j < ns; j++) {