fix coverity warnings

This commit is contained in:
Caolán McNamara 2012-06-29 10:02:24 +00:00
parent a86803cdae
commit 5a60cb75a9
12 changed files with 6174 additions and 3394 deletions

View File

@ -1,3 +1,6 @@
2010-07-18 Caolán McNamara <caolán at redhat dot com>:
* coverity warnings
2011-10-10 László Németh <nemeth at numbertext dot org>:
* hyphen.c:
- fix NOHYPHEN (hyphenation vector

View File

@ -1,9 +1,9 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@ -75,6 +75,12 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
"$(DESTDIR)$(hyphdir)" "$(DESTDIR)$(includedir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
@ -130,9 +136,11 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d "$(distdir)" \
|| { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr "$(distdir)"; }; }
if test -d "$(distdir)"; then \
find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -rf "$(distdir)" \
|| { sleep 5 && rm -rf "$(distdir)"; }; \
else :; fi
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
@ -161,6 +169,8 @@ am__relativize = \
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
@ -177,6 +187,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@ -200,6 +211,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
@ -225,6 +237,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
@ -257,7 +270,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@ -296,7 +308,7 @@ all: all-recursive
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
am--refresh:
am--refresh: Makefile
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
@ -361,7 +373,7 @@ clean-libLTLIBRARIES:
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libhyphen.la: $(libhyphen_la_OBJECTS) $(libhyphen_la_DEPENDENCIES)
libhyphen.la: $(libhyphen_la_OBJECTS) $(libhyphen_la_DEPENDENCIES) $(EXTRA_libhyphen_la_DEPENDENCIES)
$(libhyphen_la_LINK) -rpath $(libdir) $(libhyphen_la_OBJECTS) $(libhyphen_la_LIBADD) $(LIBS)
clean-noinstPROGRAMS:
@ -372,10 +384,10 @@ clean-noinstPROGRAMS:
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
example$(EXEEXT): $(example_OBJECTS) $(example_DEPENDENCIES)
example$(EXEEXT): $(example_OBJECTS) $(example_DEPENDENCIES) $(EXTRA_example_DEPENDENCIES)
@rm -f example$(EXEEXT)
$(LINK) $(example_OBJECTS) $(example_LDADD) $(LIBS)
substrings$(EXEEXT): $(substrings_OBJECTS) $(substrings_DEPENDENCIES)
substrings$(EXEEXT): $(substrings_OBJECTS) $(substrings_DEPENDENCIES) $(EXTRA_substrings_DEPENDENCIES)
@rm -f substrings$(EXEEXT)
$(LINK) $(substrings_OBJECTS) $(substrings_LDADD) $(LIBS)
install-binSCRIPTS: $(bin_SCRIPTS)
@ -409,9 +421,7 @@ uninstall-binSCRIPTS:
@list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 's,.*/,,;$(transform)'`; \
test -n "$$list" || exit 0; \
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(bindir)" && rm -f $$files
dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@ -470,9 +480,7 @@ uninstall-hyphDATA:
@$(NORMAL_UNINSTALL)
@list='$(hyph_DATA)'; test -n "$(hyphdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(hyphdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(hyphdir)" && rm -f $$files
dir='$(DESTDIR)$(hyphdir)'; $(am__uninstall_files_from_dir)
install-includeHEADERS: $(include_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
@ -490,9 +498,7 @@ uninstall-includeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(includedir)" && rm -f $$files
dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
@ -701,7 +707,11 @@ dist-gzip: distdir
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-lzip: distdir
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
$(am__remove_distdir)
dist-lzma: distdir
@ -709,7 +719,7 @@ dist-lzma: distdir
$(am__remove_distdir)
dist-xz: distdir
tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
$(am__remove_distdir)
dist-tarZ: distdir
@ -740,6 +750,8 @@ distcheck: dist
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lzma*) \
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
*.tar.lz*) \
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
*.tar.xz*) \
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \
@ -759,6 +771,7 @@ distcheck: dist
&& am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
@ -787,8 +800,16 @@ distcheck: dist
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
@$(am__cd) '$(distuninstallcheck_dir)' \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
@test -n '$(distuninstallcheck_dir)' || { \
echo 'ERROR: trying to run $@ with an empty' \
'$$(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
$(am__cd) '$(distuninstallcheck_dir)' || { \
echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
@ -823,10 +844,15 @@ install-am: all-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
@ -920,8 +946,8 @@ uninstall-am: uninstall-binSCRIPTS uninstall-hyphDATA \
all all-am am--refresh check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool clean-local \
clean-noinstPROGRAMS ctags ctags-recursive dist dist-all \
dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ dist-xz \
dist-zip distcheck distclean distclean-compile \
dist-bzip2 dist-gzip dist-lzip dist-lzma dist-shar dist-tarZ \
dist-xz dist-zip distcheck distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags \
distcleancheck distdir distuninstallcheck dvi dvi-am html \
html-am info info-am install install-am install-binSCRIPTS \

3
NEWS
View File

@ -1,3 +1,6 @@
2012-06-29 Hyphen 2.8.4:
- coverity warnings
2011-10-10 Hyphen 2.8.3:
- fix NOHYPHEN
- fix unbalanced hyphenation of LibreOffice/OOo

2415
aclocal.m4 vendored

File diff suppressed because it is too large Load Diff

2812
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
AC_INIT([hyphen],[2.8.3],[nemeth@numbertext.org])
AM_INIT_AUTOMAKE(hyphen,2.8.3)
AC_INIT([hyphen],[2.8.4],[nemeth@numbertext.org])
AM_INIT_AUTOMAKE(hyphen,2.8.4)
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LIBTOOL

View File

@ -1,9 +1,9 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@ -60,6 +60,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@ -83,6 +84,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
@ -108,6 +110,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
@ -140,7 +143,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@ -247,10 +249,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:

View File

@ -127,16 +127,19 @@ main(int argc, char** argv)
/* now read each word from the wtc file */
while(fgets(buf,BUFSIZE,wtclst) != NULL) {
k = strlen(buf);
if (buf[k - 1] == '\n') buf[k - 1] = '\0';
if (*buf && buf[k - 2] == '\r') buf[k-- - 2] = '\0';
if (k && buf[k - 1] == '\n') buf[k - 1] = '\0';
if (k >=2 && buf[k - 2] == '\r') buf[k-- - 2] = '\0';
/* set aside some buffers to hold lower cased */
/* and hyphen information */
lcword = (char *) malloc(k+1);
hyphens = (char *)malloc(k+5);
/* basic ascii lower-case, not suitable for real-world usage*/
for (i = 0; i < k; ++i)
lcword[i] = tolower(buf[i]);
for (i = 0; i < k; ++i) {
lcword[i] = buf[i];
if ( (lcword[i] >= 'A') && (lcword[i] <= 'Z') )
lcword[i] += 32;
}
/* first remove any trailing periods */
n = k-1;

107
hyphen.c
View File

@ -422,7 +422,8 @@ for (k = 0; k < 2; k++) {
}
dict[k]->utf8 = (strcmp(dict[k]->cset, "UTF-8") == 0);
} else {
strcpy(dict[k]->cset, dict[0]->cset);
strncpy(dict[k]->cset, dict[0]->cset, sizeof(dict[k]->cset)-1);
dict[k]->cset[sizeof(dict[k]->cset)-1] = '\0';
dict[k]->utf8 = dict[0]->utf8;
}
@ -437,7 +438,8 @@ for (k = 0; k < 2; k++) {
/* default first level: hyphen and ASCII apostrophe */
if (!dict[0]->utf8) hnj_hyphen_load_line("NOHYPHEN '\n", dict[k], hashtab);
else hnj_hyphen_load_line("NOHYPHEN ',\xe2\x80\x93,\xe2\x80\x99\n", dict[k], hashtab);
strcpy(buf, "1-1/=,1,1\n"); // buf rewritten by hnj_hyphen_load here
strncpy(buf, "1-1/=,1,1\n", MAX_CHARS-1); // buf rewritten by hnj_hyphen_load here
buf[MAX_CHARS-1] = '\0';
hnj_hyphen_load_line(buf, dict[k], hashtab); /* remove hyphen */
hnj_hyphen_load_line("1'1\n", dict[k], hashtab); /* ASCII apostrophe */
if (dict[0]->utf8) {
@ -543,7 +545,6 @@ int hnj_hyphen_hyphenate (HyphenDict *dict,
const char *word, int word_size,
char *hyphens)
{
char prep_word_buf[MAX_WORD];
char *prep_word;
int i, j, k;
int state;
@ -552,10 +553,7 @@ int hnj_hyphen_hyphenate (HyphenDict *dict,
char *match;
int offset;
if (word_size + 3 < MAX_WORD)
prep_word = prep_word_buf;
else
prep_word = hnj_malloc (word_size + 3);
prep_word = hnj_malloc (word_size + 3);
j = 0;
prep_word[j++] = '.';
@ -662,8 +660,7 @@ int hnj_hyphen_hyphenate (HyphenDict *dict,
hyphens[i] = '0';
hyphens[word_size] = '\0';
if (prep_word != prep_word_buf)
hnj_free (prep_word);
hnj_free (prep_word);
return 0;
}
@ -766,7 +763,6 @@ int hnj_hyphen_hyph_(HyphenDict *dict, const char *word, int word_size,
char * hyphens, char *** rep, int ** pos, int ** cut,
int clhmin, int crhmin, int lend, int rend)
{
char prep_word_buf[MAX_WORD];
char *prep_word;
int i, j, k;
int state;
@ -777,26 +773,17 @@ int hnj_hyphen_hyph_(HyphenDict *dict, const char *word, int word_size,
signed char replindex;
signed char replcut;
int offset;
int matchlen_buf[MAX_CHARS];
int matchindex_buf[MAX_CHARS];
char * matchrepl_buf[MAX_CHARS];
int * matchlen;
int * matchindex;
char ** matchrepl;
int isrepl = 0;
int nHyphCount;
if (word_size + 3 < MAX_CHARS) {
prep_word = prep_word_buf;
matchlen = matchlen_buf;
matchindex = matchindex_buf;
matchrepl = matchrepl_buf;
} else {
prep_word = hnj_malloc (word_size + 3);
matchlen = hnj_malloc ((word_size + 3) * sizeof(int));
matchindex = hnj_malloc ((word_size + 3) * sizeof(int));
matchrepl = hnj_malloc ((word_size + 3) * sizeof(char *));
}
size_t prep_word_size = word_size + 3;
prep_word = hnj_malloc (prep_word_size);
matchlen = hnj_malloc ((word_size + 3) * sizeof(int));
matchindex = hnj_malloc ((word_size + 3) * sizeof(int));
matchrepl = hnj_malloc ((word_size + 3) * sizeof(char *));
j = 0;
prep_word[j++] = '.';
@ -933,16 +920,12 @@ int hnj_hyphen_hyph_(HyphenDict *dict, const char *word, int word_size,
for (i = 0; i < word_size; i++) {
if (isrepl && (matchindex[i] >= 0) && matchrepl[matchindex[i]]) {
if (rep && pos && cut) {
if (!*rep && !*pos && !*cut) {
int k;
*rep = (char **) malloc(sizeof(char *) * word_size);
*pos = (int *) malloc(sizeof(int) * word_size);
*cut = (int *) malloc(sizeof(int) * word_size);
for (k = 0; k < word_size; k++) {
(*rep)[k] = NULL;
(*pos)[k] = 0;
(*cut)[k] = 0;
}
if (!*rep)
*rep = (char **) calloc(word_size, sizeof(char *));
if (!*pos)
*pos = (int *) calloc(word_size, sizeof(int));
if (!*cut) {
*cut = (int *) calloc(word_size, sizeof(int));
}
(*rep)[matchindex[i] - 1] = hnj_strdup(matchrepl[matchindex[i]]);
(*pos)[matchindex[i] - 1] = matchindex[i] - i;
@ -953,34 +936,22 @@ int hnj_hyphen_hyph_(HyphenDict *dict, const char *word, int word_size,
}
}
if (matchrepl != matchrepl_buf) {
hnj_free (matchrepl);
hnj_free (matchlen);
hnj_free (matchindex);
}
hnj_free (matchrepl);
hnj_free (matchlen);
hnj_free (matchindex);
// recursive hyphenation of the first (compound) level segments
if (dict->nextlevel) {
char * rep2_buf[MAX_WORD];
int pos2_buf[MAX_WORD];
int cut2_buf[MAX_WORD];
char hyphens2_buf[MAX_WORD];
char ** rep2;
int * pos2;
int * cut2;
char * hyphens2;
int begin = 0;
if (word_size < MAX_CHARS) {
rep2 = rep2_buf;
pos2 = pos2_buf;
cut2 = cut2_buf;
hyphens2 = hyphens2_buf;
} else {
rep2 = hnj_malloc (word_size * sizeof(char *));
pos2 = hnj_malloc (word_size * sizeof(int));
cut2 = hnj_malloc (word_size * sizeof(int));
hyphens2 = hnj_malloc (word_size);
}
rep2 = hnj_malloc (word_size * sizeof(char *));
pos2 = hnj_malloc (word_size * sizeof(int));
cut2 = hnj_malloc (word_size * sizeof(int));
hyphens2 = hnj_malloc (word_size);
for (i = 0; i < word_size; i++) rep2[i] = NULL;
for (i = 0; i < word_size; i++) if
(hyphens[i]&1 || (begin > 0 && i + 1 == word_size)) {
@ -988,9 +959,11 @@ int hnj_hyphen_hyph_(HyphenDict *dict, const char *word, int word_size,
int hyph = 0;
prep_word[i + 2] = '\0';
/* non-standard hyphenation at compound boundary (Schiffahrt) */
if (*rep && *pos && *cut && (*rep)[i]) {
if (rep && *rep && *pos && *cut && (*rep)[i]) {
char * l = strchr((*rep)[i], '=');
strcpy(prep_word + 2 + i - (*pos)[i], (*rep)[i]);
size_t offset = 2 + i - (*pos)[i];
strncpy(prep_word + offset, (*rep)[i], prep_word_size - offset - 1);
prep_word[prep_word_size - 1] = '\0';
if (l) {
hyph = (l - (*rep)[i]) - (*pos)[i];
prep_word[2 + i + hyph] = '\0';
@ -1020,7 +993,9 @@ int hnj_hyphen_hyph_(HyphenDict *dict, const char *word, int word_size,
}
prep_word[i + 2] = word[i + 1];
if (*rep && *pos && *cut && (*rep)[i]) {
strcpy(prep_word + 1, word);
size_t offset = 1;
strncpy(prep_word + offset, word, prep_word_size - offset - 1);
prep_word[prep_word_size - 1] = '\0';
}
}
begin = i + 1;
@ -1037,15 +1012,13 @@ int hnj_hyphen_hyph_(HyphenDict *dict, const char *word, int word_size,
rep, pos, cut, crhmin);
}
if (rep2 != rep2_buf) {
free(rep2);
free(cut2);
free(pos2);
free(hyphens2);
}
free(rep2);
free(cut2);
free(pos2);
free(hyphens2);
}
if (prep_word != prep_word_buf) hnj_free (prep_word);
hnj_free (prep_word);
return 0;
}
@ -1095,12 +1068,16 @@ int hnj_hyphen_norm(const char *word, int word_size, char * hyphens,
void hnj_hyphen_hyphword(const char * word, int l, const char * hyphens,
char * hyphword, char *** rep, int ** pos, int ** cut)
{
int hyphenslen = l + 5;
int i, j;
for (i = 0, j = 0; i < l; i++, j++) {
if (hyphens[i]&1) {
hyphword[j] = word[i];
if (*rep && *pos && *cut && (*rep)[i]) {
strcpy(hyphword + j - (*pos)[i] + 1, (*rep)[i]);
size_t offset = j - (*pos)[i] + 1;
strncpy(hyphword + offset, (*rep)[i], hyphenslen - offset - 1);
hyphword[hyphenslen-1] = '\0';
j += strlen((*rep)[i]) - (*pos)[i];
i += (*cut)[i] - (*pos)[i];
} else hyphword[++j] = '=';

4058
ltmain.sh

File diff suppressed because it is too large Load Diff

View File

@ -163,16 +163,14 @@ static char *combine(
return expr;
}
static char *pattab_key[MAXPATHS];
static char *pattab_val[MAXPATHS];
static char *newpattab_key[MAXPATHS];
static char *newpattab_val[MAXPATHS];
//
//
int main(int argc, const char* argv[]) {
FILE *in, *out;
char *pattab_key[MAXPATHS];
char *pattab_val[MAXPATHS];
int patterns = 0;
char *newpattab_key[MAXPATHS];
char *newpattab_val[MAXPATHS];
int newpatterns = 0;
char format[132]; // 64+65+newline+zero+spare
int p;

View File

@ -1,9 +1,9 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@ -62,6 +62,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@ -85,6 +86,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
@ -110,6 +112,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
@ -142,7 +145,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@ -411,14 +413,15 @@ check-TESTS: $(TESTS)
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
if test "$$failed" -eq 0; then \
echo "$$grn$$dashes"; \
col="$$grn"; \
else \
echo "$$red$$dashes"; \
col="$$red"; \
fi; \
echo "$$banner"; \
test -z "$$skipped" || echo "$$skipped"; \
test -z "$$report" || echo "$$report"; \
echo "$$dashes$$std"; \
echo "$${col}$$dashes$${std}"; \
echo "$${col}$$banner$${std}"; \
test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
test -z "$$report" || echo "$${col}$$report$${std}"; \
echo "$${col}$$dashes$${std}"; \
test "$$failed" -eq 0; \
else :; fi
@ -467,10 +470,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic: