mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Work around more Diving Log bugs..
The Diving Log temperature reading is in Fahrenheit for the samples (for the per-dive water/air temperature it's in Celsius). But it seems to have a bug where a lack of a sample has been turned into 32 Fahrenheit (which is 0 celsius). This is despite the dive itself having a water temperature of 8 degF. Just throw away those bogus freezing temperatures. Sure, they can happen, and ice divers are crazy - but in this case I know it's just an error in the log, and it looks very much like a Diving Log bug. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
		
							parent
							
								
									27ed16072f
								
							
						
					
					
						commit
						0282d515db
					
				
					 1 changed files with 13 additions and 0 deletions
				
			
		
							
								
								
									
										13
									
								
								parse-xml.c
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								parse-xml.c
									
										
									
									
									
								
							| 
						 | 
					@ -488,6 +488,16 @@ static int uemis_fill_sample(struct sample *sample, const char *name, int len, c
 | 
				
			||||||
 * Divinglog is crazy. The temperatures are in celsius. EXCEPT
 | 
					 * Divinglog is crazy. The temperatures are in celsius. EXCEPT
 | 
				
			||||||
 * for the sample temperatures, that are in Fahrenheit.
 | 
					 * for the sample temperatures, that are in Fahrenheit.
 | 
				
			||||||
 * WTF?
 | 
					 * WTF?
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Oh, and I think Diving Log *internally* probably kept them
 | 
				
			||||||
 | 
					 * in celsius, because I'm seeing entries like
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 *	<Temp>32.0</Temp>
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * in there. Which is freezing, aka 0 degC. I bet the "0" is
 | 
				
			||||||
 | 
					 * what Diving Log uses for "no temperature".
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * So throw away crap like that.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static void fahrenheit(char *buffer, void *_temperature)
 | 
					static void fahrenheit(char *buffer, void *_temperature)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -496,6 +506,9 @@ static void fahrenheit(char *buffer, void *_temperature)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch (integer_or_float(buffer, &val)) {
 | 
						switch (integer_or_float(buffer, &val)) {
 | 
				
			||||||
	case FLOAT:
 | 
						case FLOAT:
 | 
				
			||||||
 | 
							/* Floating point equality is evil, but works for small integers */
 | 
				
			||||||
 | 
							if (val.fp == 32.0)
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
		temperature->mkelvin = (val.fp + 459.67) * 5000/9;
 | 
							temperature->mkelvin = (val.fp + 459.67) * 5000/9;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue