Update README section about dlfcn.h
[termux-packages] / packages / hunspell / hunspell.cxx.patch
CommitLineData
59f0d218 1diff -u -r ../hunspell-1.3.3/src/tools/hunspell.cxx ./src/tools/hunspell.cxx
5b99d336
FF
2--- ../hunspell-1.3.3/src/tools/hunspell.cxx 2014-06-02 07:35:50.000000000 -0400
3+++ ./src/tools/hunspell.cxx 2016-03-06 02:28:02.031833160 -0500
59f0d218
FF
4@@ -68,7 +68,7 @@
5 #include "odfparser.hxx"
6
7 #define LIBDIR \
8- "/usr/share/hunspell:" \
9+ "@TERMUX_PREFIX@/share/hunspell:" \
10 "/usr/share/myspell:" \
11 "/usr/share/myspell/dicts:" \
12 "/Library/Spelling"
13@@ -92,7 +92,7 @@
14 "/usr/lib/openoffice.org2.0/share/dict/ooo"
15 #define HOME getenv("HOME")
16 #define DICBASENAME ".hunspell_"
17-#define LOGFILE "/tmp/hunspell.log"
18+#define LOGFILE "@TERMUX_PREFIX@/tmp/hunspell.log"
19 #define DIRSEPCH '/'
20 #define DIRSEP "/"
21 #define PATHSEP ":"
5b99d336
FF
22@@ -1423,7 +1423,13 @@
23 }
24 }
25
26+#ifdef __ANDROID__
27+ char tmpfile_template[] = "@TERMUX_PREFIX@/tmp/hunspell.XXXXXX";
28+ int tmpfile_fd = mkstemp(tmpfile_template);
29+ FILE *tempfile = fdopen(tmpfile_fd, "w+");
30+#else
31 FILE *tempfile = tmpfile();
32+#endif
33
34 if (!tempfile)
35 {
36@@ -1443,6 +1449,9 @@
37 clear();
38 refresh();
39 fclose(tempfile); //automatically deleted when closed
40+#ifdef __ANDROID__
41+ unlink(tmpfile_template);
42+#endif
43 if (is_zipped_odf(parser, extension)) {
44 sprintf(buf, "rm %s; rmdir %s", filename, odftempdir);
45 if (system(buf) != 0)
46@@ -1493,6 +1502,9 @@
47
48 delete parser;
49 fclose(tempfile); //automatically deleted when closed
50+#ifdef __ANDROID__
51+ unlink(tmpfile_template);
52+#endif
53 }
54
55 #endif