Make handling of booleans consistent on the C-side of preferences

Boolean settings were declared in pref.h randomly as bools and shorts.
Since the code relied anyway on bool being well-defined and identical
on the C- and C++-sides, turn all of them into bools. They use less
space and express intent more clearly.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2017-11-19 09:46:19 +01:00 committed by Lubomir I. Ivanov
parent dd8e4fae2a
commit a15682ee76

View file

@ -9,12 +9,11 @@ extern "C" {
#include "units.h" #include "units.h"
#include "taxonomy.h" #include "taxonomy.h"
/* can't use 'bool' for the boolean values - different size in C and C++ */
typedef struct typedef struct
{ {
short po2; bool po2;
short pn2; bool pn2;
short phe; bool phe;
double po2_threshold_min; double po2_threshold_min;
double po2_threshold_max; double po2_threshold_max;
double pn2_threshold; double pn2_threshold;
@ -71,34 +70,34 @@ struct preferences {
bool date_format_override; bool date_format_override;
double font_size; double font_size;
partial_pressure_graphs_t pp_graphs; partial_pressure_graphs_t pp_graphs;
short mod; bool mod;
double modpO2; double modpO2;
short ead; bool ead;
short dcceiling; bool dcceiling;
short redceiling; bool redceiling;
short calcceiling; bool calcceiling;
short calcceiling3m; bool calcceiling3m;
short calcalltissues; bool calcalltissues;
short calcndltts; bool calcndltts;
short gflow; short gflow;
short gfhigh; short gfhigh;
int animation_speed; int animation_speed;
bool gf_low_at_maxdepth; bool gf_low_at_maxdepth;
bool show_ccr_setpoint; bool show_ccr_setpoint;
bool show_ccr_sensors; bool show_ccr_sensors;
short display_invalid_dives; bool display_invalid_dives;
short unit_system; short unit_system;
struct units units; struct units units;
bool coordinates_traditional; bool coordinates_traditional;
short show_sac; bool show_sac;
short display_unused_tanks; bool display_unused_tanks;
short show_average_depth; bool show_average_depth;
short zoomed_plot; bool zoomed_plot;
short hrgraph; bool hrgraph;
short percentagegraph; bool percentagegraph;
short rulergraph; bool rulergraph;
short tankbar; bool tankbar;
short save_userid_local; bool save_userid_local;
const char *userid; const char *userid;
int ascrate75; // All rates in mm / sec int ascrate75; // All rates in mm / sec
int ascrate50; int ascrate50;
@ -114,7 +113,7 @@ struct preferences {
int proxy_type; int proxy_type;
const char *proxy_host; const char *proxy_host;
int proxy_port; int proxy_port;
short proxy_auth; bool proxy_auth;
const char *proxy_user; const char *proxy_user;
const char *proxy_pass; const char *proxy_pass;
bool doo2breaks; bool doo2breaks;