[PATCH 1/2] Fix compilation with older libzip

Thiago Macieira thiago at macieira.org
Thu Dec 5 15:34:08 UTC 2013


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)
+{
+	return zip_get_num_files(z);
+}
+
 struct dive_table gps_location_table;
 static bool merge_locations_into_dives(void);
 
-- 
1.7.11.7



More information about the subsurface mailing list