From 3c4fd5d5999db218878563a98e9c76903d63d2bb Mon Sep 17 00:00:00 2001 From: Paul Buxton Date: Wed, 28 Aug 2019 10:21:24 +0100 Subject: Fix broken windows build with latest MXE Replaces some enums with names that do not clash with windows #defines. Specifically: ERROR -> ERRORED, PASCAL->PASCALS, IGNORE->IGNORED,FLOAT->FLOATVAL Signed-off-by: Paul Buxton --- core/configuredivecomputer.h | 2 +- core/dive.c | 2 +- core/parse-xml.c | 26 +++++++++++++------------- core/units.c | 2 +- core/units.h | 5 +---- 5 files changed, 17 insertions(+), 20 deletions(-) (limited to 'core') diff --git a/core/configuredivecomputer.h b/core/configuredivecomputer.h index c70e9cfa4..72661f00a 100644 --- a/core/configuredivecomputer.h +++ b/core/configuredivecomputer.h @@ -26,7 +26,7 @@ public: FWUPDATE, CANCELLING, CANCELLED, - ERROR, + ERRORED, DONE, }; diff --git a/core/dive.c b/core/dive.c index a86ca4f57..05fa970b6 100644 --- a/core/dive.c +++ b/core/dive.c @@ -3404,7 +3404,7 @@ void set_informational_units(const char *units) if (strstr(units, "PSI")) git_prefs.units.pressure = PSI; if (strstr(units, "PASCAL")) - git_prefs.units.pressure = PASCAL; + git_prefs.units.pressure = PASCALS; if (strstr(units, "CELSIUS")) git_prefs.units.temperature = CELSIUS; if (strstr(units, "FAHRENHEIT")) diff --git a/core/parse-xml.c b/core/parse-xml.c index d4b8d72a7..8a7c4e2b9 100644 --- a/core/parse-xml.c +++ b/core/parse-xml.c @@ -145,7 +145,7 @@ static void divetags(char *buffer, struct tag_entry **tags) enum number_type { NEITHER, - FLOAT + FLOATVAL }; static enum number_type parse_float(const char *buffer, double *res, const char **endp) @@ -172,7 +172,7 @@ static enum number_type parse_float(const char *buffer, double *res, const char } *res = val; - return FLOAT; + return FLOATVAL; } union int_or_float { @@ -191,12 +191,12 @@ static void pressure(char *buffer, pressure_t *pressure, struct parser_state *st union int_or_float val; switch (integer_or_float(buffer, &val)) { - case FLOAT: + case FLOATVAL: /* Just ignore zero values */ if (!val.fp) break; switch (state->xml_parsing_units.pressure) { - case PASCAL: + case PASCALS: mbar = val.fp / 100; break; case BAR: @@ -233,7 +233,7 @@ static void salinity(char *buffer, int *salinity) { union int_or_float val; switch (integer_or_float(buffer, &val)) { - case FLOAT: + case FLOATVAL: *salinity = lrint(val.fp * 10.0); break; default: @@ -246,7 +246,7 @@ static void depth(char *buffer, depth_t *depth, struct parser_state *state) union int_or_float val; switch (integer_or_float(buffer, &val)) { - case FLOAT: + case FLOATVAL: switch (state->xml_parsing_units.length) { case METERS: depth->mm = lrint(val.fp * 1000); @@ -281,7 +281,7 @@ static void weight(char *buffer, weight_t *weight, struct parser_state *state) union int_or_float val; switch (integer_or_float(buffer, &val)) { - case FLOAT: + case FLOATVAL: switch (state->xml_parsing_units.weight) { case KG: weight->grams = lrint(val.fp * 1000); @@ -301,7 +301,7 @@ static void temperature(char *buffer, temperature_t *temperature, struct parser_ union int_or_float val; switch (integer_or_float(buffer, &val)) { - case FLOAT: + case FLOATVAL: switch (state->xml_parsing_units.temperature) { case KELVIN: temperature->mkelvin = lrint(val.fp * 1000); @@ -383,7 +383,7 @@ static void percent(char *buffer, fraction_t *fraction) const char *end; switch (parse_float(buffer, &val, &end)) { - case FLOAT: + case FLOATVAL: /* Turn fractions into percent unless explicit.. */ if (val <= 1.0) { while (isspace(*end)) @@ -424,7 +424,7 @@ static void cylindersize(char *buffer, volume_t *volume) union int_or_float val; switch (integer_or_float(buffer, &val)) { - case FLOAT: + case FLOATVAL: volume->mliter = lrint(val.fp * 1000); break; @@ -600,7 +600,7 @@ static void fahrenheit(char *buffer, temperature_t *temperature) union int_or_float val; switch (integer_or_float(buffer, &val)) { - case FLOAT: + case FLOATVAL: if (IS_FP_SAME(val.fp, 32.0)) break; if (val.fp < 32.0) @@ -638,7 +638,7 @@ static void psi_or_bar(char *buffer, pressure_t *pressure) union int_or_float val; switch (integer_or_float(buffer, &val)) { - case FLOAT: + case FLOATVAL: if (val.fp > 400) pressure->mbar = psi_to_mbar(val.fp); else @@ -1530,7 +1530,7 @@ static void uddf_importer(struct parser_state *state) { state->import_source = UDDF; state->xml_parsing_units = SI_units; - state->xml_parsing_units.pressure = PASCAL; + state->xml_parsing_units.pressure = PASCALS; state->xml_parsing_units.temperature = KELVIN; } diff --git a/core/units.c b/core/units.c index f0dba064b..29d8e6673 100644 --- a/core/units.c +++ b/core/units.c @@ -9,7 +9,7 @@ int get_pressure_units(int mb, const char **units) const struct units *units_p = get_units(); switch (units_p->pressure) { - case PASCAL: + case PASCALS: pressure = mb * 100; unit = translate("gettextFromC", "pascal"); break; diff --git a/core/units.h b/core/units.h index 565b15d58..da7bda0b2 100644 --- a/core/units.h +++ b/core/units.h @@ -271,9 +271,6 @@ static inline int32_t pressure_to_altitude(int32_t pressure) // pressure in mbar * keeps track of those units. */ /* turns out in Win32 PASCAL is defined as a calling convention */ -#ifdef WIN32 -#undef PASCAL -#endif struct units { enum LENGTH { METERS, @@ -286,7 +283,7 @@ struct units { enum PRESSURE { BAR, PSI, - PASCAL + PASCALS } pressure; enum TEMPERATURE { CELSIUS, -- cgit v1.2.3-70-g09d2