summaryrefslogtreecommitdiffstats
path: root/windows.c
diff options
context:
space:
mode:
authorGravatar Thiago Macieira <thiago@macieira.org>2013-12-19 17:01:54 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-20 09:53:05 -0800
commitdbdf50d03cd19b8cf62f39a2578996215f47034e (patch)
treea4d9fadb897427cd71f238da8cd430bb4b440140 /windows.c
parentc49f7133c306860fb1f9bb5e6cd138927a5b5f0f (diff)
downloadsubsurface-dbdf50d03cd19b8cf62f39a2578996215f47034e.tar.gz
Fix compilation with libzip < 0.10
Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'windows.c')
-rw-r--r--windows.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/windows.c b/windows.c
index 536205c39..9288af45f 100644
--- a/windows.c
+++ b/windows.c
@@ -157,14 +157,19 @@ void *subsurface_opendir(const char *path)
#define O_BINARY 0
#endif
-/* we use zip_fdopen since zip_open doesn't have a wchar_t version */
struct zip *subsurface_zip_open_readonly(const char *path, int flags, int *errorp)
{
+#if defined(LIBZIP_VERSION_MAJOR)
+ /* libzip 0.10 has zip_fdopen, let's use it since zip_open doesn't have a
+ * wchar_t version */
int fd = subsurface_open(path, O_RDONLY | O_BINARY, 0);
struct zip *ret = zip_fdopen(fd, flags, errorp);
if (!ret)
close(fd);
return ret;
+#else
+ return zip_open(path, flags, errorp);
+#endif
}
int subsurface_zip_close(struct zip *zip)