Skip to content

Commit 041711e

Browse files
committed
Work around broken largefile on older android
Apparently requesting 64-bit file support on Android api versions prior to 24 results in missing `ftello()` and `fseeko()` declarations and other problems. The idea of this fix is to just limit such builds to 32-bit files. Change contributed by Vy Nguyen, originally in #17
1 parent 3ecc22a commit 041711e

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/internal.h

+11-8
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,17 @@
1818
# if !defined(_GNU_SOURCE)
1919
# define _GNU_SOURCE
2020
# endif
21-
# if !defined(_LARGEFILE_SOURCE)
22-
# define _LARGEFILE_SOURCE
23-
# endif
24-
# if !defined(_LARGEFILE64_SOURCE)
25-
# define _LARGEFILE64_SOURCE
26-
# endif
27-
# if !defined(_FILE_OFFSET_BITS)
28-
# define _FILE_OFFSET_BITS 64
21+
/* 64-bit file access is broken before ANDROID 24. */
22+
# if !defined(__ANDROID__) || __ANDROID_API__ >= 24
23+
# if !defined(_LARGEFILE_SOURCE)
24+
# define _LARGEFILE_SOURCE
25+
# endif
26+
# if !defined(_LARGEFILE64_SOURCE)
27+
# define _LARGEFILE64_SOURCE
28+
# endif
29+
# if !defined(_FILE_OFFSET_BITS)
30+
# define _FILE_OFFSET_BITS 64
31+
# endif
2932
# endif
3033

3134
# include <stdlib.h>

0 commit comments

Comments
 (0)