Cleanup: Fix Warnings in MacOS build.

Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
Michael Keller 2024-09-26 19:09:54 +12:00
parent 784eddc166
commit 8a64d1f4b9
10 changed files with 15 additions and 20 deletions

View file

@ -439,7 +439,7 @@ static void cochran_parse_samples(struct dive *dive, const unsigned char *log,
{
const unsigned char *s;
unsigned int offset = 0, profile_period = 1, sample_cnt = 0;
double depth = 0, temp = 0, depth_sample = 0, psi = 0, sgc_rate = 0;
double depth = 0, temp = 0, depth_sample = 0, psi = 0;
//int ascent_rate = 0;
unsigned int ndl = 0;
unsigned int in_deco = 0, deco_ceiling = 0, deco_time = 0;
@ -457,8 +457,6 @@ static void cochran_parse_samples(struct dive *dive, const unsigned char *log,
+ log[CMD_START_DEPTH + 1] * 256) / 4;
temp = log[CMD_START_TEMP];
psi = log[CMD_START_PSI] + log[CMD_START_PSI + 1] * 256;
sgc_rate = (double)(log[CMD_START_SGC]
+ log[CMD_START_SGC + 1] * 256) / 2;
profile_period = log[CMD_PROFILE_PERIOD];
break;
case TYPE_COMMANDER:
@ -533,9 +531,6 @@ static void cochran_parse_samples(struct dive *dive, const unsigned char *log,
case 2: // PSI change
psi -= (double)(s[1] & 0x7f) * (s[1] & 0x80 ? 1 : -1) / 4;
break;
case 1: // SGC rate
sgc_rate -= (double)(s[1] & 0x7f) * (s[1] & 0x80 ? 1 : -1) / 2;
break;
case 3: // Temperature
temp = (double)s[1] / 2 + 20;
break;

View file

@ -1599,7 +1599,7 @@ static bool cylinder_in_use(const struct dive *dive, int idx)
bool is_cylinder_use_appropriate(const struct divecomputer &dc, const cylinder_t &cyl, bool allowNonUsable)
{
switch (cyl.cylinder_use) {
case OC:
case OC_GAS:
if (dc.divemode == FREEDIVE)
return false;

View file

@ -17,6 +17,7 @@
#include "gettext.h"
#include "tag.h"
#include "errorhelper.h"
#include "format.h"
#include <string.h>
#include "divecomputer.h"
@ -45,7 +46,6 @@ static int seac_dive(void *param, int, char **data, char **)
{
int retval = 0, cylnum = 0;
int year, month, day, hour, min, sec, tz;
char isodatetime[30];
time_t divetime;
struct gasmix lastgas, curgas;
struct parser_state *state = (struct parser_state *)param;
@ -123,8 +123,8 @@ static int seac_dive(void *param, int, char **data, char **)
"-13:45", // 40
"-14:00"}; // 41
sprintf(isodatetime, "%4i-%02i-%02iT%02i:%02i:%02i%6s", year, month, day, hour, min, sec, timezoneoffset[tz]);
divetime = get_dive_datetime_from_isostring(isodatetime);
std::string isodatetime = format_string_std("%4i-%02i-%02iT%02i:%02i:%02i%6s", year, month, day, hour, min, sec, timezoneoffset[tz]);
divetime = get_dive_datetime_from_isostring(isodatetime.c_str());
state->cur_dive->when = divetime;
// 6 = dive_type

View file

@ -917,7 +917,7 @@ QString get_dive_date_string(timestamp_t when)
}
// Get local seconds since Epoch from ISO formatted UTC date time + offset string
time_t get_dive_datetime_from_isostring(char *when) {
time_t get_dive_datetime_from_isostring(const char *when) {
QDateTime divetime = QDateTime::fromString(when, Qt::ISODate);
return (time_t)(divetime.toSecsSinceEpoch());
}

View file

@ -111,7 +111,7 @@ std::string local_file_path(const struct picture &picture);
std::string hashfile_name();
enum deco_mode decoMode(bool in_planner);
void parse_seabear_header(const char *filename, struct xml_params *params);
time_t get_dive_datetime_from_isostring(char *when);
time_t get_dive_datetime_from_isostring(const char *when);
void print_qt_versions();
void lock_planner();
void unlock_planner();