mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	spa: add locale independent spa_dtoa
And use this in spa_json_format_float() where we also avoid invalid json floats. Use json float format in some places where we serialize json floats. Add a unit test. See #2223
This commit is contained in:
		
							parent
							
								
									5f4d031db0
								
							
						
					
					
						commit
						2b16df4e89
					
				
					 6 changed files with 40 additions and 13 deletions
				
			
		| 
						 | 
				
			
			@ -695,7 +695,7 @@ static int parse_prop_params(struct impl *this, struct spa_pod *params)
 | 
			
		|||
	while (true) {
 | 
			
		||||
		const char *name;
 | 
			
		||||
		struct spa_pod *pod;
 | 
			
		||||
		char value[512];
 | 
			
		||||
		char value[512], buf[128];
 | 
			
		||||
 | 
			
		||||
		if (spa_pod_parser_get_string(&prs, &name) < 0)
 | 
			
		||||
			break;
 | 
			
		||||
| 
						 | 
				
			
			@ -706,8 +706,9 @@ static int parse_prop_params(struct impl *this, struct spa_pod *params)
 | 
			
		|||
		if (spa_pod_is_string(pod)) {
 | 
			
		||||
			spa_pod_copy_string(pod, sizeof(value), value);
 | 
			
		||||
		} else if (spa_pod_is_float(pod)) {
 | 
			
		||||
			snprintf(value, sizeof(value), "%f",
 | 
			
		||||
					SPA_POD_VALUE(struct spa_pod_float, pod));
 | 
			
		||||
			snprintf(value, sizeof(value), "%s",
 | 
			
		||||
					spa_json_format_float(buf, sizeof(buf),
 | 
			
		||||
						SPA_POD_VALUE(struct spa_pod_float, pod)));
 | 
			
		||||
		} else if (spa_pod_is_int(pod)) {
 | 
			
		||||
			snprintf(value, sizeof(value), "%d",
 | 
			
		||||
					SPA_POD_VALUE(struct spa_pod_int, pod));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue