mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Switch from locations to dive sites in liquivision code
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									32da12664d
								
							
						
					
					
						commit
						4c87ccf952
					
				
					 1 changed files with 10 additions and 7 deletions
				
			
		|  | @ -121,21 +121,24 @@ static void parse_dives (int log_version, const unsigned char *buf, unsigned int | |||
| 
 | ||||
| 		// Dive location, assemble Location and Place
 | ||||
| 		unsigned int len, place_len; | ||||
| 		char *location; | ||||
| 		len = array_uint32_le(buf + ptr); | ||||
| 		ptr += 4; | ||||
| 		place_len = array_uint32_le(buf + ptr + len); | ||||
| 
 | ||||
| 		if (len && place_len) { | ||||
| 			dive->location = malloc(len + place_len + 4); | ||||
| 			memset(dive->location, 0, len + place_len + 4); | ||||
| 			memcpy(dive->location, buf + ptr, len); | ||||
| 			memcpy(dive->location + len, ", ", 2); | ||||
| 			memcpy(dive->location + len + 2, buf + ptr + len + 4, place_len); | ||||
| 			location = malloc(len + place_len + 4); | ||||
| 			memset(location, 0, len + place_len + 4); | ||||
| 			memcpy(location, buf + ptr, len); | ||||
| 			memcpy(location + len, ", ", 2); | ||||
| 			memcpy(location + len + 2, buf + ptr + len + 4, place_len); | ||||
| 		} else if (len) { | ||||
| 			dive->location = strndup(buf + ptr, len); | ||||
| 			location = strndup(buf + ptr, len); | ||||
| 		} else if (place_len) { | ||||
| 			dive->location = strndup(buf + ptr + len + 4, place_len); | ||||
| 			location = strndup(buf + ptr + len + 4, place_len); | ||||
| 		} | ||||
| 		dive->dive_site_uuid = create_dive_site(location); | ||||
| 		free(location); | ||||
| 
 | ||||
| 		ptr += len + 4 + place_len; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue