+ }
+
+ /* Sane mix? */
+ if (o2 <= 1000 && he <= 1000 && o2+he <= 1000)
+ return;
+ fprintf(stderr, "Odd gasmix: %d O2 %d He\n", o2, he);
+ memset(mix, 0, sizeof(*mix));
+}
+
+/*
+ * There are two ways to give cylinder size information:
+ * - total amount of gas in cuft (depends on working pressure and physical size)
+ * - physical size
+ *
+ * where "physical size" is the one that actually matters and is sane.
+ *
+ * We internally use physical size only. But we save the workingpressure
+ * so that we can do the conversion if required.
+ */
+static void sanitize_cylinder_type(cylinder_type_t *type)
+{
+ /* If we have no working pressure, it had *better* be just a physical size! */
+ if (!type->workingpressure.mbar)
+ return;
+
+ /*
+ * 35l tanks? Do they exist?
+ * Assume this is a "size in cuft" thing.
+ */
+ if (type->size.mliter > 35000) {
+ double volume_of_air = type->size.mliter * 28.317; /* cu ft to milliliter */
+ double atm = type->workingpressure.mbar / 1013.25; /* working pressure in atm */
+ double volume = volume_of_air / atm; /* milliliters at 1 atm: "true size" */
+ type->size.mliter = volume;
+ }
+}
+
+static void sanitize_cylinder_info(struct dive *dive)
+{
+ int i;