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.
Details
Details
- Reviewers
• hselasky - Commits
- rGf250ff5ff309: mixer(8): Improve shorthand volume parsing.
Diff Detail
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) { ..... } |