tunes: Fixed unspecified behaviour

This fixes unspecified behaviour due to evaluation order of args.
It's up to the compiler whether next_number() or next_dots() is executed
first which means that the behaviour is not properly specified.
This commit is contained in:
Alex Mikhalev 2020-11-17 20:07:16 -07:00 committed by Daniel Agar
parent d3b3de7159
commit f6cda64f0d
1 changed files with 2 additions and 1 deletions

View File

@ -290,7 +290,8 @@ Tunes::Status Tunes::get_next_note(unsigned &frequency, unsigned &duration, unsi
case 'P': // Pause for a note length.
frequency = 0;
duration = 0;
silence = rest_duration(next_number(), next_dots());
note_length = next_number();
silence = rest_duration(note_length, next_dots());
return Tunes::Status::Continue;
case 'T': { // Change tempo.