From d232842b0c6f96d9b28ec86efa853ddb910c678a Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Tue, 2 Aug 2016 17:43:41 -0400 Subject: [PATCH] 2016-08-02 Fred Gleason * Added a work-around in 'lib/rdwavefile.cpp' to ensure that RDXL chunks are always of even length. --- ChangeLog | 3 +++ lib/rdwavefile.cpp | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index fae91b84..c95cf20b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15449,3 +15449,6 @@ 2016-08-02 Fred Gleason * Fixed a bug in 'lib/rdwavefile.cpp' that caused WAV files to be written with incorrect LEVL chunk data. +2016-08-02 Fred Gleason + * Added a work-around in 'lib/rdwavefile.cpp' to ensure that RDXL + chunks are always of even length. diff --git a/lib/rdwavefile.cpp b/lib/rdwavefile.cpp index d658e118..25febd39 100644 --- a/lib/rdwavefile.cpp +++ b/lib/rdwavefile.cpp @@ -661,7 +661,6 @@ void RDWaveFile::closeWave(int samples) size_buf[3]=(lsize>>24)&0xff; write(wave_file.handle(),size_buf,4); write(wave_file.handle(),levl_chunk_data,LEVL_CHUNK_SIZE-8); - //write(wave_file.handle(),levl_chunk_data,LEVL_CHUNK_SIZE-4); // Fixup the endianness unsigned char * sbuf = new unsigned char [2 * energy_data.size()]; for (unsigned int i=0; i < energy_data.size(); i++){ @@ -2152,6 +2151,14 @@ QString RDWaveFile::getRdxlContents() const void RDWaveFile::setRdxlContents(const QString &xml) { rdxl_contents=xml; + + // + // Make sure that the RDXL chunk is of even length. + // (To avoid goosing a bug in CoolEdit Pro 2003). + // + if((rdxl_contents.length()%2)!=2) { + rdxl_contents+=" "; + } }