[PATCH] Fix saving of po2 values

Linus Torvalds torvalds at linux-foundation.org
Fri Mar 1 07:47:00 PST 2013


From: Linus Torvalds <torvalds at linux-foundation.org>
Date: Fri, 1 Mar 2013 07:16:59 -0800
Subject: [PATCH] Fix saving of po2 values

It was very broken, although it just happened to work for the values
dirk had in his own XML file (0 and 0.800 bar).  Because of confusion
with number of digits it would save 1.080 bar as 1.80 bar.

Use our "show_milli()" helper for showing things that are in milli-units
(which is what we tend to use for most of our values: mK, mbar, mm, ml)

Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---
 save-xml.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/save-xml.c b/save-xml.c
index 0685c9fd1af5..a23fb10a30a3 100644
--- a/save-xml.c
+++ b/save-xml.c
@@ -366,7 +366,7 @@ static void save_sample(FILE *f, struct sample *sample, struct sample *old)
 	}
 
 	if (sample->po2 != old->po2) {
-		fprintf(f, " po2='%u.%2u bar'", FRACTION(sample->po2, 1000));
+		show_milli(f, " po2='", sample->po2, " bar", "'");
 		old->po2 = sample->po2;
 	}
 	fprintf(f, " />\n");
-- 
1.8.2.rc0.16.g20a599e



More information about the subsurface mailing list