Subsurface ignores a temp of 0˚C

Henrik Brautaset Aronsen subsurface at henrik.synth.no
Wed Jan 23 11:48:06 PST 2013


Linus Torvalds wrote:
> Ahh. Ok, it's just the XML parsing.  Will fix.

Cool.  Also, this piece of code in parse-xml.c seems to say that 0 
degrees == no temperature:

static void temperature(char *buffer, void *_temperature)
{
     temperature_t *temperature = _temperature;
     union int_or_float val;

     switch (integer_or_float(buffer, &val)) {
     case FLOAT:
         /* Ignore zero. It means "none" */
         if (!val.fp)
             break;
         /* Celsius */
         switch (xml_parsing_units.temperature) {
         case KELVIN:
             temperature->mkelvin = val.fp * 1000;
             break;
         case CELSIUS:
             temperature->mkelvin = (val.fp + 273.15) * 1000 + 0.5;
             break;
         case FAHRENHEIT:
             temperature->mkelvin = (val.fp + 459.67) * 5000/9;
             break;
         }
         break;
     default:
         printf("Strange temperature reading %s\n", buffer);
     }
}


Henrik



More information about the subsurface mailing list