Earlier we converted the C++ code to using true/false, and this converts
the C code to using the same style.

We already depended on stdbool.h in subsurfacestartup.[ch], and we build
with -std=gnu99 so nobody could build subsurface without a c99 compiler.

Signed-off-by: Anton Lundin <[email protected]>
---
 deco.c              |  6 ++--
 dive.c              | 12 ++++----
 dive.h              | 19 +-----------
 divelist.c          | 44 +++++++++++++--------------
 equipment.c         |  8 ++---
 libdivecomputer.c   | 18 +++++------
 parse-xml.c         | 10 +++----
 planner.c           |  4 +--
 profile.c           | 12 ++++----
 save-xml.c          |  2 +-
 statistics.c        | 20 ++++++-------
 subsurfacestartup.c | 34 ++++++++++-----------
 uemis-downloader.c  | 86 ++++++++++++++++++++++++++---------------------------
 uemis.c             |  6 ++--
 14 files changed, 132 insertions(+), 149 deletions(-)

diff --git a/deco.c b/deco.c
index 698b331..3009047 100644
--- a/deco.c
+++ b/deco.c
@@ -27,9 +27,9 @@ struct buehlmann_config {
   double  gf_high;             //! gradient factor high (at surface).
   double  gf_low;              //! gradient factor low (at bottom/start of 
deco calculation).
   double  gf_low_position_min; //! gf_low_position below surface_min_shallow.
-  bool    gf_low_at_maxdepth;  //! if TRUE, gf_low applies at max depth 
instead of at deepest ceiling.
+  bool    gf_low_at_maxdepth;  //! if true, gf_low applies at max depth 
instead of at deepest ceiling.
 };
-struct buehlmann_config buehlmann_config = { 1.0, 1.01, 0, 0.75, 0.35, 2.0, 
FALSE };
+struct buehlmann_config buehlmann_config = { 1.0, 1.01, 0, 0.75, 0.35, 2.0, 
false };
 
 const double buehlmann_N2_a[] = {1.1696, 1.0, 0.8618, 0.7562,
                                 0.62, 0.5043, 0.441, 0.4,
@@ -92,7 +92,7 @@ static double tissue_tolerance_calc(const struct dive *dive)
        double ret_tolerance_limit_ambient_pressure = 0.0;
        double gf_high = buehlmann_config.gf_high;
        double gf_low = buehlmann_config.gf_low;
-       double surface = get_surface_pressure_in_mbar(dive, TRUE) / 1000.0;
+       double surface = get_surface_pressure_in_mbar(dive, true) / 1000.0;
 
        for (ci = 0; ci < 16; ci++)
        {
diff --git a/dive.c b/dive.c
index 7d62616..455b128 100644
--- a/dive.c
+++ b/dive.c
@@ -570,12 +570,12 @@ static void sanitize_cylinder_info(struct dive *dive)
 static bool is_potentially_redundant(struct event *event)
 {
        if (!strcmp(event->name, "gaschange"))
-               return FALSE;
+               return false;
        if (!strcmp(event->name, "bookmark"))
-               return FALSE;
+               return false;
        if (!strcmp(event->name, "heading"))
-               return FALSE;
-       return TRUE;
+               return false;
+       return true;
 }
 
 /* match just by name - we compare the details in the code that uses this 
helper */
@@ -760,7 +760,7 @@ static void fixup_dc_events(struct divecomputer *dc)
                        if (prev && prev->value == event->value &&
                            prev->flags == event->flags &&
                            event->time.seconds - prev->time.seconds < 61)
-                               event->deleted = TRUE;
+                               event->deleted = true;
                }
                event = event->next;
        }
@@ -1053,7 +1053,7 @@ add_sample_b:
                if (as->stopdepth.mm)
                        sample.stopdepth = as->stopdepth;
                if (as->in_deco)
-                       sample.in_deco = TRUE;
+                       sample.in_deco = true;
 
                merge_one_sample(&sample, at, res);
 
