Browse Source

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.
v1.13.0-BW
Alex Mikhalev 4 years ago committed by Daniel Agar
parent
commit
f6cda64f0d
  1. 3
      src/lib/tunes/tunes.cpp

3
src/lib/tunes/tunes.cpp

@ -290,7 +290,8 @@ Tunes::Status Tunes::get_next_note(unsigned &frequency, unsigned &duration, unsi @@ -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.

Loading…
Cancel
Save