mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fix compilation with libzip < 0.10
Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
c49f7133c3
commit
dbdf50d03c
2 changed files with 7 additions and 2 deletions
|
@ -753,7 +753,7 @@ void DivelogsDeWebServices::downloadFinished()
|
||||||
|
|
||||||
int errorcode;
|
int errorcode;
|
||||||
zipFile.seek(0);
|
zipFile.seek(0);
|
||||||
#ifdef Q_OS_UNIX
|
#if defined(Q_OS_UNIX) && defined(LIBZIP_VERSION_MAJOR)
|
||||||
int duppedfd = dup(zipFile.handle());
|
int duppedfd = dup(zipFile.handle());
|
||||||
struct zip *zip = zip_fdopen(duppedfd, 0, &errorcode);
|
struct zip *zip = zip_fdopen(duppedfd, 0, &errorcode);
|
||||||
if (!zip)
|
if (!zip)
|
||||||
|
|
|
@ -157,14 +157,19 @@ void *subsurface_opendir(const char *path)
|
||||||
#define O_BINARY 0
|
#define O_BINARY 0
|
||||||
#endif
|
#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)
|
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);
|
int fd = subsurface_open(path, O_RDONLY | O_BINARY, 0);
|
||||||
struct zip *ret = zip_fdopen(fd, flags, errorp);
|
struct zip *ret = zip_fdopen(fd, flags, errorp);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
close(fd);
|
close(fd);
|
||||||
return ret;
|
return ret;
|
||||||
|
#else
|
||||||
|
return zip_open(path, flags, errorp);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int subsurface_zip_close(struct zip *zip)
|
int subsurface_zip_close(struct zip *zip)
|
||||||
|
|
Loading…
Add table
Reference in a new issue