mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pw-cli: handle properties without type info
Some properties don't have type info and then we want to skip constructing the pod instead of crashing. This makes it possible to cut and paste the output of pw-dump Route into pw-cli s <card> Route, for example.
This commit is contained in:
		
							parent
							
								
									d57979517e
								
							
						
					
					
						commit
						ca4b549472
					
				
					 1 changed files with 4 additions and 4 deletions
				
			
		| 
						 | 
					@ -1533,7 +1533,7 @@ static int json_to_pod(struct spa_pod_builder *b, uint32_t id,
 | 
				
			||||||
	int l, res;
 | 
						int l, res;
 | 
				
			||||||
	const char *v;
 | 
						const char *v;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (spa_json_is_object(value, len)) {
 | 
						if (spa_json_is_object(value, len) && info != NULL) {
 | 
				
			||||||
		if ((ti = spa_debug_type_find(NULL, info->parent)) == NULL)
 | 
							if ((ti = spa_debug_type_find(NULL, info->parent)) == NULL)
 | 
				
			||||||
			return -EINVAL;
 | 
								return -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1552,7 +1552,7 @@ static int json_to_pod(struct spa_pod_builder *b, uint32_t id,
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		spa_pod_builder_pop(b, &f[0]);
 | 
							spa_pod_builder_pop(b, &f[0]);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else if (spa_json_is_array(value, len)) {
 | 
						else if (spa_json_is_array(value, len) && info != NULL) {
 | 
				
			||||||
		spa_pod_builder_push_array(b, &f[0]);
 | 
							spa_pod_builder_push_array(b, &f[0]);
 | 
				
			||||||
		spa_json_enter(iter, &it[0]);
 | 
							spa_json_enter(iter, &it[0]);
 | 
				
			||||||
		while ((l = spa_json_next(&it[0], &v)) > 0)
 | 
							while ((l = spa_json_next(&it[0], &v)) > 0)
 | 
				
			||||||
| 
						 | 
					@ -1560,7 +1560,7 @@ static int json_to_pod(struct spa_pod_builder *b, uint32_t id,
 | 
				
			||||||
				return res;
 | 
									return res;
 | 
				
			||||||
		spa_pod_builder_pop(b, &f[0]);
 | 
							spa_pod_builder_pop(b, &f[0]);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else if (spa_json_is_float(value, len)) {
 | 
						else if (spa_json_is_float(value, len) && info != NULL) {
 | 
				
			||||||
		float val = 0.0f;
 | 
							float val = 0.0f;
 | 
				
			||||||
		spa_json_parse_float(value, len, &val);
 | 
							spa_json_parse_float(value, len, &val);
 | 
				
			||||||
		switch (info->parent) {
 | 
							switch (info->parent) {
 | 
				
			||||||
| 
						 | 
					@ -1595,7 +1595,7 @@ static int json_to_pod(struct spa_pod_builder *b, uint32_t id,
 | 
				
			||||||
	else if (spa_json_is_null(value, len)) {
 | 
						else if (spa_json_is_null(value, len)) {
 | 
				
			||||||
		spa_pod_builder_none(b);
 | 
							spa_pod_builder_none(b);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else {
 | 
						else if (info) {
 | 
				
			||||||
		char *val = alloca(len+1);
 | 
							char *val = alloca(len+1);
 | 
				
			||||||
		spa_json_parse_string(value, len, val);
 | 
							spa_json_parse_string(value, len, val);
 | 
				
			||||||
		switch (info->parent) {
 | 
							switch (info->parent) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue