mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	media-session: improve property save/load
Allow spaces in the property values.
This commit is contained in:
		
							parent
							
								
									dadb3a884d
								
							
						
					
					
						commit
						05416b497c
					
				
					 1 changed files with 10 additions and 3 deletions
				
			
		| 
						 | 
					@ -1798,9 +1798,16 @@ int sm_media_session_load_state(struct sm_media_session *sess,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	f = fdopen(fd, "r");
 | 
						f = fdopen(fd, "r");
 | 
				
			||||||
	while (fgets(line, sizeof(line)-1, f)) {
 | 
						while (fgets(line, sizeof(line)-1, f)) {
 | 
				
			||||||
		char k[1024], v[1024];
 | 
							char *val, *k;
 | 
				
			||||||
		if (sscanf(line, "%s %s", k, v) == 2)
 | 
							val = strrchr(line, '\n');
 | 
				
			||||||
			count += pw_properties_set(props, k, v);
 | 
							if (val)
 | 
				
			||||||
 | 
								*val = '\0';
 | 
				
			||||||
 | 
							val = strchr(line, ' ');
 | 
				
			||||||
 | 
							if (val == NULL)
 | 
				
			||||||
 | 
								continue;
 | 
				
			||||||
 | 
							k = val + 1;
 | 
				
			||||||
 | 
							*val = '\0';
 | 
				
			||||||
 | 
							count += pw_properties_set(props, line, k);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	fclose(f);
 | 
						fclose(f);
 | 
				
			||||||
	return count;
 | 
						return count;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue