From 1fccc8736598740de5ca6c5b590d16dab823173b Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Date: Mon, 7 Mar 2016 15:36:51 -0300
Subject: [PATCH 09/10] Fix annoyances on file.c

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
---
 subsurface-core/file.c | 15 +++++++++------
 subsurface-core/file.h |  2 +-
 tests/testparse.cpp    |  2 +-
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/subsurface-core/file.c b/subsurface-core/file.c
index 3bac96e..8286ce9 100644
--- a/subsurface-core/file.c
+++ b/subsurface-core/file.c
@@ -86,7 +86,7 @@ static void zip_read(struct zip_file *file, const char *filename)
 	free(mem);
 }
 
-int try_to_open_zip(const char *filename, struct memblock *mem)
+int try_to_open_zip(const char *filename)
 {
 	int success = 0;
 	/* Grr. libzip needs to re-open the file, it can't take a buffer */
@@ -164,6 +164,9 @@ static int try_to_xslt_open_csv(const char *filename, struct memblock *mem, cons
 
 int db_test_func(void *param, int columns, char **data, char **column)
 {
+	(void) param;
+	(void) columns;
+	(void) column;
 	return *data[0] == '0';
 }
 
@@ -335,7 +338,7 @@ static void add_sample_data(struct sample *sample, enum csv_format type, double
  *
  * Followed by the data values (all comma-separated, all one long line).
  */
-static int try_to_open_csv(const char *filename, struct memblock *mem, enum csv_format type)
+static int try_to_open_csv(struct memblock *mem, enum csv_format type)
 {
 	char *p = mem->buffer;
 	char *header[8];
@@ -398,7 +401,7 @@ static int open_by_filename(const char *filename, const char *fmt, struct memblo
 
 	/* Suunto Dive Manager files: SDE, ZIP; divelogs.de files: DLD */
 	if (!strcasecmp(fmt, "SDE") || !strcasecmp(fmt, "ZIP") || !strcasecmp(fmt, "DLD"))
-		return try_to_open_zip(filename, mem);
+		return try_to_open_zip(filename);
 
 	/* CSV files */
 	if (!strcasecmp(fmt, "CSV"))
@@ -408,13 +411,13 @@ static int open_by_filename(const char *filename, const char *fmt, struct memblo
 		return try_to_open_cochran(filename, mem);
 	/* Cochran export comma-separated-value files */
 	if (!strcasecmp(fmt, "DPT"))
-		return try_to_open_csv(filename, mem, CSV_DEPTH);
+		return try_to_open_csv(mem, CSV_DEPTH);
 	if (!strcasecmp(fmt, "LVD"))
 		return try_to_open_liquivision(filename, mem);
 	if (!strcasecmp(fmt, "TMP"))
-		return try_to_open_csv(filename, mem, CSV_TEMP);
+		return try_to_open_csv(mem, CSV_TEMP);
 	if (!strcasecmp(fmt, "HP1"))
-		return try_to_open_csv(filename, mem, CSV_PRESSURE);
+		return try_to_open_csv(mem, CSV_PRESSURE);
 
 	return 0;
 }
diff --git a/subsurface-core/file.h b/subsurface-core/file.h
index 8551099..1c1dfc1 100644
--- a/subsurface-core/file.h
+++ b/subsurface-core/file.h
@@ -16,7 +16,7 @@ extern "C" {
 #endif
 extern int readfile(const char *filename, struct memblock *mem);
 extern timestamp_t parse_date(const char *date);
-extern int try_to_open_zip(const char *filename, struct memblock *mem);
+extern int try_to_open_zip(const char *filename);
 #ifdef __cplusplus
 }
 #endif
diff --git a/tests/testparse.cpp b/tests/testparse.cpp
index 7a65a01..5528d0d 100644
--- a/tests/testparse.cpp
+++ b/tests/testparse.cpp
@@ -364,7 +364,7 @@ void TestParse::testParseDLD()
 	QString filename = SUBSURFACE_SOURCE "/dives/TestDiveDivelogsDE.DLD";
 
 	QVERIFY(readfile(filename.toLatin1().data(), &mem) > 0);
-	QVERIFY(try_to_open_zip(filename.toLatin1().data(), &mem) > 0);
+	QVERIFY(try_to_open_zip(filename.toLatin1().data()) > 0);
 
 	fprintf(stderr, "number of dives from DLD: %d \n", dive_table.nr);
 }
-- 
2.5.4 (Apple Git-61)

