[libvoikko] Strange bug in the interface between hfst-ospell and libvoikko
Harri Pitkänen
hatapitk at iki.fi
Thu Dec 19 21:27:35 EET 2013
On Monday 16 December 2013 20:03:25 Harri Pitkänen wrote:
> static
> void*
> extract_to_mem(archive* ar, archive_entry* entry, size_t* n)
> {
> size_t full_length = 0;
> const struct stat* st = archive_entry_stat(entry);
> size_t buffsize = st->st_size;
> char * buff = (char*)malloc(sizeof(char) * buffsize);
> for (;;)
> {
> ssize_t curr = archive_read_data(ar, buff + full_length, buffsize -
> full_length);
> if (0 == curr)
> {
> break;
> }
> else if (ARCHIVE_RETRY == curr)
> {
> continue;
> }
> else if (ARCHIVE_FAILED == curr)
> {
> throw ZHfstZipReadingError("Archive broken (ARCHIVE_FAILED)");
> }
> else if (curr < 0)
> {
> throw ZHfstZipReadingError("Archive broken...");
> }
> else
> {
> full_length += curr;
> }
> }
> *n = full_length;
> return buff;
> }
>
>
The algorithm above appears to be correct.
The problem turned out to be that libarchive, when configured with the options
that disable all dependencies except zlib, no longer supports deflate
compression. I repacked sma-20130626.zhfst with
zip -Z store test-store.zhfst *
and now I can successfully use both hfst-ospell.exe and voikkospell.exe under
Wine.
I have not tried this under real Windows and with LibreOffice yet. But things
are looking quite good to me. Using "-Z store" here should not be much of a
problem. The LibreOffice .oxt package can still be compressed with maximum
compression.
Harri
More information about the Libvoikko
mailing list