diff --git a/libvoikko-svn-head-r2591.patch b/libvoikko-svn-head-r2591.patch new file mode 100644 index 0000000..763eed5 --- /dev/null +++ b/libvoikko-svn-head-r2591.patch @@ -0,0 +1,169 @@ +Index: ChangeLog +=================================================================== +--- ChangeLog (revision 2585) ++++ ChangeLog (working copy) +@@ -1,3 +1,22 @@ ++2009-04-11 Harri Pitkänen ++ ++ * Remove --as-needed from linker flags. It is ++ unnecessary as long as libtool < 2.0 is used ++ and breaks build on OS X. ++ ++2009-04-10 Harri Pitkänen ++ ++ * Fixed typo that prevented dictionary loader from ++ working correctly on Windows. ++ * Add struct keywords to voikko.h to make the header ++ compatible with plain C compilers. ++ * Fix memory leak in grammar checker. ++ ++2009-04-07 Harri Pitkänen ++ ++ * Change trie compiler to not use a construct that ++ is not supported in python 2.3. ++ + 2009-07-05 Ville-Pekka Vainio + + * Build fixes for Fedora 11. +Index: src/setup/DictionaryLoader.cpp +=================================================================== +--- src/setup/DictionaryLoader.cpp (revision 2585) ++++ src/setup/DictionaryLoader.cpp (working copy) +@@ -112,7 +112,7 @@ + mainPath.append("/"); + mainPath.append(VOIKKO_DICTIONARY_VERSION); + #ifdef WIN32 +- string searchPattern(path); ++ string searchPattern(mainPath); + searchPattern.append("\\*"); + WIN32_FIND_DATA dirData; + HANDLE handle = FindFirstFile(searchPattern.c_str(), &dirData); +Index: src/tools/Makefile.am +=================================================================== +--- src/tools/Makefile.am (revision 2585) ++++ src/tools/Makefile.am (working copy) +@@ -1,15 +1,15 @@ + bin_PROGRAMS = voikkospell voikkohyphenate voikkogc + + voikkospell_SOURCES = voikkospell.cpp +-voikkospell_CXXFLAGS = $(AM_CXXFLAGS) -Wl,--as-needed ++voikkospell_CXXFLAGS = $(AM_CXXFLAGS) + voikkospell_LDADD = ../libvoikko.la + + voikkohyphenate_SOURCES = voikkohyphenate.cpp +-voikkohyphenate_CXXFLAGS = $(AM_CXXFLAGS) -Wl,--as-needed ++voikkohyphenate_CXXFLAGS = $(AM_CXXFLAGS) + voikkohyphenate_LDADD = ../libvoikko.la + + voikkogc_SOURCES = voikkogc.cpp +-voikkogc_CXXFLAGS = $(AM_CXXFLAGS) -Wl,--as-needed ++voikkogc_CXXFLAGS = $(AM_CXXFLAGS) + voikkogc_LDADD = ../libvoikko.la + + dist_man_MANS = voikkospell.1 voikkohyphenate.1 voikkogc.1 +Index: src/grammar/cache.cpp +=================================================================== +--- src/grammar/cache.cpp (revision 2585) ++++ src/grammar/cache.cpp (working copy) +@@ -84,7 +84,7 @@ + } + } + +- for (int i = 0; i < para->sentenceCount; i++) { ++ for (size_t i = 0; i < para->sentenceCount; i++) { + AutoCorrect::autoCorrect(handle, para->sentences[i]); + gc_local_punctuation(handle, para->sentences[i]); + gc_punctuation_of_quotations(handle, para->sentences[i]); +Index: src/grammar/Paragraph.cpp +=================================================================== +--- src/grammar/Paragraph.cpp (revision 2585) ++++ src/grammar/Paragraph.cpp (working copy) +@@ -24,6 +24,9 @@ + } + + Paragraph::~Paragraph() { ++ for (size_t i = 0; i < sentenceCount; i++) { ++ delete this->sentences[i]; ++ } + delete[] this->sentences; + } + +Index: src/grammar/Paragraph.hpp +=================================================================== +--- src/grammar/Paragraph.hpp (revision 2585) ++++ src/grammar/Paragraph.hpp (working copy) +@@ -24,7 +24,9 @@ + namespace libvoikko { namespace grammar { + + /** +- * Analyzed paragraph for grammar checker. ++ * Analyzed paragraph for grammar checker. The user of this class ++ * must ensure that sentenceCount matches the number of sentences ++ * stored in this paragraph. + */ + class Paragraph { + public: +@@ -33,13 +35,13 @@ + ~Paragraph(); + + /* Maximum number of sentences in a paragraph */ +- static const int MAX_SENTENCES_IN_PARAGRAPH = 200; ++ static const size_t MAX_SENTENCES_IN_PARAGRAPH = 200; + + /** Pointers to analyzed sentences */ + Sentence ** sentences; + + /** Number of sentences in the paragraph */ +- int sentenceCount; ++ size_t sentenceCount; + + private: + Paragraph(Paragraph const & other); +Index: src/voikko.h +=================================================================== +--- src/voikko.h (revision 2585) ++++ src/voikko.h (working copy) +@@ -436,25 +436,25 @@ + * first before looking into the standard dictionary locations. + * @return A pointer to a null terminated array of dictionary entries. + */ +-voikko_dict ** voikko_list_dicts(const char * path); ++struct voikko_dict ** voikko_list_dicts(const char * path); + + /** + * Free the memory allocated for dictionary list. + * @param dicts A list of available dictionaries obtained with voikko_list_dicts + */ +-void voikko_free_dicts(voikko_dict ** dicts); ++void voikko_free_dicts(struct voikko_dict ** dicts); + + /** + * Get the variant identifier for a dictionary. + * @return The variant identifier for given dictionary. + */ +-const char * voikko_dict_variant(const voikko_dict * dict); ++const char * voikko_dict_variant(const struct voikko_dict * dict); + + /** + * Get the human readable description for a dictionary. + * @return The description for given dictionary. + */ +-const char * voikko_dict_description(const voikko_dict * dict); ++const char * voikko_dict_description(const struct voikko_dict * dict); + + END_C_DECLS + #endif +Index: src/autocorrect/triecompiler.py +=================================================================== +--- src/autocorrect/triecompiler.py (revision 2585) ++++ src/autocorrect/triecompiler.py (working copy) +@@ -75,7 +75,8 @@ + # These characters cannot be represented as unicode literals in C++ + return unicodeChar + hexCode = hex(ordinal)[2:] +- return "\\u" + hexCode.rjust(4, "0") ++ # hexCode.rjust(4, "0") is not supported in Python version 2.3 ++ return "\\u" + hexCode.rjust(4).replace(" ", "0") + + def writeTrieNodes(trie, outputFile): + for node in trie.children: diff --git a/libvoikko.spec b/libvoikko.spec index dc69998..6f109f2 100644 --- a/libvoikko.spec +++ b/libvoikko.spec @@ -1,6 +1,6 @@ Name: libvoikko Version: 2.1 -Release: 0.2.rc2%{?dist} +Release: 0.3.rc2%{?dist} Summary: Voikko is a library for spellcheckers and hyphenators Group: System Environment/Libraries @@ -10,6 +10,7 @@ URL: http://voikko.sourceforge.net/ #Source0: http://downloads.sourceforge.net/voikko/%{name}-%{version}.tar.gz # The usual format of test release URLs Source0: http://www.puimula.org/htp/testing/%{name}-%{version}rc2.tar.gz +Patch0: libvoikko-svn-head-r2591.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: malaga-devel >= 7.8 python @@ -49,6 +50,7 @@ scripts. %prep %setup -q +%patch0 -p0 %build @@ -96,6 +98,10 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/pkgconfig/libvoikko.pc %changelog +* Sat Apr 11 2009 Ville-Pekka Vainio - 2.1-0.3.rc2 +- Patch to current SVN HEAD, includes a fix for a memory leak in the grammar + checker + * Mon Apr 6 2009 Ville-Pekka Vainio - 2.1-0.2.rc2 - New release candidate - Both patches applied upstream