mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Fix depth parsing
The "decimal: it's meters, integer: it's feet" logic doesn't work. It's just always meters, because the xml ends up sometimes having whole meters. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
		
							parent
							
								
									5625b31873
								
							
						
					
					
						commit
						446e51ccf0
					
				
					 1 changed files with 3 additions and 4 deletions
				
			
		
							
								
								
									
										7
									
								
								parse.c
									
										
									
									
									
								
							
							
						
						
									
										7
									
								
								parse.c
									
										
									
									
									
								
							|  | @ -222,11 +222,10 @@ static void depth(char *buffer, void *_depth) | |||
| 	union int_or_float val; | ||||
| 
 | ||||
| 	switch (integer_or_float(buffer, &val)) { | ||||
| 	/* Integer values are probably in feet */ | ||||
| 	/* All values are probably in meters */ | ||||
| 	case INTEGER: | ||||
| 		depth->mm = 304.8 * val.i; | ||||
| 		break; | ||||
| 	/* Float? Probably meters.. */ | ||||
| 		val.fp = val.i; | ||||
| 		/* fallthrough */ | ||||
| 	case FLOAT: | ||||
| 		depth->mm = val.fp * 1000; | ||||
| 		break; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue