1 --- misc/hunspell-1.3.2/src/hunspell/hunspell.cxx 2011-02-02 12:04:29.000000000 +0000
2 +++ misc/build/hunspell-1.3.2/src/hunspell/hunspell.cxx 2013-03-13 16:50:50.667928521 +0000
9 Hunspell::Hunspell(const char * affpath, const char * dpath, const char * key)
12 @@ -1710,6 +1712,19 @@
18 + void myrep(std::string& str, const std::string& search, const std::string& replace)
21 + while ((pos = str.find(search, pos)) != std::string::npos)
23 + str.replace(pos, search.length(), replace);
24 + pos += replace.length();
29 int Hunspell::spellml(char*** slst, const char * word)
32 @@ -1721,26 +1736,26 @@
33 q2 = strstr(q2, "<word");
34 if (!q2) return 0; // bad XML input
35 if (check_xml_par(q, "type=", "analyze")) {
38 if (get_xml_par(cw, strchr(q2, '>'), MAXWORDUTF8LEN - 10)) n = analyze(slst, cw);
40 // convert the result to <code><a>ana1</a><a>ana2</a></code> format
41 - for (int i = 0; i < n; i++) s+= strlen((*slst)[i]);
42 - char * r = (char *) malloc(6 + 5 * s + 7 * n + 7 + 1); // XXX 5*s->&->&
44 - strcpy(r, "<code>");
47 for (int i = 0; i < n; i++) {
49 - strcpy(r + l, "<a>");
50 - strcpy(r + l + 3, (*slst)[i]);
51 - mystrrep(r + l + 3, "\t", " ");
52 - mystrrep(r + l + 3, "<", "<");
53 - mystrrep(r + l + 3, "&", "&");
57 + std::string entry((*slst)[i]);
59 + myrep(entry, "\t", " ");
60 + myrep(entry, "&", "&");
61 + myrep(entry, "<", "<");
66 - strcat(r, "</code>");
68 + r.append("</code>");
69 + (*slst)[0] = mystrdup(r.c_str());
71 } else if (check_xml_par(q, "type=", "stem")) {
72 if (get_xml_par(cw, strchr(q2, '>'), MAXWORDUTF8LEN - 1)) return stem(slst, cw);