update to latest stable version
This commit is contained in:
parent
b601bcd85b
commit
0f0d060cea
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
||||
/hunspell-1.3.2.tar.gz
|
||||
/hunspell-1.3.3.tar.gz
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,74 +0,0 @@
|
||||
Index: src/tools/hunspell.cxx
|
||||
===================================================================
|
||||
RCS file: /cvsroot/hunspell/hunspell/src/tools/hunspell.cxx,v
|
||||
retrieving revision 1.28
|
||||
diff -u -r1.28 hunspell.cxx
|
||||
--- src/tools/hunspell.cxx 21 Jan 2011 17:30:41 -0000 1.28
|
||||
+++ src/tools/hunspell.cxx 6 Dec 2011 22:44:15 -0000
|
||||
@@ -128,8 +128,6 @@
|
||||
#define readline scanline
|
||||
#endif
|
||||
|
||||
-#define TEMPNAME "hunSPELL.bak"
|
||||
-
|
||||
extern char * mystrdup(const char * s);
|
||||
|
||||
// file formats:
|
||||
@@ -1316,14 +1314,12 @@
|
||||
char * extension = basename(filename, '.');
|
||||
parser = get_parser(format, extension, pMS[0]);
|
||||
|
||||
- char * tempname = (char *) malloc(strlen(filename) + strlen(TEMPNAME) + 1);
|
||||
- strcpy(tempname, filename);
|
||||
- strcpy(basename(tempname, DIRSEPCH), TEMPNAME);
|
||||
-
|
||||
- FILE *tempfile;
|
||||
+
|
||||
+ FILE *tempfile = tmpfile();
|
||||
|
||||
- if (!(tempfile = fopen(tempname, "w"))) {
|
||||
- fprintf(stderr, gettext("Can't create tempfile %s.\n"), tempname);
|
||||
+ if (!tempfile)
|
||||
+ {
|
||||
+ perror(gettext("Can't create tempfile"));
|
||||
endwin();
|
||||
exit(1);
|
||||
}
|
||||
@@ -1337,7 +1333,7 @@
|
||||
case -1: {
|
||||
clear();
|
||||
refresh();
|
||||
- unlink(tempname);
|
||||
+ fclose(tempfile); //automatically deleted when closed
|
||||
endwin();
|
||||
exit(0);
|
||||
}
|
||||
@@ -1350,15 +1346,22 @@
|
||||
}
|
||||
}
|
||||
fclose(text);
|
||||
- fclose(tempfile);
|
||||
delete parser;
|
||||
|
||||
- if (! modified) {
|
||||
- unlink(tempname);
|
||||
- } else {
|
||||
- rename(tempname, filename);
|
||||
+ if (modified) {
|
||||
+ rewind(tempfile);
|
||||
+ text = fopen(filename, "wb");
|
||||
+
|
||||
+ size_t n;
|
||||
+ while ((n = fread(buf, 1, MAXLNLEN, tempfile)) > 0)
|
||||
+ {
|
||||
+ if (fwrite(buf, 1, n, text) != n)
|
||||
+ perror("write failed");
|
||||
+ }
|
||||
+
|
||||
+ fclose(text);
|
||||
}
|
||||
- free(tempname);
|
||||
+ fclose(tempfile); //automatically deleted when closed
|
||||
}
|
||||
|
||||
#endif
|
@ -1,72 +0,0 @@
|
||||
--- src/hunspell/hunspell.cxx 2011-02-02 12:04:29.000000000 +0000
|
||||
+++ src/hunspell/hunspell.cxx 2013-03-13 16:50:50.667928521 +0000
|
||||
@@ -12,6 +12,8 @@
|
||||
#endif
|
||||
#include "csutil.hxx"
|
||||
|
||||
+#include <string>
|
||||
+
|
||||
Hunspell::Hunspell(const char * affpath, const char * dpath, const char * key)
|
||||
{
|
||||
encoding = NULL;
|
||||
@@ -1710,6 +1712,19 @@
|
||||
return n;
|
||||
}
|
||||
|
||||
+namespace
|
||||
+{
|
||||
+ void myrep(std::string& str, const std::string& search, const std::string& replace)
|
||||
+ {
|
||||
+ size_t pos = 0;
|
||||
+ while ((pos = str.find(search, pos)) != std::string::npos)
|
||||
+ {
|
||||
+ str.replace(pos, search.length(), replace);
|
||||
+ pos += replace.length();
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
int Hunspell::spellml(char*** slst, const char * word)
|
||||
{
|
||||
char *q, *q2;
|
||||
@@ -1721,26 +1736,26 @@
|
||||
q2 = strstr(q2, "<word");
|
||||
if (!q2) return 0; // bad XML input
|
||||
if (check_xml_par(q, "type=", "analyze")) {
|
||||
- int n = 0, s = 0;
|
||||
+ int n = 0;
|
||||
if (get_xml_par(cw, strchr(q2, '>'), MAXWORDUTF8LEN - 10)) n = analyze(slst, cw);
|
||||
if (n == 0) return 0;
|
||||
// convert the result to <code><a>ana1</a><a>ana2</a></code> format
|
||||
- for (int i = 0; i < n; i++) s+= strlen((*slst)[i]);
|
||||
- char * r = (char *) malloc(6 + 5 * s + 7 * n + 7 + 1); // XXX 5*s->&->&
|
||||
- if (!r) return 0;
|
||||
- strcpy(r, "<code>");
|
||||
+ std::string r;
|
||||
+ r.append("<code>");
|
||||
for (int i = 0; i < n; i++) {
|
||||
- int l = strlen(r);
|
||||
- strcpy(r + l, "<a>");
|
||||
- strcpy(r + l + 3, (*slst)[i]);
|
||||
- mystrrep(r + l + 3, "\t", " ");
|
||||
- mystrrep(r + l + 3, "<", "<");
|
||||
- mystrrep(r + l + 3, "&", "&");
|
||||
- strcat(r, "</a>");
|
||||
+ r.append("<a>");
|
||||
+
|
||||
+ std::string entry((*slst)[i]);
|
||||
free((*slst)[i]);
|
||||
+ myrep(entry, "\t", " ");
|
||||
+ myrep(entry, "&", "&");
|
||||
+ myrep(entry, "<", "<");
|
||||
+ r.append(entry);
|
||||
+
|
||||
+ r.append("</a>");
|
||||
}
|
||||
- strcat(r, "</code>");
|
||||
- (*slst)[0] = r;
|
||||
+ r.append("</code>");
|
||||
+ (*slst)[0] = mystrdup(r.c_str());
|
||||
return 1;
|
||||
} else if (check_xml_par(q, "type=", "stem")) {
|
||||
if (get_xml_par(cw, strchr(q2, '>'), MAXWORDUTF8LEN - 1)) return stem(slst, cw);
|
@ -1,84 +0,0 @@
|
||||
Index: man/hunspell.1
|
||||
===================================================================
|
||||
RCS file: /cvsroot/hunspell/hunspell/man/hunspell.1,v
|
||||
retrieving revision 1.4
|
||||
diff -u -r1.4 hunspell.1
|
||||
--- man/hunspell.1 13 Jun 2013 19:13:50 -0000 1.4
|
||||
+++ man/hunspell.1 25 Jul 2013 08:26:50 -0000
|
||||
@@ -385,5 +385,3 @@
|
||||
see hunspell(3).
|
||||
.PP
|
||||
This manual based on Ispell's manual. See ispell(1).
|
||||
-.SH BUGS
|
||||
-There are some layout problems with long lines.
|
||||
Index: src/tools/hunspell.cxx
|
||||
===================================================================
|
||||
RCS file: /cvsroot/hunspell/hunspell/src/tools/hunspell.cxx,v
|
||||
retrieving revision 1.34
|
||||
diff -u -r1.34 hunspell.cxx
|
||||
--- src/tools/hunspell.cxx 13 Jun 2013 19:37:30 -0000 1.34
|
||||
+++ src/tools/hunspell.cxx 25 Jul 2013 08:26:50 -0000
|
||||
@@ -854,18 +854,19 @@
|
||||
// like mbstowcs which isn't quite correct, but close enough for western
|
||||
// text in UTF-8
|
||||
void strncpyu8(char * dest, const char * src, int begin, int n) {
|
||||
- int u8 = ((ui_enc != NULL) && (strcmp(ui_enc, "UTF-8") == 0)) ? 1 : 0;
|
||||
- int i = 0;
|
||||
- while (i < begin + n) {
|
||||
- if (i >= begin)
|
||||
- {
|
||||
- if (!*src)
|
||||
- break;
|
||||
- *dest++ = *src;
|
||||
+ if (n) {
|
||||
+ int u8 = ((ui_enc != NULL) && (strcmp(ui_enc, "UTF-8") == 0)) ? 1 : 0;
|
||||
+ for (int i = 0; i < begin + n;) {
|
||||
+ if (!*src) break; // source is at it's end
|
||||
+ if (!u8 || (*src & 0xc0) != 0x80) i++; // new character
|
||||
+ if(i > begin){ // copy char (w/ utf-8 bytes)
|
||||
+ *dest++ = *src++;
|
||||
+ while(u8 && (*src & 0xc0) == 0x80) *dest++ = *src++;
|
||||
+ }else{ // skip char (w/ utf-8 bytes)
|
||||
+ ++src;
|
||||
+ while(u8 && (*src & 0xc0) == 0x80) ++src;
|
||||
+ }
|
||||
}
|
||||
- if (!u8 || (*src & 0xc0) != 0x80)
|
||||
- i++;
|
||||
- ++src;
|
||||
}
|
||||
*dest = '\0';
|
||||
}
|
||||
@@ -902,8 +903,6 @@
|
||||
expand_tab(lines[i], chenc(parser->get_prevline(i), io_enc, ui_enc), MAXLNLEN);
|
||||
}
|
||||
|
||||
- int prevline = 0;
|
||||
-
|
||||
strncpy(line, parser->get_prevline(0), parser->get_tokenpos());
|
||||
line[parser->get_tokenpos()] = '\0';
|
||||
int tokenbeg = expand_tab(line2, chenc(line, io_enc, ui_enc), MAXLNLEN);
|
||||
@@ -912,10 +911,13 @@
|
||||
line[parser->get_tokenpos() + strlen(token)] = '\0';
|
||||
int tokenend = expand_tab(line2, chenc(line, io_enc, ui_enc), MAXLNLEN);
|
||||
|
||||
- int rowindex = tokenend / x;
|
||||
+ int rowindex = (tokenend - 1) / x;
|
||||
int beginrow = rowindex - tokenbeg / x;
|
||||
if (beginrow >= MAXPREVLINE) beginrow = MAXPREVLINE - 1;
|
||||
|
||||
+ int ri = rowindex;
|
||||
+ int prevline = 0;
|
||||
+
|
||||
for (int i = 0; i < MAXPREVLINE; i++) {
|
||||
strncpyu8(line, lines[prevline], x * rowindex, x);
|
||||
mvprintw(MAXPREVLINE + 1 - i, 0, "%s", line);
|
||||
@@ -927,7 +929,7 @@
|
||||
}
|
||||
|
||||
int linestartpos = tokenbeg - (tokenbeg % x);
|
||||
- strncpyu8(line, lines[0], x * rowindex + linestartpos, tokenbeg % x);
|
||||
+ strncpyu8(line, lines[0], x * (ri - beginrow), tokenbeg % x) ;
|
||||
mvprintw(MAXPREVLINE + 1 - beginrow, 0, "%s", line);
|
||||
attron(A_REVERSE);
|
||||
printw("%s", chenc(token, io_enc, ui_enc));
|
@ -2,8 +2,8 @@
|
||||
|
||||
Name: hunspell
|
||||
Summary: A spell checker and morphological analyzer library
|
||||
Version: 1.3.2
|
||||
Release: 15%{?dist}
|
||||
Version: 1.3.3
|
||||
Release: 1%{?dist}
|
||||
Source: http://downloads.sourceforge.net/%{name}/hunspell-%{version}.tar.gz
|
||||
Group: System Environment/Libraries
|
||||
URL: http://hunspell.sourceforge.net/
|
||||
@ -17,11 +17,6 @@ BuildRequires: valgrind
|
||||
BuildRequires: words
|
||||
%endif
|
||||
Requires: hunspell-en-US
|
||||
Patch0: hunspell.rhbz759647.patch
|
||||
Patch1: hunspell.rhbz918938.patch
|
||||
Patch2: hunspell-aarch64.patch
|
||||
Patch3: hunspell.rhbz985052.patch
|
||||
Patch4: manpage.esc.space.patch
|
||||
|
||||
%description
|
||||
Hunspell is a spell checker and morphological analyzer library and program
|
||||
@ -39,11 +34,6 @@ Includes and definitions for developing with hunspell
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p0 -b .rhbz759647
|
||||
%patch1 -p0 -b .rhbz918938
|
||||
%patch2 -p1 -b .aarch64
|
||||
%patch3 -p0 -b .rhbz985052
|
||||
%patch4 -p1 -b .manpage.esc.space
|
||||
|
||||
%build
|
||||
configureflags="--disable-rpath --disable-static --with-ui --with-readline"
|
||||
@ -108,9 +98,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_datadir}/myspell
|
||||
%{_bindir}/hunspell
|
||||
%{_mandir}/man1/hunspell.1.gz
|
||||
%{_mandir}/man4/hunspell.4.gz
|
||||
%lang(hu) %{_mandir}/hu/man1/hunspell.1.gz
|
||||
%lang(hu) %{_mandir}/hu/man4/hunspell.4.gz
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root,-)
|
||||
@ -131,8 +119,12 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_mandir}/man1/hunzip.1.gz
|
||||
%{_mandir}/man1/hzip.1.gz
|
||||
%{_mandir}/man3/hunspell.3.gz
|
||||
%{_mandir}/man5/hunspell.5.gz
|
||||
|
||||
%changelog
|
||||
* Wed Jun 04 2014 Caolán McNamara <caolanm@redhat.com> - 1.3.3-1
|
||||
- Resolves: rhbz#1104042 update to latest version
|
||||
|
||||
* Tue Oct 15 2013 Caolán McNamara <caolanm@redhat.com> - 1.3.2-15
|
||||
- Resolves: rhbz#1019158 esc space in man page
|
||||
|
||||
|
@ -1,12 +0,0 @@
|
||||
diff -ru hunspell-1.3.2/man/hzip.1 hunspell-1.3.2/man/hzip.1
|
||||
--- hunspell-1.3.2/man/hzip.1 2013-10-15 11:35:17.788291795 +0100
|
||||
+++ hunspell-1.3.2/man/hzip.1 2013-10-15 11:35:22.955351493 +0100
|
||||
@@ -16,7 +16,7 @@
|
||||
.SH OPTIONS
|
||||
.IP \fB\-h\fR
|
||||
Display short help description.
|
||||
-.IP \fB\-P password\fR
|
||||
+.IP \fB\-P\ password\fR
|
||||
Encrypted compression by an arbitrary length password.
|
||||
.SH SEE ALSO
|
||||
.B hzip (1), hunspell(1)
|
Loading…
Reference in New Issue
Block a user