Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed the way the parser handles multiple parameters in opcodes #101

Merged
merged 3 commits into from
Mar 6, 2020

Conversation

paulfd
Copy link
Member

@paulfd paulfd commented Mar 5, 2020

Idea from @jpcima :)

The resulting code is much cleaner and properly handles wrong positioning of parameters, with basically no cost. Also changed the parameters to be u16 to handle values larger than 256 for the CC number.

@paulfd paulfd requested a review from jpcima March 5, 2020 12:15
if (absl::SimpleAtoi(opcode.substr(nextNumIndex, numDigits), &returnedValue)) {
// ASSERT(returnedValue < std::numeric_limits<uint8_t>::max());
parameterPositions.push_back(parameterPosition);
lettersOnlyHash = hash("&", lettersOnlyHash);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The case that the invalid input contains "&" should be handled for safety.
Otherwise you could match a hash which doesn't have the required parameter count.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So should we ignore these opcodes or just silently strip out the "&" from the opcode name?

@paulfd paulfd merged commit 291920f into sfztools:develop Mar 6, 2020
@paulfd paulfd deleted the parser-rework branch January 21, 2022 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants