From c0d3f540d5b1b109a25acc5023d468d91ff4aaab Mon Sep 17 00:00:00 2001 From: Seymour Shlien Date: Tue, 6 Oct 2020 08:23:57 -0400 Subject: [PATCH] 2020.10.06 --- VERSION | 2 +- doc/CHANGES | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/readme.txt | 2 +- toabc.c | 3 ++- 4 files changed, 59 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 8a3a199..4b9d172 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -2020 August 09 2020 +2020 October 06 2020 diff --git a/doc/CHANGES b/doc/CHANGES index d45ff49..d84af5d 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -13850,3 +13850,58 @@ matchsup.c, yapstree.c, and toabc.c: event_temperament declared as event_temperament(*line) instead of event_temperament(**line). parsekey() was split into two functions, parsekey() and process_microtones(). + + +October 06 2020 + +abc2abc bug: abc2abc hangs when it is applied to a multivoiced file +with the -n option. The following file hangs abc2abc + +X: 1 +T: hangs abc2abc +M: 4/4 +L: 1/4 +K: C +V:1 +C4|E4|D4|E4| +F4|G4|A4|B4| +V:2 +D4|F4|G4|A4|B4|c4| +C4|B,4| + +eg + +abc2abc hanger.abc -n 3 +X:1 +T:hangs abc2abc +M:4/4 +L:1/4 +K:C +V:1 +C4|E4|D4| +E4|F4|G4|A4| + +(Hangs when it encounters the V:2.) + +Analysis: +The program hangs in a infinite loop +331 while (v->bars_complete > v->bars_remaining) { +in the function complete_bars in toabc.c +v->bars_complete is 2, v->bars_remaining is -1 and bars_done is always 0. + +If you insert a comment before V:2, the program runs normally. + +Fix: insert the line + close_newabc(); /* [SS] 2020-10-06 */ +in the function event_voice(). + +Explanation: +v->bars_complete, v->bars_remaining are elements of a voice structure +which has room for up to 30 voices. When V:2 is encountered, the +program automatically calls event_voice and switches to a new voice; +however, the program has not finished with voice 1 and the voice +structure gets corrupted during the switch. Event_voice was modified +so that any remaining data in voice 1 is released before the switch. + + + diff --git a/doc/readme.txt b/doc/readme.txt index 0baaa6f..4041d05 100644 --- a/doc/readme.txt +++ b/doc/readme.txt @@ -2,7 +2,7 @@ abcMIDI : abc <-> MIDI conversion utilities midi2abc version 3.46 June 22 2020 abc2midi version 4.42 October 01 2020 -abc2abc version 2.09 October 01 2020 +abc2abc version 2.10 October 10 2020 yaps version 1.79 October 01 2020 abcmatch version 1.74 October 01 2020 midicopy version 1.36 June 04 2019 diff --git a/toabc.c b/toabc.c index 02118fb..7942c32 100644 --- a/toabc.c +++ b/toabc.c @@ -21,7 +21,7 @@ /* back-end for outputting (possibly modified) abc */ -#define VERSION "2.09 October 01 2020 abc2abc" +#define VERSION "2.10 October 06 2020 abc2abc" /* for Microsoft Visual C++ 6.0 or higher */ #ifdef _MSC_VER @@ -1213,6 +1213,7 @@ struct voice_params *vp; { char output[300]; /* [SS] 2017-10-09 2017-10-11 2018-12-27*/ if (xinbody) { + close_newabc(); /* [SS] 2020-10-06 */ next_voice = setvoice(n); }; if (!must_emit_voice(n)) { /* [PHDM] 2013-03-08 */