summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2017-11-19 09:46:19 +0100
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-11-20 20:56:13 +0100
commita15682ee76a1b38f2ca0885911a6a4a5880152ec (patch)
tree4e0fef68adf7f95bfb11ff5d6c94cfaa59c79b28
parentdd8e4fae2aa31f1fac2a8a6f086db0db0a3209c6 (diff)
downloadsubsurface-a15682ee76a1b38f2ca0885911a6a4a5880152ec.tar.gz
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>
-rw-r--r--core/pref.h45
1 files changed, 22 insertions, 23 deletions
diff --git a/core/pref.h b/core/pref.h
index 2cddf9220..c4989e692 100644
--- a/core/pref.h
+++ b/core/pref.h
@@ -9,12 +9,11 @@ extern "C" {
#include "units.h"
#include "taxonomy.h"
-/* can't use 'bool' for the boolean values - different size in C and C++ */
typedef struct
{
- short po2;
- short pn2;
- short phe;
+ bool po2;
+ bool pn2;
+ bool phe;
double po2_threshold_min;
double po2_threshold_max;
double pn2_threshold;
@@ -71,34 +70,34 @@ struct preferences {
bool date_format_override;
double font_size;
partial_pressure_graphs_t pp_graphs;
- short mod;
+ bool mod;
double modpO2;
- short ead;
- short dcceiling;
- short redceiling;
- short calcceiling;
- short calcceiling3m;
- short calcalltissues;
- short calcndltts;
+ bool ead;
+ bool dcceiling;
+ bool redceiling;
+ bool calcceiling;
+ bool calcceiling3m;
+ bool calcalltissues;
+ bool calcndltts;
short gflow;
short gfhigh;
int animation_speed;
bool gf_low_at_maxdepth;
bool show_ccr_setpoint;
bool show_ccr_sensors;
- short display_invalid_dives;
+ bool display_invalid_dives;
short unit_system;
struct units units;
bool coordinates_traditional;
- short show_sac;
- short display_unused_tanks;
- short show_average_depth;
- short zoomed_plot;
- short hrgraph;
- short percentagegraph;
- short rulergraph;
- short tankbar;
- short save_userid_local;
+ bool show_sac;
+ bool display_unused_tanks;
+ bool show_average_depth;
+ bool zoomed_plot;
+ bool hrgraph;
+ bool percentagegraph;
+ bool rulergraph;
+ bool tankbar;
+ bool save_userid_local;
const char *userid;
int ascrate75; // All rates in mm / sec
int ascrate50;
@@ -114,7 +113,7 @@ struct preferences {
int proxy_type;
const char *proxy_host;
int proxy_port;
- short proxy_auth;
+ bool proxy_auth;
const char *proxy_user;
const char *proxy_pass;
bool doo2breaks;