mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Another attempt to clean up signed / unsigned in profile.c
This time we err on the side of signed variables most of the time. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
22c94a3e65
commit
0cd0762807
1 changed files with 11 additions and 11 deletions
|
@ -377,7 +377,7 @@ static int count_events(struct divecomputer *dc)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int set_cylinder_index(struct plot_info *pi, int i, int cylinderindex, unsigned int end)
|
static int set_cylinder_index(struct plot_info *pi, int i, int cylinderindex, int end)
|
||||||
{
|
{
|
||||||
while (i < pi->nr) {
|
while (i < pi->nr) {
|
||||||
struct plot_data *entry = pi->entry + i;
|
struct plot_data *entry = pi->entry + i;
|
||||||
|
@ -392,7 +392,7 @@ static int set_cylinder_index(struct plot_info *pi, int i, int cylinderindex, un
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int set_setpoint(struct plot_info *pi, int i, int setpoint, unsigned int end)
|
static int set_setpoint(struct plot_info *pi, int i, int setpoint, int end)
|
||||||
{
|
{
|
||||||
while (i < pi->nr) {
|
while (i < pi->nr) {
|
||||||
struct plot_data *entry = pi->entry + i;
|
struct plot_data *entry = pi->entry + i;
|
||||||
|
@ -405,7 +405,7 @@ static int set_setpoint(struct plot_info *pi, int i, int setpoint, unsigned int
|
||||||
}
|
}
|
||||||
|
|
||||||
/* normally the first cylinder has index 0... if not, we need to fix this up here */
|
/* normally the first cylinder has index 0... if not, we need to fix this up here */
|
||||||
static int set_first_cylinder_index(struct plot_info *pi, int i, int cylinderindex, unsigned int end)
|
static int set_first_cylinder_index(struct plot_info *pi, int i, int cylinderindex, int end)
|
||||||
{
|
{
|
||||||
while (i < pi->nr) {
|
while (i < pi->nr) {
|
||||||
struct plot_data *entry = pi->entry + i;
|
struct plot_data *entry = pi->entry + i;
|
||||||
|
@ -425,7 +425,7 @@ static void check_gas_change_events(struct dive *dive, struct divecomputer *dc,
|
||||||
// for dive computers that tell us their first gas as an event on the first sample
|
// for dive computers that tell us their first gas as an event on the first sample
|
||||||
// we need to make sure things are setup correctly
|
// we need to make sure things are setup correctly
|
||||||
cylinderindex = explicit_first_cylinder(dive, dc);
|
cylinderindex = explicit_first_cylinder(dive, dc);
|
||||||
set_first_cylinder_index(pi, 0, cylinderindex, ~0u);
|
set_first_cylinder_index(pi, 0, cylinderindex, INT_MAX);
|
||||||
|
|
||||||
if (!ev)
|
if (!ev)
|
||||||
return;
|
return;
|
||||||
|
@ -435,7 +435,7 @@ static void check_gas_change_events(struct dive *dive, struct divecomputer *dc,
|
||||||
cylinderindex = get_cylinder_index(dive, ev);
|
cylinderindex = get_cylinder_index(dive, ev);
|
||||||
ev = get_next_event(ev->next, "gaschange");
|
ev = get_next_event(ev->next, "gaschange");
|
||||||
} while (ev);
|
} while (ev);
|
||||||
set_cylinder_index(pi, i, cylinderindex, ~0u);
|
set_cylinder_index(pi, i, cylinderindex, INT_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_setpoint_events(struct dive *dive, struct divecomputer *dc, struct plot_info *pi)
|
static void check_setpoint_events(struct dive *dive, struct divecomputer *dc, struct plot_info *pi)
|
||||||
|
@ -456,7 +456,7 @@ static void check_setpoint_events(struct dive *dive, struct divecomputer *dc, st
|
||||||
dc->divemode = CCR;
|
dc->divemode = CCR;
|
||||||
ev = get_next_event(ev->next, "SP change");
|
ev = get_next_event(ev->next, "SP change");
|
||||||
} while (ev);
|
} while (ev);
|
||||||
set_setpoint(pi, i, setpoint.mbar, ~0u);
|
set_setpoint(pi, i, setpoint.mbar, INT_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -466,7 +466,7 @@ struct plot_info calculate_max_limits_new(struct dive *dive, struct divecomputer
|
||||||
bool seen = false;
|
bool seen = false;
|
||||||
static struct plot_info pi;
|
static struct plot_info pi;
|
||||||
int maxdepth = dive->maxdepth.mm;
|
int maxdepth = dive->maxdepth.mm;
|
||||||
int maxtime = 0;
|
unsigned int maxtime = 0;
|
||||||
int maxpressure = 0, minpressure = INT_MAX;
|
int maxpressure = 0, minpressure = INT_MAX;
|
||||||
int maxhr = 0, minhr = INT_MAX;
|
int maxhr = 0, minhr = INT_MAX;
|
||||||
int mintemp = dive->mintemp.mkelvin;
|
int mintemp = dive->mintemp.mkelvin;
|
||||||
|
@ -606,7 +606,7 @@ struct plot_data *populate_plot_entries(struct dive *dive, struct divecomputer *
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Add events if they are between plot entries */
|
/* Add events if they are between plot entries */
|
||||||
while (ev && ev->time.seconds < lasttime + offset) {
|
while (ev && (int)ev->time.seconds < lasttime + offset) {
|
||||||
INSERT_ENTRY(ev->time.seconds, interpolate(lastdepth, depth, ev->time.seconds - lasttime, delta), sac);
|
INSERT_ENTRY(ev->time.seconds, interpolate(lastdepth, depth, ev->time.seconds - lasttime, delta), sac);
|
||||||
ev = ev->next;
|
ev = ev->next;
|
||||||
}
|
}
|
||||||
|
@ -615,12 +615,12 @@ struct plot_data *populate_plot_entries(struct dive *dive, struct divecomputer *
|
||||||
INSERT_ENTRY(lasttime + offset, interpolate(lastdepth, depth, offset, delta), sac);
|
INSERT_ENTRY(lasttime + offset, interpolate(lastdepth, depth, offset, delta), sac);
|
||||||
|
|
||||||
/* skip events that happened at this time */
|
/* skip events that happened at this time */
|
||||||
while (ev && ev->time.seconds == lasttime + offset)
|
while (ev && (int)ev->time.seconds == lasttime + offset)
|
||||||
ev = ev->next;
|
ev = ev->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add events if they are between plot entries */
|
/* Add events if they are between plot entries */
|
||||||
while (ev && ev->time.seconds < time) {
|
while (ev && (int)ev->time.seconds < time) {
|
||||||
INSERT_ENTRY(ev->time.seconds, interpolate(lastdepth, depth, ev->time.seconds - lasttime, delta), sac);
|
INSERT_ENTRY(ev->time.seconds, interpolate(lastdepth, depth, ev->time.seconds - lasttime, delta), sac);
|
||||||
ev = ev->next;
|
ev = ev->next;
|
||||||
}
|
}
|
||||||
|
@ -659,7 +659,7 @@ struct plot_data *populate_plot_entries(struct dive *dive, struct divecomputer *
|
||||||
if (sample->rbt.seconds)
|
if (sample->rbt.seconds)
|
||||||
entry->rbt = sample->rbt.seconds;
|
entry->rbt = sample->rbt.seconds;
|
||||||
/* skip events that happened at this time */
|
/* skip events that happened at this time */
|
||||||
while (ev && ev->time.seconds == time)
|
while (ev && (int)ev->time.seconds == time)
|
||||||
ev = ev->next;
|
ev = ev->next;
|
||||||
lasttime = time;
|
lasttime = time;
|
||||||
lastdepth = depth;
|
lastdepth = depth;
|
||||||
|
|
Loading…
Reference in a new issue