mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	pactl: Fix relative volume parsing
The recent change to reject leading '+' in pa_atod() broke the relative volume parsing in pactl. This fixes that.
This commit is contained in:
		
							parent
							
								
									37a7834737
								
							
						
					
					
						commit
						9860bc30ac
					
				
					 1 changed files with 7 additions and 1 deletions
				
			
		| 
						 | 
					@ -1456,6 +1456,7 @@ static void exit_signal_callback(pa_mainloop_api *m, pa_signal_event *e, int sig
 | 
				
			||||||
static int parse_volume(const char *vol_spec, pa_volume_t *vol, enum volume_flags *vol_flags) {
 | 
					static int parse_volume(const char *vol_spec, pa_volume_t *vol, enum volume_flags *vol_flags) {
 | 
				
			||||||
    double v;
 | 
					    double v;
 | 
				
			||||||
    char *vs;
 | 
					    char *vs;
 | 
				
			||||||
 | 
					    const char *atod_input;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_assert(vol_spec);
 | 
					    pa_assert(vol_spec);
 | 
				
			||||||
    pa_assert(vol);
 | 
					    pa_assert(vol);
 | 
				
			||||||
| 
						 | 
					@ -1475,7 +1476,12 @@ static int parse_volume(const char *vol_spec, pa_volume_t *vol, enum volume_flag
 | 
				
			||||||
        vs[strlen(vs)-2] = 0;
 | 
					        vs[strlen(vs)-2] = 0;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (pa_atod(vs, &v) < 0) {
 | 
					    atod_input = vs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (atod_input[0] == '+')
 | 
				
			||||||
 | 
					        atod_input++; /* pa_atod() doesn't accept leading '+', so skip it. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (pa_atod(atod_input, &v) < 0) {
 | 
				
			||||||
        pa_log(_("Invalid volume specification"));
 | 
					        pa_log(_("Invalid volume specification"));
 | 
				
			||||||
        pa_xfree(vs);
 | 
					        pa_xfree(vs);
 | 
				
			||||||
        return -1;
 | 
					        return -1;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue