hjn_hyphen_load_file patch for sandboxing by Pawel Hajdan
This commit is contained in:
parent
327252245c
commit
3bea3aed15
|
@ -1,3 +1,9 @@
|
|||
2013-03-18 László Németh <nemeth at numbertext dot org>:
|
||||
* Makefile.am, Makefile.in: set -version-info
|
||||
|
||||
2013-03-12 Paweł Hajdan <phajdan at google>:
|
||||
* hyphen.h, hyphen.c: add hnj_hyphen_load_file() for sandboxing
|
||||
|
||||
2012-09-13 László Németh <nemeth at numbertext dot org>:
|
||||
* hyphen.c: fdo#43931: removing hard hyphen hyphenation for LibreOffice
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ SUBDIRS= doc tests
|
|||
|
||||
lib_LTLIBRARIES = libhyphen.la
|
||||
libhyphen_la_SOURCES = hnjalloc.c hyphen.c
|
||||
libhyphen_la_LDFLAGS = -version-info 2:1:2
|
||||
libhyphen_la_LDFLAGS = -version-info 3:0:3
|
||||
include_HEADERS = hyphen.h
|
||||
noinst_HEADERS = hnjalloc.h
|
||||
|
||||
|
|
|
@ -288,7 +288,7 @@ top_srcdir = @top_srcdir@
|
|||
SUBDIRS = doc tests
|
||||
lib_LTLIBRARIES = libhyphen.la
|
||||
libhyphen_la_SOURCES = hnjalloc.c hyphen.c
|
||||
libhyphen_la_LDFLAGS = -version-info 2:1:2
|
||||
libhyphen_la_LDFLAGS = -version-info 3:0:3
|
||||
include_HEADERS = hyphen.h
|
||||
noinst_HEADERS = hnjalloc.h
|
||||
substrings_SOURCES = substrings.c
|
||||
|
|
22
hyphen.c
22
hyphen.c
|
@ -373,20 +373,29 @@ void hnj_hyphen_load_line(char * buf, HyphenDict * dict, HashTab * hashtab) {
|
|||
|
||||
HyphenDict *
|
||||
hnj_hyphen_load (const char *fn)
|
||||
{
|
||||
HyphenDict *result;
|
||||
FILE *f;
|
||||
f = fopen (fn, "r");
|
||||
if (f == NULL)
|
||||
return NULL;
|
||||
|
||||
result = hnj_hyphen_load_file(f);
|
||||
|
||||
fclose(f);
|
||||
return result;
|
||||
}
|
||||
|
||||
HyphenDict *
|
||||
hnj_hyphen_load_file (FILE *f)
|
||||
{
|
||||
HyphenDict *dict[2];
|
||||
HashTab *hashtab;
|
||||
FILE *f;
|
||||
char buf[MAX_CHARS];
|
||||
int nextlevel = 0;
|
||||
int i, j, k;
|
||||
HashEntry *e;
|
||||
int state_num = 0;
|
||||
|
||||
f = fopen (fn, "r");
|
||||
if (f == NULL)
|
||||
return NULL;
|
||||
|
||||
// loading one or two dictionaries (separated by NEXTLEVEL keyword)
|
||||
for (k = 0; k < 2; k++) {
|
||||
hashtab = hnj_hash_new ();
|
||||
|
@ -497,7 +506,6 @@ for (k = 0; k < 2; k++) {
|
|||
#endif
|
||||
state_num = 0;
|
||||
}
|
||||
fclose(f);
|
||||
if (nextlevel) dict[0]->nextlevel = dict[1];
|
||||
else {
|
||||
dict[1] -> nextlevel = dict[0];
|
||||
|
|
Loading…
Reference in New Issue