aboutsummaryrefslogtreecommitdiffstats
path: root/core/import-shearwater.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2019-10-26 17:11:44 -0400
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-10-26 19:17:53 -0700
commitd3d51b175dd39722e58b7315009a5fff1b000260 (patch)
treeae0374e615829ee8a99112d6a9e0a0b4b24c219c /core/import-shearwater.c
parentcc2269b9c5236b60b6a9c86588285f0a78836b77 (diff)
downloadsubsurface-d3d51b175dd39722e58b7315009a5fff1b000260.tar.gz
Cleanup: pass NULL pointer for error string pointer
Since we never did anything with the error string, why even ask for it. And this way we don't have to deal with the memory returned, either. Found by Coverity. Fixes CIDs 350124, 350113, 350106, 350099, 350091 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/import-shearwater.c')
-rw-r--r--core/import-shearwater.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/core/import-shearwater.c b/core/import-shearwater.c
index 285b5034d..4bed8ff18 100644
--- a/core/import-shearwater.c
+++ b/core/import-shearwater.c
@@ -201,7 +201,6 @@ static int shearwater_dive(void *param, int columns, char **data, char **column)
int retval = 0;
struct parser_state *state = (struct parser_state *)param;
sqlite3 *handle = state->sql_handle;
- char *err = NULL;
char get_profile_template[] = "select currentTime,currentDepth,waterTemp,averagePPO2,currentNdl,CNSPercent,decoCeiling,firstStopDepth,firstStopTime from dive_log_records where diveLogId=%ld";
char get_profile_template_ai[] = "select currentTime,currentDepth,waterTemp,averagePPO2,currentNdl,CNSPercent,decoCeiling,aiSensor0_PressurePSI,aiSensor1_PressurePSI,firstStopDepth,firstStopTime from dive_log_records where diveLogId = %ld";
char get_cylinder_template[] = "select fractionO2,fractionHe from dive_log_records where diveLogId = %ld group by fractionO2,fractionHe";
@@ -276,7 +275,7 @@ static int shearwater_dive(void *param, int columns, char **data, char **column)
if (data[11]) {
snprintf(get_buffer, sizeof(get_buffer) - 1, get_mode_template, dive_id);
- retval = sqlite3_exec(handle, get_buffer, &shearwater_mode, state, &err);
+ retval = sqlite3_exec(handle, get_buffer, &shearwater_mode, state, NULL);
if (retval != SQLITE_OK) {
fprintf(stderr, "%s", "Database query shearwater_mode failed.\n");
return 1;
@@ -284,24 +283,24 @@ static int shearwater_dive(void *param, int columns, char **data, char **column)
}
snprintf(get_buffer, sizeof(get_buffer) - 1, get_cylinder_template, dive_id);
- retval = sqlite3_exec(handle, get_buffer, &shearwater_cylinders, state, &err);
+ retval = sqlite3_exec(handle, get_buffer, &shearwater_cylinders, state, NULL);
if (retval != SQLITE_OK) {
fprintf(stderr, "%s", "Database query shearwater_cylinders failed.\n");
return 1;
}
snprintf(get_buffer, sizeof(get_buffer) - 1, get_changes_template, dive_id);
- retval = sqlite3_exec(handle, get_buffer, &shearwater_changes, state, &err);
+ retval = sqlite3_exec(handle, get_buffer, &shearwater_changes, state, NULL);
if (retval != SQLITE_OK) {
fprintf(stderr, "%s", "Database query shearwater_changes failed.\n");
return 1;
}
snprintf(get_buffer, sizeof(get_buffer) - 1, get_profile_template_ai, dive_id);
- retval = sqlite3_exec(handle, get_buffer, &shearwater_ai_profile_sample, state, &err);
+ retval = sqlite3_exec(handle, get_buffer, &shearwater_ai_profile_sample, state, NULL);
if (retval != SQLITE_OK) {
snprintf(get_buffer, sizeof(get_buffer) - 1, get_profile_template, dive_id);
- retval = sqlite3_exec(handle, get_buffer, &shearwater_profile_sample, state, &err);
+ retval = sqlite3_exec(handle, get_buffer, &shearwater_profile_sample, state, NULL);
if (retval != SQLITE_OK) {
fprintf(stderr, "%s", "Database query shearwater_profile_sample failed.\n");
return 1;
@@ -321,7 +320,6 @@ static int shearwater_cloud_dive(void *param, int columns, char **data, char **c
int retval = 0;
struct parser_state *state = (struct parser_state *)param;
sqlite3 *handle = state->sql_handle;
- char *err = NULL;
char get_profile_template[] = "select currentTime,currentDepth,waterTemp,averagePPO2,currentNdl,CNSPercent,decoCeiling,firstStopDepth,firstStopTime from dive_log_records where diveLogId=%ld";
char get_profile_template_ai[] = "select currentTime,currentDepth,waterTemp,averagePPO2,currentNdl,CNSPercent,decoCeiling,aiSensor0_PressurePSI,aiSensor1_PressurePSI,firstStopDepth,firstStopTime from dive_log_records where diveLogId = %ld";
char get_cylinder_template[] = "select fractionO2 / 100,fractionHe / 100 from dive_log_records where diveLogId = %ld group by fractionO2,fractionHe";
@@ -400,7 +398,7 @@ static int shearwater_cloud_dive(void *param, int columns, char **data, char **c
if (data[11]) {
snprintf(get_buffer, sizeof(get_buffer) - 1, get_mode_template, dive_id);
- retval = sqlite3_exec(handle, get_buffer, &shearwater_mode, state, &err);
+ retval = sqlite3_exec(handle, get_buffer, &shearwater_mode, state, NULL);
if (retval != SQLITE_OK) {
fprintf(stderr, "%s", "Database query shearwater_mode failed.\n");
return 1;
@@ -408,24 +406,24 @@ static int shearwater_cloud_dive(void *param, int columns, char **data, char **c
}
snprintf(get_buffer, sizeof(get_buffer) - 1, get_cylinder_template, dive_id);
- retval = sqlite3_exec(handle, get_buffer, &shearwater_cylinders, state, &err);
+ retval = sqlite3_exec(handle, get_buffer, &shearwater_cylinders, state, NULL);
if (retval != SQLITE_OK) {
fprintf(stderr, "%s", "Database query shearwater_cylinders failed.\n");
return 1;
}
snprintf(get_buffer, sizeof(get_buffer) - 1, get_changes_template, dive_id);
- retval = sqlite3_exec(handle, get_buffer, &shearwater_changes, state, &err);
+ retval = sqlite3_exec(handle, get_buffer, &shearwater_changes, state, NULL);
if (retval != SQLITE_OK) {
fprintf(stderr, "%s", "Database query shearwater_changes failed.\n");
return 1;
}
snprintf(get_buffer, sizeof(get_buffer) - 1, get_profile_template_ai, dive_id);
- retval = sqlite3_exec(handle, get_buffer, &shearwater_ai_profile_sample, state, &err);
+ retval = sqlite3_exec(handle, get_buffer, &shearwater_ai_profile_sample, state, NULL);
if (retval != SQLITE_OK) {
snprintf(get_buffer, sizeof(get_buffer) - 1, get_profile_template, dive_id);
- retval = sqlite3_exec(handle, get_buffer, &shearwater_profile_sample, state, &err);
+ retval = sqlite3_exec(handle, get_buffer, &shearwater_profile_sample, state, NULL);
if (retval != SQLITE_OK) {
fprintf(stderr, "%s", "Database query shearwater_profile_sample failed.\n");
return 1;
@@ -444,7 +442,6 @@ int parse_shearwater_buffer(sqlite3 *handle, const char *url, const char *buffer
UNUSED(size);
int retval;
- char *err = NULL;
struct parser_state state;
init_parser_state(&state);
@@ -458,7 +455,7 @@ int parse_shearwater_buffer(sqlite3 *handle, const char *url, const char *buffer
char get_dives[] = "select l.number,timestamp,location||' / '||site,buddy,notes,imperialUnits,maxDepth,maxTime,startSurfacePressure,computerSerial,computerModel,i.diveId FROM dive_info AS i JOIN dive_logs AS l ON i.diveId=l.diveId";
- retval = sqlite3_exec(handle, get_dives, &shearwater_dive, &state, &err);
+ retval = sqlite3_exec(handle, get_dives, &shearwater_dive, &state, NULL);
free_parser_state(&state);
if (retval != SQLITE_OK) {
@@ -476,7 +473,6 @@ int parse_shearwater_cloud_buffer(sqlite3 *handle, const char *url, const char *
UNUSED(size);
int retval;
- char *err = NULL;
struct parser_state state;
init_parser_state(&state);
@@ -487,7 +483,7 @@ int parse_shearwater_cloud_buffer(sqlite3 *handle, const char *url, const char *
char get_dives[] = "select l.number,strftime('%s', DiveDate),location||' / '||site,buddy,notes,imperialUnits,maxDepth,maxTime,startSurfacePressure,computerSerial,computerModel,d.diveId,l.sampleRateMs FROM dive_details AS d JOIN dive_logs AS l ON d.diveId=l.diveId";
- retval = sqlite3_exec(handle, get_dives, &shearwater_cloud_dive, &state, &err);
+ retval = sqlite3_exec(handle, get_dives, &shearwater_cloud_dive, &state, NULL);
free_parser_state(&state);
if (retval != SQLITE_OK) {