mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Split up preference data structure definition into 'pref.h'
.. and rename the badly named 'output_units/input_units' variables. We used to have this confusing thing where we had two different units (input vs output) that *look* like they are mirror images, but in fact "output_units" was the user units, and "input_units" are the XML parsing units. So this renames them to be clearer. "output_units" is now just "units" (it's the units a user would ever see), and "input_units" is now "xml_parsing_units" and set by the XML file parsers to reflect the units of the parsed file. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
4c13f1f6b4
commit
868a2cc090
15 changed files with 143 additions and 115 deletions
20
parse-xml.c
20
parse-xml.c
|
|
@ -128,7 +128,7 @@ static int match(const char *pattern, int plen,
|
|||
}
|
||||
|
||||
|
||||
struct units input_units;
|
||||
struct units xml_parsing_units;
|
||||
const struct units SI_units = SI_UNITS;
|
||||
const struct units IMPERIAL_units = IMPERIAL_UNITS;
|
||||
|
||||
|
|
@ -267,7 +267,7 @@ static void pressure(char *buffer, void *_press)
|
|||
/* Just ignore zero values */
|
||||
if (!val.fp)
|
||||
break;
|
||||
switch (input_units.pressure) {
|
||||
switch (xml_parsing_units.pressure) {
|
||||
case PASCAL:
|
||||
mbar = val.fp / 100;
|
||||
break;
|
||||
|
|
@ -311,7 +311,7 @@ static void depth(char *buffer, void *_depth)
|
|||
|
||||
switch (integer_or_float(buffer, &val)) {
|
||||
case FLOAT:
|
||||
switch (input_units.length) {
|
||||
switch (xml_parsing_units.length) {
|
||||
case METERS:
|
||||
depth->mm = val.fp * 1000 + 0.5;
|
||||
break;
|
||||
|
|
@ -332,7 +332,7 @@ static void weight(char *buffer, void *_weight)
|
|||
|
||||
switch (integer_or_float(buffer, &val)) {
|
||||
case FLOAT:
|
||||
switch (input_units.weight) {
|
||||
switch (xml_parsing_units.weight) {
|
||||
case KG:
|
||||
weight->grams = val.fp * 1000 + 0.5;
|
||||
break;
|
||||
|
|
@ -357,7 +357,7 @@ static void temperature(char *buffer, void *_temperature)
|
|||
if (!val.fp)
|
||||
break;
|
||||
/* Celsius */
|
||||
switch (input_units.temperature) {
|
||||
switch (xml_parsing_units.temperature) {
|
||||
case KELVIN:
|
||||
temperature->mkelvin = val.fp * 1000;
|
||||
break;
|
||||
|
|
@ -1364,15 +1364,15 @@ static void DivingLog_importer(void)
|
|||
*
|
||||
* Crazy f*%^ morons.
|
||||
*/
|
||||
input_units = SI_units;
|
||||
xml_parsing_units = SI_units;
|
||||
}
|
||||
|
||||
static void uddf_importer(void)
|
||||
{
|
||||
import_source = UDDF;
|
||||
input_units = SI_units;
|
||||
input_units.pressure = PASCAL;
|
||||
input_units.temperature = KELVIN;
|
||||
xml_parsing_units = SI_units;
|
||||
xml_parsing_units.pressure = PASCAL;
|
||||
xml_parsing_units.temperature = KELVIN;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1437,7 +1437,7 @@ static void reset_all(void)
|
|||
* data within one file, we might have to reset it per
|
||||
* dive for that format.
|
||||
*/
|
||||
input_units = SI_units;
|
||||
xml_parsing_units = SI_units;
|
||||
import_source = UNKNOWN;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue