summaryrefslogtreecommitdiffstats
path: root/subsurface-core/planner.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-03-23 09:53:44 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-03-23 09:53:44 -0700
commit22c94a3e6596f04c86d102098e542a88502410a9 (patch)
tree0f75bc7b44a7fe249c3bf4a359d3c91cb179d4aa /subsurface-core/planner.c
parente93c99c8bc9c7ebcc39aa8be16476a794a845636 (diff)
downloadsubsurface-22c94a3e6596f04c86d102098e542a88502410a9.tar.gz
Don't try to force depth to be unsigned
Trying to clean up the signed vs. unsigned issues it becomes clear that forcing depth to be unsigned causes way too many problems in the code. So this commit goes the opposite direction; since we clearly aren't limited INT_MAX vs UINT_MAX, simply make more of the depth related variables signed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'subsurface-core/planner.c')
-rw-r--r--subsurface-core/planner.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/subsurface-core/planner.c b/subsurface-core/planner.c
index 6649f72ef..705aad1cb 100644
--- a/subsurface-core/planner.c
+++ b/subsurface-core/planner.c
@@ -9,6 +9,7 @@
#include <ctype.h>
#include <string.h>
#include "dive.h"
+#include "deco.h"
#include "divelist.h"
#include "planner.h"
#include "gettext.h"
@@ -103,7 +104,7 @@ int get_gasidx(struct dive *dive, struct gasmix *mix)
void interpolate_transition(struct dive *dive, duration_t t0, duration_t t1, depth_t d0, depth_t d1, const struct gasmix *gasmix, o2pressure_t po2)
{
- int j;
+ uint32_t j;
for (j = t0.seconds; j < t1.seconds; j++) {
int depth = interpolate(d0.mm, d1.mm, j - t0.seconds, t1.seconds - t0.seconds);
@@ -476,11 +477,11 @@ static struct gaschanges *analyze_gaslist(struct diveplan *diveplan, int *gascha
}
/* sort all the stops into one ordered list */
-static unsigned int *sort_stops(int *dstops, int dnr, struct gaschanges *gstops, int gnr)
+static int *sort_stops(int *dstops, int dnr, struct gaschanges *gstops, int gnr)
{
int i, gi, di;
int total = dnr + gnr;
- unsigned int *stoplevels = malloc(total * sizeof(int));
+ int *stoplevels = malloc(total * sizeof(int));
/* no gaschanges */
if (gnr == 0) {
@@ -981,13 +982,13 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
int po2;
int transitiontime, gi;
int current_cylinder;
- unsigned int stopidx;
+ int stopidx;
int depth;
struct gaschanges *gaschanges = NULL;
int gaschangenr;
int *decostoplevels;
int decostoplevelcount;
- unsigned int *stoplevels = NULL;
+ int *stoplevels = NULL;
bool stopping = false;
bool pendinggaschange = false;
int clock, previous_point_time;