summaryrefslogtreecommitdiffstats
path: root/subsurface-core
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-03-10 07:37:18 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-03-10 07:37:18 -0800
commita678cba93a4d32894ab089525281a7172a0ef04d (patch)
tree9d007ee142d810e353f728c69b6d5bbdd873de1c /subsurface-core
parent557eb744a3d7a04c8f2283bbcfc90a8143e7f407 (diff)
downloadsubsurface-a678cba93a4d32894ab089525281a7172a0ef04d.tar.gz
Revert "Clean up signedness confusion in profile.c"
This reverts commit 7f2ad93396091edd58b4e0930b5e62d2f6a066c7. Idiot maintainer to do cleanup like this right before a release
Diffstat (limited to 'subsurface-core')
-rw-r--r--subsurface-core/profile.c33
-rw-r--r--subsurface-core/profile.h6
2 files changed, 19 insertions, 20 deletions
diff --git a/subsurface-core/profile.c b/subsurface-core/profile.c
index 8a8126c8a..4d9a8444f 100644
--- a/subsurface-core/profile.c
+++ b/subsurface-core/profile.c
@@ -168,7 +168,7 @@ static int get_local_sac(struct plot_data *entry1, struct plot_data *entry2, str
/* Get local sac-rate (in ml/min) between entry1 and entry2 */
static int get_local_sac(struct plot_data *entry1, struct plot_data *entry2, struct dive *dive)
{
- unsigned int index = entry1->cylinderindex;
+ int index = entry1->cylinderindex;
cylinder_t *cyl;
int duration = entry2->sec - entry1->sec;
int depth, airuse;
@@ -196,11 +196,11 @@ static int get_local_sac(struct plot_data *entry1, struct plot_data *entry2, str
return airuse / atm * 60 / duration;
}
-static void analyze_plot_info_minmax_minute(struct plot_data *entry, struct plot_data *first, struct plot_data *last, unsigned int index)
+static void analyze_plot_info_minmax_minute(struct plot_data *entry, struct plot_data *first, struct plot_data *last, int index)
{
struct plot_data *p = entry;
- unsigned int time = entry->sec;
- unsigned int seconds = 90 * (index + 1);
+ int time = entry->sec;
+ int seconds = 90 * (index + 1);
struct plot_data *min, *max;
int avg, nr;
@@ -377,7 +377,7 @@ static int count_events(struct divecomputer *dc)
return result;
}
-static int set_cylinder_index(struct plot_info *pi, int i, unsigned int cylinderindex, unsigned int end)
+static int set_cylinder_index(struct plot_info *pi, int i, int cylinderindex, unsigned int end)
{
while (i < pi->nr) {
struct plot_data *entry = pi->entry + i;
@@ -466,7 +466,7 @@ struct plot_info calculate_max_limits_new(struct dive *dive, struct divecomputer
bool seen = false;
static struct plot_info pi;
int maxdepth = dive->maxdepth.mm;
- unsigned int maxtime = 0;
+ int maxtime = 0;
int maxpressure = 0, minpressure = INT_MAX;
int maxhr = 0, minhr = INT_MAX;
int mintemp = dive->mintemp.mkelvin;
@@ -558,8 +558,8 @@ struct plot_info calculate_max_limits_new(struct dive *dive, struct divecomputer
struct plot_data *populate_plot_entries(struct dive *dive, struct divecomputer *dc, struct plot_info *pi)
{
- int idx, nr, i;
- unsigned int lastdepth, lasttime, maxtime, lasttemp = 0;
+ int idx, maxtime, nr, i;
+ int lastdepth, lasttime, lasttemp = 0;
struct plot_data *plot_data;
struct event *ev = dc->events;
(void) dive;
@@ -590,9 +590,8 @@ struct plot_data *populate_plot_entries(struct dive *dive, struct divecomputer *
for (i = 0; i < dc->samples; i++) {
struct plot_data *entry = plot_data + idx;
struct sample *sample = dc->sample + i;
- uint32_t time = sample->time.seconds;
- unsigned int offset;
- int delta;
+ int time = sample->time.seconds;
+ int offset, delta;
int depth = sample->depth.mm;
int sac = sample->sac.mliter;
@@ -602,7 +601,7 @@ struct plot_data *populate_plot_entries(struct dive *dive, struct divecomputer *
time = lasttime;
delta = 1; // avoid divide by 0
}
- for (offset = 10; offset < (unsigned int)delta; offset += 10) {
+ for (offset = 10; offset < delta; offset += 10) {
if (lasttime + offset > maxtime)
break;
@@ -680,7 +679,7 @@ struct plot_data *populate_plot_entries(struct dive *dive, struct divecomputer *
#undef INSERT_ENTRY
-static void populate_cylinder_pressure_data(unsigned int idx, unsigned int start, unsigned int end, struct plot_info *pi, bool o2flag)
+static void populate_cylinder_pressure_data(int idx, int start, int end, struct plot_info *pi, bool o2flag)
{
int i;
@@ -767,7 +766,7 @@ static void fill_sac(struct dive *dive, struct plot_info *pi, int idx)
{
struct plot_data *entry = pi->entry + idx;
struct plot_data *first, *last;
- unsigned int time;
+ int time;
if (entry->sac)
return;
@@ -926,7 +925,7 @@ static void calculate_ndl_tts(struct plot_data *entry, struct dive *dive, double
add_segment(depth_to_bar(ascent_depth, dive),
&dive->cylinder[cylinderindex].gasmix, time_stepsize, entry->o2pressure.mbar, dive, prefs.decosac);
- if ((int)deco_allowed_depth(tissue_tolerance_calc(dive, depth_to_bar(ascent_depth,dive)), surface_pressure, dive, 1) <= next_stop) {
+ if (deco_allowed_depth(tissue_tolerance_calc(dive, depth_to_bar(ascent_depth,dive)), surface_pressure, dive, 1) <= next_stop) {
/* move to the next stop and add the travel between stops */
for (; ascent_depth > next_stop; ascent_depth -= ascent_mm_per_deco_step, entry->tts_calc += ascent_s_per_deco_step)
add_segment(depth_to_bar(ascent_depth, dive),
@@ -1414,7 +1413,7 @@ static void plot_string(struct plot_info *pi, struct plot_data *entry, struct me
strip_mb(b);
}
-struct plot_data *get_plot_details_new(struct plot_info *pi, unsigned int time, struct membuffer *mb)
+struct plot_data *get_plot_details_new(struct plot_info *pi, int time, struct membuffer *mb)
{
struct plot_data *entry = NULL;
int i;
@@ -1465,7 +1464,7 @@ void compare_samples(struct plot_data *e1, struct plot_data *e2, char *buf, int
max_desc_speed = 0;
delta_depth = abs(start->depth - stop->depth);
- delta_time = abs((int)start->sec - (int)stop->sec);
+ delta_time = abs(start->sec - stop->sec);
avg_depth = 0;
max_depth = 0;
min_depth = INT_MAX;
diff --git a/subsurface-core/profile.h b/subsurface-core/profile.h
index b03dae9c9..abac9dd49 100644
--- a/subsurface-core/profile.h
+++ b/subsurface-core/profile.h
@@ -20,8 +20,8 @@ struct divecomputer;
struct plot_info;
struct plot_data {
unsigned int in_deco : 1;
- unsigned int cylinderindex;
- unsigned int sec;
+ int cylinderindex;
+ int sec;
/* pressure[0] is sensor cylinder pressure [when CCR, the pressure of the diluent cylinder]
* pressure[1] is interpolated cylinder pressure */
int pressure[2];
@@ -77,7 +77,7 @@ struct plot_data *populate_plot_entries(struct dive *dive, struct divecomputer *
struct plot_info *analyze_plot_info(struct plot_info *pi);
void create_plot_info_new(struct dive *dive, struct divecomputer *dc, struct plot_info *pi, bool fast);
void calculate_deco_information(struct dive *dive, struct divecomputer *dc, struct plot_info *pi, bool print_mode);
-struct plot_data *get_plot_details_new(struct plot_info *pi, unsigned int time, struct membuffer *);
+struct plot_data *get_plot_details_new(struct plot_info *pi, int time, struct membuffer *);
/*
* When showing dive profiles, we scale things to the