Page MenuHomeFreeBSD

mixer(8): fix shorthand syntax bug
ClosedPublic

Authored by christos on Mar 20 2022, 6:10 PM.
Referenced Files
F102861385: D34617.id104044.diff
Mon, Nov 18, 3:10 AM
F102858228: D34617.id104040.diff
Mon, Nov 18, 2:10 AM
F102858110: D34617.id104045.diff
Mon, Nov 18, 2:08 AM
F102845345: D34617.id104044.diff
Sun, Nov 17, 10:21 PM
Unknown Object (File)
Sun, Nov 17, 3:45 PM
Unknown Object (File)
Sun, Nov 17, 2:59 PM
Unknown Object (File)
Sun, Nov 17, 1:43 PM
Unknown Object (File)
Thu, Oct 31, 11:25 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 Not Applicable
Unit
Tests Not Applicable

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.