diff --git a/dive.h b/dive.h
index 2b69c94..a562acb 100644
--- a/dive.h
+++ b/dive.h
@@ -27,25 +27,8 @@
 
 #ifdef __cplusplus
 extern "C" {
-#else
-#if __STDC_VERSION__ >= 199901L
-#include <stdbool.h>
-#ifndef TRUE
-#define TRUE true
-#endif
-#ifndef FALSE
-#define FALSE false
-#endif
-#else
-typedef int bool;
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-#endif
 #endif
+#include <stdbool.h>
 
 #define O2_IN_AIR              209     // permille
 #define N2_IN_AIR              781
diff --git a/divelist.c b/divelist.c
index dfb7b65..e04807e 100644
--- a/divelist.c
+++ b/divelist.c
@@ -43,9 +43,9 @@
 #include "divelist.h"
 #include "display.h"
 
-static short dive_list_changed = FALSE;
+static short dive_list_changed = false;
 
-short autogroup = FALSE;
+short autogroup = false;
 
 dive_trip_t *dive_trip_list;
 
@@ -386,9 +386,9 @@ double init_decompression(struct dive *dive)
        int i, divenr = -1;
        unsigned int surface_time;
        timestamp_t when, lasttime = 0;
-       bool deco_init = FALSE;
+       bool deco_init = false;
        double tissue_tolerance, surface_pressure;
-       tissue_tolerance = surface_pressure = 
get_surface_pressure_in_mbar(dive, TRUE) / 1000.0;
+       tissue_tolerance = surface_pressure = 
get_surface_pressure_in_mbar(dive, true) / 1000.0;
 
        if (!dive)
                return 0.0;
@@ -411,10 +411,10 @@ double init_decompression(struct dive *dive)
                /* again skip dives from different trips */
                if (dive->divetrip && dive->divetrip != pdive->divetrip)
                        continue;
-               surface_pressure = get_surface_pressure_in_mbar(pdive, TRUE) / 
1000.0;
+               surface_pressure = get_surface_pressure_in_mbar(pdive, true) / 
1000.0;
                if (!deco_init) {
                        clear_deco(surface_pressure);
-                       deco_init = TRUE;
+                       deco_init = true;
 #if DECO_CALC_DEBUG & 2
                        dump_tissues();
 #endif
@@ -437,7 +437,7 @@ double init_decompression(struct dive *dive)
        /* add the final surface time */
        if (lasttime && dive->when > lasttime) {
                surface_time = dive->when - lasttime;
-               surface_pressure = get_surface_pressure_in_mbar(dive, TRUE) / 
1000.0;
+               surface_pressure = get_surface_pressure_in_mbar(dive, true) / 
1000.0;
                tissue_tolerance = add_segment(surface_pressure, &air, 
surface_time, 0, dive);
 #if DECO_CALC_DEBUG & 2
                printf("after surface intervall of %d:%02u\n", 
FRACTION(surface_time,60));
@@ -445,7 +445,7 @@ double init_decompression(struct dive *dive)
 #endif
        }
        if (!deco_init) {
-               surface_pressure = get_surface_pressure_in_mbar(dive, TRUE) / 
1000.0;
+               surface_pressure = get_surface_pressure_in_mbar(dive, true) / 
1000.0;
                clear_deco(surface_pressure);
 #if DECO_CALC_DEBUG & 2
                printf("no previous dive\n");
@@ -647,7 +647,7 @@ void add_dive_to_trip(struct dive *dive, dive_trip_t *trip)
        if (dive->divetrip == trip)
                return;
        assert(trip->when);
-       remove_dive_from_trip(dive, FALSE);
+       remove_dive_from_trip(dive, false);
        trip->nrdives++;
        dive->divetrip = trip;
        dive->tripflag = ASSIGNED_TRIP;
@@ -725,7 +725,7 @@ void delete_single_dive(int idx)
        struct dive *dive = get_dive(idx);
        if (!dive)
                return; /* this should never happen */
-       remove_dive_from_trip(dive, FALSE);
+       remove_dive_from_trip(dive, false);
        if (dive->selected)
                deselect_dive(idx);
        for (i = idx; i < dive_table.nr - 1; i++)
@@ -768,21 +768,21 @@ bool consecutive_selected()
 {
        struct dive *d;
        int i;
-       bool consecutive = TRUE;
-       bool firstfound = FALSE;
-       bool lastfound = FALSE;
+       bool consecutive = true;
+       bool firstfound = false;
+       bool lastfound = false;
 
        if (amount_selected == 0 || amount_selected == 1)
-               return TRUE;
+               return true;
 
        for_each_dive(i, d) {
                if (d->selected) {
                        if (!firstfound)
-                               firstfound = TRUE;
+                               firstfound = true;
                        else if (lastfound)
-                               consecutive = FALSE;
+                               consecutive = false;
                } else if (firstfound) {
-                       lastfound = TRUE;
+                       lastfound = true;
                }
        }
        return consecutive;
@@ -798,7 +798,7 @@ struct dive *merge_two_dives(struct dive *a, struct dive *b)
                return NULL;
        i = get_divenr(a);
        j = get_divenr(b);
-       res = merge_dives(a, b, b->when - a->when, FALSE);
+       res = merge_dives(a, b, b->when - a->when, false);
        if (!res)
                return NULL;
 
@@ -809,7 +809,7 @@ struct dive *merge_two_dives(struct dive *a, struct dive *b)
        // why?
        // because this way one of the previously selected ids is still around
        res->id = id;
-       mark_divelist_changed(TRUE);
+       mark_divelist_changed(true);
        return res;
 }
 
@@ -871,7 +871,7 @@ void remove_autogen_trips()
                dive_trip_t *trip = dive->divetrip;
 
                if (trip && trip->autogen)
-                       remove_dive_from_trip(dive, TRUE);
+                       remove_dive_from_trip(dive, true);
        }
 }
 
@@ -990,7 +990,7 @@ void process_dives(bool is_imported, bool prefer_imported)
        }
        /* make sure no dives are still marked as downloaded */
        for (i = 1; i < dive_table.nr; i++)
