[PATCH 1/2] Fix compilation with older libzip
Lubomir I. Ivanov
neolit123 at gmail.com
Fri Dec 6 01:23:53 UTC 2013
On 6 December 2013 01:34, Thiago Macieira <thiago at macieira.org> wrote:
> Older libzip lack zip_get_num_entries. Explanation for the hack is in
> the comment.
>
> Signed-off-by: Thiago Macieira <thiago at macieira.org>
> ---
> qt-ui/subsurfacewebservices.cpp | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp
> index 8dd6b59..6e041d6 100644
> --- a/qt-ui/subsurfacewebservices.cpp
> +++ b/qt-ui/subsurfacewebservices.cpp
> @@ -23,6 +23,16 @@
> # include <unistd.h> // for dup(2)
> #endif
>
> +/* older versions of libzip don't have zip_get_num_entries;
> + * unfortunately, zip.h doesn't come with a version macro for us, so
> + * hack around it by providing an overload in that has a lower search
> + * precendence: the second argument here is a 64-bit int, but we make
> + * call below with a literal 0, which binds better to an int */
> +static int zip_get_num_entries(struct zip *z, qint64)
i can see version macros in zipconf.h, which zip.h includes:
#define LIBZIP_VERSION "0.10"
#define LIBZIP_VERSION_MAJOR 0
#define LIBZIP_VERSION_MINOR 10
#define LIBZIP_VERSION_MICRO 0
zip_get_num_entries was added here. we can implement it locally if we
can't solve it with an overload or version branch:
http://hg.nih.at/libzip/rev/8972a6ceae8e?revcount=20
NEWS says:
0.10 [2010/03/18]
* Added zip_get_num_entries(), deprecated zip_get_num_files().
lubomir
--
More information about the subsurface
mailing list