Page MenuHomeFreeBSD

mixer(8): fix shorthand syntax bug
ClosedPublic

Authored by christos on Mar 20 2022, 6:10 PM.
Referenced Files
F81586701: D34617.id104037.diff
Thu, Apr 18, 1:22 PM
F81579179: D34617.id104044.diff
Thu, Apr 18, 10:19 AM
Unknown Object (File)
Wed, Apr 17, 2:17 AM
Unknown Object (File)
Fri, Mar 22, 3:48 PM
Unknown Object (File)
Fri, Mar 22, 3:48 PM
Unknown Object (File)
Mar 9 2024, 8:57 AM
Unknown Object (File)
Mar 9 2024, 8:57 AM
Unknown Object (File)
Mar 9 2024, 8:57 AM
Subscribers

Details

Summary

da3d4469ef841be44ac4b346a6b51668d608ed49 had a bug where the whole
volume syntax (floating point values, :, + and -) wasn't accepted. Also moved
the defines into an enum for cleanliness. The mechanism for checking
if we're using the shorthand syntax is a bit of a hack but I can't come up with
something better at the moment.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

usr.sbin/mixer/mixer.c
139–152

Don't you need to set shorthand to zero for every loop?

140

Can you put it like this:

bool shorthand;

		/* Check if we're using the shorthand syntax for volume setting. */
                shorthand = false;
		for (q = p; *q != '\0'; q++) {
			if (*q == '=') {
                             q++;
                             shorthand = ((*q >= '0' && *q <= '9') ||
                               *q == '+' || *q == '-' || *q == '.');
                              break;
                        } else if (*q == '.')
                              break;
		}

....

                else if (shorthand) {
                              .....
                }
christos marked 2 inline comments as done.

Done.

This revision was not accepted when it landed; it landed in state Needs Review.Mar 20 2022, 7:22 PM
This revision was automatically updated to reflect the committed changes.