-               dive_table.dives[i]->downloaded = FALSE;
+               dive_table.dives[i]->downloaded = false;
 
        if (is_imported) {
                /* If there are dives in the table, are they numbered */
@@ -999,6 +999,6 @@ void process_dives(bool is_imported, bool prefer_imported)
 
                /* did we add dives to the dive table? */
                if (preexisting != dive_table.nr)
-                       mark_divelist_changed(TRUE);
+                       mark_divelist_changed(true);
        }
 }
diff --git a/equipment.c b/equipment.c
index 133bef2..b60aa3e 100644
--- a/equipment.c
+++ b/equipment.c
@@ -91,8 +91,8 @@ bool no_weightsystems(weightsystem_t *ws)
 
        for (i = 0; i < MAX_WEIGHTSYSTEMS; i++)
                if (!weightsystem_none(ws + i))
-                       return FALSE;
-       return TRUE;
+                       return false;
+       return true;
 }
 
 static bool one_weightsystem_equal(weightsystem_t *ws1, weightsystem_t *ws2)
@@ -107,8 +107,8 @@ bool weightsystems_equal(weightsystem_t *ws1, 
weightsystem_t *ws2)
 
        for (i = 0; i < MAX_WEIGHTSYSTEMS; i++)
                if (!one_weightsystem_equal(ws1 + i, ws2 + i))
-                       return FALSE;
-       return TRUE;
+                       return false;
+       return true;
 }
 
 /*
diff --git a/libdivecomputer.c b/libdivecomputer.c
index 48b8151..69fa38c 100644
--- a/libdivecomputer.c
+++ b/libdivecomputer.c
@@ -70,7 +70,7 @@ static bool get_tanksize(device_data_t *devdata, const 
unsigned char *data, cyli
                 * right data */
                if (*(uint32_t *)data != 0xFFFEFFFE) {
                        printf("incorrect header for Atomics dive\n");
-                       return FALSE;
+                       return false;
                }
                atomics_gas_info = (void*)(data + COBALT_HEADER);
                switch (atomics_gas_info[idx].tankspecmethod) {
@@ -90,9 +90,9 @@ static bool get_tanksize(device_data_t *devdata, const 
unsigned char *data, cyli
                        cyl[idx].type.size.mliter = 
atomics_gas_info[idx].tanksize * 100;
                        break;
                }
-               return TRUE;
+               return true;
        }
-       return FALSE;
+       return false;
 }
 
 static int parse_gasmixes(device_data_t *devdata, struct dive *dive, 
dc_parser_t *parser, int ngases,
@@ -247,15 +247,15 @@ sample_cb(dc_sample_type_t type, dc_sample_value_t value, 
void *userdata)
                if (value.deco.type == DC_DECO_NDL) {
                        sample->ndl.seconds = ndl = value.deco.time;
                        sample->stopdepth.mm = stopdepth = value.deco.depth * 
1000.0 + 0.5;
-                       sample->in_deco = in_deco = FALSE;
+                       sample->in_deco = in_deco = false;
                } else if (value.deco.type == DC_DECO_DECOSTOP ||
                           value.deco.type == DC_DECO_DEEPSTOP) {
-                       sample->in_deco = in_deco = TRUE;
+                       sample->in_deco = in_deco = true;
                        sample->stopdepth.mm = stopdepth = value.deco.depth * 
1000.0 + 0.5;
                        sample->stoptime.seconds = stoptime = value.deco.time;
                        ndl = 0;
                } else if (value.deco.type == DC_DECO_SAFETYSTOP) {
-                       sample->in_deco = in_deco = FALSE;
+                       sample->in_deco = in_deco = false;
                        sample->stopdepth.mm = stopdepth = value.deco.depth * 
1000.0 + 0.5;
                        sample->stoptime.seconds = stoptime = value.deco.time;
                }
@@ -394,7 +394,7 @@ static int dive_cb(const unsigned char *data, unsigned int 
size,
 
        /* reset the deco / ndl data */
        ndl = stoptime = stopdepth = 0;
-       in_deco = FALSE;
+       in_deco = false;
 
        rc = create_parser(devdata, &parser);
        if (rc != DC_STATUS_SUCCESS) {
@@ -511,9 +511,9 @@ static int dive_cb(const unsigned char *data, unsigned int 
size,
                dive->dc.sample[0].temperature.mkelvin = 0;
        }
 
-       dive->downloaded = TRUE;
+       dive->downloaded = true;
        record_dive(dive);
-       mark_divelist_changed(TRUE);
+       mark_divelist_changed(true);
        return 1;
 }
 
diff --git a/parse-xml.c b/parse-xml.c
index 04b6d4d..3845e42 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -134,7 +134,7 @@ struct {
        const char *nickname, *serial_nr, *firmware;
 } dc;
 } cur_settings;
-static bool in_settings = FALSE;
+static bool in_settings = false;
 static struct tm cur_tm;
 static int cur_cylinder_index, cur_ws_index;
 static int lastndl, laststoptime, laststopdepth, lastcns, lastpo2, lastindeco;
@@ -266,7 +266,7 @@ enum number_type {
 static enum number_type parse_float(const char *buffer, double *res, const 
char **endp)
 {
        double val;
-       static bool first_time = TRUE;
+       static bool first_time = true;
 
        errno = 0;
        val = ascii_strtod(buffer, endp);
@@ -279,7 +279,7 @@ static enum number_type parse_float(const char *buffer, 
double *res, const char
                         * that information available */
                        if (first_time) {
                                fprintf(stderr, "Floating point value with 
decimal comma (%s)?\n", buffer);
-                               first_time = FALSE;
+                               first_time = false;
                        }
                        /* Try again in permissive mode*/
                        val = strtod_flags(buffer, endp, 0);
@@ -1222,12 +1222,12 @@ static void reset_dc_settings(void)
 
 static void settings_start(void)
 {
-       in_settings = TRUE;
+       in_settings = true;
 }
 
 static void settings_end(void)
 {
-       in_settings = FALSE;
+       in_settings = false;
 }
 
 static void dc_settings_start(void)
diff --git a/planner.c b/planner.c
index 339801d..4699314 100644
--- a/planner.c
+++ b/planner.c
@@ -50,7 +50,7 @@ void dump_plan(struct diveplan *diveplan)
 
 void set_last_stop(bool last_stop_6m)
 {
-       if (last_stop_6m == TRUE)
+       if (last_stop_6m == true)
                decostoplevels[1] = 6000;
        else
                decostoplevels[1] = 3000;
@@ -341,7 +341,7 @@ struct divedatapoint *create_dp(int time_incr, int depth, 
int o2, int he, int po
        dp->o2 = o2;
        dp->he = he;
        dp->po2 = po2;
-       dp->entered = FALSE;
+       dp->entered = false;
        dp->next = NULL;
        return dp;
 }
diff --git a/profile.c b/profile.c
index 637c894..2c6e3ad 100644
--- a/profile.c
+++ b/profile.c
@@ -138,7 +138,7 @@ void remember_event(const char *eventname)
                        return;
        }
        ev_namelist[evn_used].ev_name = strdup(eventname);
-       ev_namelist[evn_used].plot_ev = TRUE;
+       ev_namelist[evn_used].plot_ev = true;
        evn_used++;
 }
 
@@ -195,12 +195,12 @@ int get_cylinder_pressure_range(struct graphics_context 
*gc)
                gc->bottomy = 0;
        gc->topy = gc->pi.maxpressure * 1.5;
        if (!gc->pi.maxpressure)
-               return FALSE;
+               return false;
 
        while (gc->pi.endtempcoord <= SCALEY(gc, gc->pi.minpressure - 
(gc->topy) * 0.1))
                gc->bottomy -=  gc->topy * 0.1 * gc->maxy/abs(gc->maxy);
 
-       return TRUE;
+       return true;
 }
 
 
@@ -968,7 +968,7 @@ static void populate_pressure_information(struct dive 
*dive, struct divecomputer
        int i, cylinderindex;
        pr_track_t *track_pr[MAX_CYLINDERS] = {NULL, };
        pr_track_t *current;
-       bool missing_pr = FALSE;
+       bool missing_pr = false;
 
        cylinderindex = -1;
        current = NULL;
@@ -1051,7 +1051,7 @@ static void calculate_ndl_tts(double tissue_tolerance, 
struct plot_data *entry,
        }
 
        /* We are in deco */
-       entry->in_deco_calc = TRUE;
+       entry->in_deco_calc = true;
 
        /* Add segments for movement to stopdepth */
        for (; ascent_depth > next_stop; ascent_depth -= ascent_mm_per_step, 
entry->tts_calc += ascent_s_per_step) {
@@ -1093,7 +1093,7 @@ static void calculate_ndl_tts(double tissue_tolerance, 
struct plot_data *entry,
 static void calculate_deco_information(struct dive *dive, struct divecomputer 
*dc, struct plot_info *pi, bool print_mode)
 {
        int i;
-       double surface_pressure = (dc->surface_pressure.mbar ? 
dc->surface_pressure.mbar : get_surface_pressure_in_mbar(dive, TRUE)) / 1000.0;
+       double surface_pressure = (dc->surface_pressure.mbar ? 
dc->surface_pressure.mbar : get_surface_pressure_in_mbar(dive, true)) / 1000.0;
        double tissue_tolerance = 0;
        for (i = 1; i < pi->nr; i++) {
                struct plot_data *entry = pi->entry + i;
diff --git a/save-xml.c b/save-xml.c
index 7edfb96..704227c 100644
--- a/save-xml.c
+++ b/save-xml.c
@@ -569,7 +569,7 @@ static void save_one_device(FILE *f, const char * model, 
uint32_t deviceid,
 
 void save_dives(const char *filename)
 {
-       save_dives_logic(filename, FALSE);
+       save_dives_logic(filename, false);
 }
 
 void save_dives_logic(const char *filename, const bool select_only)
diff --git a/statistics.c b/statistics.c
index fbb7397..8277b64 100644
--- a/statistics.c
+++ b/statistics.c
@@ -126,7 +126,7 @@ void process_all_dives(struct dive *dive, struct dive 
**prev_dive)
        memset(stats_yearly, 0, size);
        memset(stats_monthly, 0, size);
        memset(stats_by_trip, 0, size);
-       stats_yearly[0].is_year = TRUE;
+       stats_yearly[0].is_year = true;
 
        /* this relies on the fact that the dives in the dive_table
         * are in chronological order */
@@ -147,7 +147,7 @@ void process_all_dives(struct dive *dive, struct dive 
**prev_dive)
                if (current_year != tm.tm_year + 1900) {
                        current_year = tm.tm_year + 1900;
                        process_dive(dp, &(stats_yearly[++year_iter]));
-                       stats_yearly[year_iter].is_year = TRUE;
+                       stats_yearly[year_iter].is_year = true;
                } else {
                        process_dive(dp, &(stats_yearly[year_iter]));
                }
@@ -163,12 +163,12 @@ void process_all_dives(struct dive *dive, struct dive 
**prev_dive)
                        /* stats_by_trip[0] is all the dives combined */
                        stats_by_trip[0].selection_size++;
                        process_dive(dp, &(stats_by_trip[0]));
-                       stats_by_trip[0].is_trip = TRUE;
+                       stats_by_trip[0].is_trip = true;
                        stats_by_trip[0].location = strdup("All (by trip 
stats)");
 
                        process_dive(dp, &(stats_by_trip[trip_iter]));
                        stats_by_trip[trip_iter].selection_size++;
-                       stats_by_trip[trip_iter].is_trip = TRUE;
+                       stats_by_trip[trip_iter].is_trip = true;
                        stats_by_trip[trip_iter].location = 
dp->divetrip->location;
                }
 
@@ -295,24 +295,24 @@ void get_selected_dives_text(char *buffer, int size)
 static bool is_gas_used(struct dive *dive, int idx)
 {
        struct divecomputer *dc = &dive->dc;
-       bool firstGasExplicit = FALSE;
+       bool firstGasExplicit = false;
        if (cylinder_none(&dive->cylinder[idx]))
-               return FALSE;
+               return false;
 
        while (dc) {
                struct event *event = get_next_event(dc->events, "gaschange");
                while (event) {
                        if (event->time.seconds < 30)
-                               firstGasExplicit = TRUE;
+                               firstGasExplicit = true;
                        if (get_cylinder_index(dive, event) == idx)
-                               return TRUE;
+                               return true;
                        event = get_next_event(event->next, "gaschange");
                }
                dc = dc->next;
        }
        if (idx == 0 && !firstGasExplicit)
-               return TRUE;
-       return FALSE;
+               return true;
+       return false;
 }
 
 void get_gas_used(struct dive *dive, volume_t gases[MAX_CYLINDERS])
diff --git a/subsurfacestartup.c b/subsurfacestartup.c
index 0640333..e858285 100644
--- a/subsurfacestartup.c
+++ b/subsurfacestartup.c
@@ -8,28 +8,28 @@ struct preferences default_prefs = {
        .units = SI_UNITS,
        .unit_system = METRIC,
        .pp_graphs = {
-               .po2 = FALSE,
-               .pn2 = FALSE,
-               .phe = FALSE,
+               .po2 = false,
+               .pn2 = false,
+               .phe = false,
                .po2_threshold =  1.6,
                .pn2_threshold =  4.0,
                .phe_threshold = 13.0,
        },
-       .mod  = FALSE,
+       .mod  = false,
        .mod_ppO2  = 1.6,
-       .ead  = FALSE,
-       .profile_dc_ceiling = TRUE,
-       .profile_red_ceiling  = FALSE,
-       .profile_calc_ceiling = FALSE,
-       .calc_ceiling_3m_incr = FALSE,
-       .calc_ndl_tts = FALSE,
+       .ead  = false,
+       .profile_dc_ceiling = true,
+       .profile_red_ceiling  = false,
+       .profile_calc_ceiling = false,
+       .calc_ceiling_3m_incr = false,
+       .calc_ndl_tts = false,
        .gflow = 30,
        .gfhigh = 75,
-       .gf_low_at_maxdepth = FALSE,
+       .gf_low_at_maxdepth = false,
        .font_size = 14.0,
-       .display_invalid_dives = FALSE,
-       .show_sac = FALSE,
-       .display_unused_tanks = FALSE
+       .display_invalid_dives = false,
+       .show_sac = false,
+       .display_unused_tanks = false
 };
 
 struct units *get_units()
@@ -77,7 +77,7 @@ const char *monthname(int mon)
 /*
  * track whether we switched to importing dives
  */
-bool imported = FALSE;
+bool imported = false;
 
 static void print_version() {
        printf("Subsurface v%s, ", VERSION_STRING);
@@ -116,7 +116,7 @@ void parse_argument(const char *arg)
                                exit(0);
                        }
                        if (strcmp(arg, "--import") == 0) {
-                               imported = TRUE; /* mark the dives so far as 
the base, * everything after is imported */
+                               imported = true; /* mark the dives so far as 
the base, * everything after is imported */
                                return;
                        }
                        if (strcmp(arg, "--verbose") == 0) {
@@ -149,7 +149,7 @@ void renumber_dives(int nr)
                struct dive *dive = dive_table.dives[i];
                dive->number = nr + i;
        }
-       mark_divelist_changed(TRUE);
+       mark_divelist_changed(true);
 }
 
 /*
diff --git a/uemis-downloader.c b/uemis-downloader.c
index 2b25156..ceac292 100644
--- a/uemis-downloader.c
+++ b/uemis-downloader.c
@@ -109,7 +109,7 @@ static void uemis_get_weight(char *buffer, weightsystem_t 
*weight, int diveid)
 static struct dive *uemis_start_dive(uint32_t deviceid)
 {
        struct dive *dive = alloc_dive();
-       dive->downloaded = TRUE;
+       dive->downloaded = true;
        dive->dc.model = strdup("Uemis Zurich");
        dive->dc.deviceid = deviceid;
        return dive;
@@ -191,7 +191,7 @@ static bool uemis_init(const char *path)
        int i;
 
        if (!path)
-               return FALSE;
+               return false;
        /* let's check if this is indeed a Uemis DC */
        reqtxt_path = build_filename(path,"req.txt");
        reqtxt_file = subsurface_open(reqtxt_path, O_RDONLY, 0666);
@@ -199,7 +199,7 @@ static bool uemis_init(const char *path)
 #if UEMIS_DEBUG & 1
                fprintf(debugfile, ":EE req.txt can't be opened\n");
 #endif
-               return FALSE;
+               return false;
        }
        if (bytes_available(reqtxt_file) > 5) {
                char tmp[6];
@@ -209,7 +209,7 @@ static bool uemis_init(const char *path)
                fprintf(debugfile, "::r req.txt \"%s\"\n", tmp);
 #endif
                if (sscanf(tmp + 1, "%d", &filenr) != 1)
-                       return FALSE;
+                       return false;
        } else {
                filenr = 0;
 #if UEMIS_DEBUG & 2
@@ -226,7 +226,7 @@ static bool uemis_init(const char *path)
        /* initialize the array in which we collect the answers */
        for (i = 0; i < NUM_PARAM_BUFS; i++)
                param_buff[i] = "";
-       return TRUE;
+       return true;
 }
 
 static void str_append_with_delim(char *s, char *t)
@@ -276,7 +276,7 @@ static char *next_segment(char *buf, int *offset, int size)
 {
        int i = *offset;
        int seg_size;
-       bool done = FALSE;
+       bool done = false;
        char *segment;
 
        while (!done) {
@@ -285,10 +285,10 @@ static char *next_segment(char *buf, int *offset, int 
size)
                                (buf[i+1] == '\\' || buf[i+1] == '{'))
                                memcpy(buf + i, buf + i + 1, size - i - 1);
                        else if (buf[i] == '{')
-                               done = TRUE;
+                               done = true;
                        i++;
                } else {
-                       done = TRUE;
+                       done = true;
                }
        }
        seg_size = i - *offset - 1;
@@ -324,9 +324,9 @@ static void buffer_add(char **buffer, int *buffer_size, 
char *buf)
 static bool next_file(int max)
 {
        if (filenr >= max)
-               return FALSE;
+               return false;
        filenr++;
-       return TRUE;
+       return true;
 }
 
 static char *first_object_id_val(char* buf)
@@ -390,12 +390,12 @@ static bool uemis_get_answer(const char *path, char 
*request, int n_param_in,
        char fl[13];
        char tmp[101];
        const char *what = translate("gettextFromC","data");
-       bool searching = TRUE;
-       bool assembling_mbuf = FALSE;
-       bool ismulti = FALSE;
-       bool found_answer = FALSE;
-       bool more_files = TRUE;
-       bool answer_in_mbuf = FALSE;
+       bool searching = true;
+       bool assembling_mbuf = false;
+       bool ismulti = false;
+       bool found_answer = false;
+       bool more_files = true;
+       bool answer_in_mbuf = false;
        char *ans_path;
        int ans_file;
        int timeout = UEMIS_LONG_TIMEOUT;
@@ -407,7 +407,7 @@ static bool uemis_get_answer(const char *path, char 
*request, int n_param_in,
                str_append_with_delim(sb, param_buff[i]);
        if (! strcmp(request, "getDivelogs") || ! strcmp(request, 
"getDeviceData") || ! strcmp(request, "getDirectory") ||
                ! strcmp(request, "getDivespot") || ! strcmp(request, 
"getDive")) {
-               answer_in_mbuf = TRUE;
+               answer_in_mbuf = true;
                str_append_with_delim(sb, "");
                if (! strcmp(request, "getDivelogs"))
                        what = translate("gettextFromC","divelog entry id");
@@ -425,11 +425,11 @@ static bool uemis_get_answer(const char *path, char 
*request, int n_param_in,
 #endif
        if (write(reqtxt_file, sb, strlen(sb)) != strlen(sb)) {
                *error_text = translate("gettextFromC",ERR_FS_SHORT_WRITE);
-               return FALSE;
+               return false;
        }
        if (! next_file(number_of_files)) {
                *error_text = translate("gettextFromC",ERR_FS_FULL);
-               more_files = FALSE;
+               more_files = false;
        }
        trigger_response(reqtxt_file, "n", filenr, file_length);
        usleep(timeout);
@@ -437,7 +437,7 @@ static bool uemis_get_answer(const char *path, char 
*request, int n_param_in,
        mbuf_size = 0;
        while (searching || assembling_mbuf) {
                if (import_thread_cancelled)
-                       return FALSE;
+                       return false;
                progress_bar_fraction = filenr / 4000.0;
                snprintf(fl, 13, "ANS%d.TXT", filenr - 1);
                ans_path = build_filename(build_filename(path, "ANS"), fl);
@@ -457,18 +457,18 @@ static bool uemis_get_answer(const char *path, char 
*request, int n_param_in,
 #endif
                free(ans_path);
                if (tmp[0] == '1') {
-                       searching = FALSE;
+                       searching = false;
                        if (tmp[1] == 'm') {
-                               assembling_mbuf = TRUE;
-                               ismulti = TRUE;
+                               assembling_mbuf = true;
+                               ismulti = true;
                        }
                        if (tmp[2] == 'e')
-                               assembling_mbuf = FALSE;
+                               assembling_mbuf = false;
                        if (assembling_mbuf) {
                                if (! next_file(number_of_files)) {
                                        *error_text = 
translate("gettextFromC",ERR_FS_FULL);
-                                       more_files = FALSE;
-                                       assembling_mbuf = FALSE;
+                                       more_files = false;
+                                       assembling_mbuf = false;
                                }
                                reqtxt_file = subsurface_open(reqtxt_path, 
O_RDWR | O_CREAT, 0666);
                                trigger_response(reqtxt_file, "n", filenr, 
file_length);
@@ -476,9 +476,9 @@ static bool uemis_get_answer(const char *path, char 
*request, int n_param_in,
                } else {
                        if (! next_file(number_of_files - 1)) {
                                *error_text = 
translate("gettextFromC",ERR_FS_FULL);
-                               more_files = FALSE;
-                               assembling_mbuf = FALSE;
-                               searching = FALSE;
+                               more_files = false;
+                               assembling_mbuf = false;
+                               searching = false;
                        }
                        reqtxt_file = subsurface_open(reqtxt_path, O_RDWR | 
O_CREAT, 0666);
                        trigger_response(reqtxt_file, "r", filenr, file_length);
@@ -529,7 +529,7 @@ static bool uemis_get_answer(const char *path, char 
*request, int n_param_in,
                        close(ans_file);
                        free(ans_path);
                } else {
-                       ismulti = FALSE;
+                       ismulti = false;
                }
 #if UEMIS_DEBUG & 8
                fprintf(debugfile,":r: %s\n", buf);
@@ -537,7 +537,7 @@ static bool uemis_get_answer(const char *path, char 
*request, int n_param_in,
                if (!answer_in_mbuf)
                        for (i = 0; i < n_param_out && j < size; i++)
                                param_buff[i] = next_segment(buf, &j, size);
-               found_answer = TRUE;
+               found_answer = true;
                free(buf);
        }
 #if UEMIS_DEBUG & 1
@@ -643,10 +643,10 @@ static void process_raw_buffer(uint32_t deviceid, char 
*inbuf, char **max_divenr
 {
        char *buf = strdup(inbuf);
        char *tp, *bp, *tag, *type, *val;
-       bool done = FALSE;
+       bool done = false;
        int inbuflen = strlen(inbuf);
        char *endptr = buf + inbuflen;
-       bool log = FALSE;
+       bool log = false;
        char *sections[10];
        int s, nr_sections = 0;
        struct dive *dive = NULL;
@@ -657,7 +657,7 @@ static void process_raw_buffer(uint32_t deviceid, char 
*inbuf, char **max_divenr
        tp = next_token(&bp);
        if (strcmp(tp, "divelog") == 0) {
                /* this is a divelog */
-               log = TRUE;
+               log = true;
                tp = next_token(&bp);
                if (strcmp(tp,"1.0") != 0) {
                        free(buf);
@@ -720,22 +720,22 @@ static void process_raw_buffer(uint32_t deviceid, char 
*inbuf, char **max_divenr
                        parse_tag(dive, tag, val);
                }
                if (log && ! strcmp(tag, "file_content"))
-                       done = TRUE;
+                       done = true;
                /* done with one dive (got the file_content tag), but there 
could be more:
                 * a '{' indicates the end of the record - but we need to see 
another "{{"
                 * later in the buffer to know that the next record is complete 
(it could
                 * be a short read because of some error */
                if (done && ++bp < endptr && *bp != '{' && strstr(bp, "{{")) {
-                       done = FALSE;
+                       done = false;
                        record_dive(dive);
-                       mark_divelist_changed(TRUE);
+                       mark_divelist_changed(true);
                        dive = uemis_start_dive(deviceid);
                }
        }
        if (log) {
                if (dive->dc.diveid) {
                        record_dive(dive);
-                       mark_divelist_changed(TRUE);
+                       mark_divelist_changed(true);
                } else { /* partial dive */
                        free(dive);
                }
@@ -774,10 +774,10 @@ const char *do_uemis_import(const char *mountpath, short 
force_download)
        char *deviceid = NULL;
        const char *result = NULL;
        char *endptr;
-       bool success, keep_number = FALSE, once = TRUE;
+       bool success, keep_number = false, once = true;
 
        if (dive_table.nr == 0)
-               keep_number = TRUE;
+               keep_number = true;
        uemis_info(translate("gettextFromC","Init Communication"));
        if (! uemis_init(mountpath))
                return translate("gettextFromC","Uemis init failed");
@@ -817,7 +817,7 @@ const char *do_uemis_import(const char *mountpath, short 
force_download)
                        if (t && atoi(t) > start)
                                start = atoi(t);
                        free(t);
-                       once = FALSE;
+                       once = false;
                }
                /* if the user clicked cancel, exit gracefully */
                if (import_thread_cancelled)
@@ -856,7 +856,7 @@ const char *do_uemis_import(const char *mountpath, short 
force_download)
                success = uemis_get_answer(mountpath, "getDive", 3, 0, &result);
                if (mbuf) {
                        int divenr;
-                       process_raw_buffer(deviceidnr, mbuf, &newmax, FALSE, 
&divenr);
+                       process_raw_buffer(deviceidnr, mbuf, &newmax, false, 
&divenr);
                        if (divenr > -1 && divenr != i) {
                                offset = i - divenr;
 #if UEMIS_DEBUG & 2
@@ -869,7 +869,7 @@ const char *do_uemis_import(const char *mountpath, short 
force_download)
                if (!success || import_thread_cancelled)
                        break;
        }
-       success = TRUE;
+       success = true;
        for (i = 0; i <= nr_divespots; i++) {
                char divespotnr[10];
                snprintf(divespotnr, sizeof(divespotnr), "%d", i);
diff --git a/uemis.c b/uemis.c
index d869180..27e526f 100644
--- a/uemis.c
+++ b/uemis.c
@@ -252,20 +252,20 @@ static void uemis_event(struct dive *dive, struct 
divecomputer *dc, struct sampl
        stopdepth = rel_mbar_to_depth(u_sample->hold_depth, dive);
        if ((flags[3] & 1) | (flags[5] & 2)) {
                /* deco */
-               sample->in_deco = TRUE;
+               sample->in_deco = true;
                sample->stopdepth.mm = stopdepth;
                sample->stoptime.seconds = u_sample->hold_time *60;
                sample->ndl.seconds = 0;
        } else if (flags[0] & 128) {
                /* safety stop - distinguished from deco stop by having
                 * both ndl and stop information */
-               sample->in_deco = FALSE;
+               sample->in_deco = false;
                sample->stopdepth.mm = stopdepth;
                sample->stoptime.seconds = u_sample->hold_time *60;
                sample->ndl.seconds = lastndl;
        } else {
                /* NDL */
-               sample->in_deco = FALSE;
+               sample->in_deco = false;
                lastndl = sample->ndl.seconds = u_sample->hold_time *60;
                sample->stopdepth.mm = 0;
                sample->stoptime.seconds = 0;
-- 
1.8.3.2

_______________________________________________
subsurface mailing list
[email protected]
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to