From 417f9eb31cd4c34c37379def9c2165fb36c29a58 Mon Sep 17 00:00:00 2001 From: jules Date: Tue, 8 Jan 2013 18:23:10 +0000 Subject: [PATCH] AIFF comment format fix. --- modules/juce_audio_formats/codecs/juce_AiffAudioFormat.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/juce_audio_formats/codecs/juce_AiffAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_AiffAudioFormat.cpp index ceeb3cfc19..bf5142d7da 100644 --- a/modules/juce_audio_formats/codecs/juce_AiffAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_AiffAudioFormat.cpp @@ -225,7 +225,10 @@ namespace AiffFileHelpers out.writeShortBigEndian ((short) values.getValue (prefix + "Identifier", "0").getIntValue()); const String comment (values.getValue (prefix + "Text", String::empty)); - out.write (comment.toUTF8(), jmin (comment.getNumBytesAsUTF8(), 65534)); + + const int commentLength = jmin (comment.getNumBytesAsUTF8(), 65534); + out.writeShortBigEndian ((short) commentLength + 1); + out.write (comment.toUTF8(), commentLength); out.writeByte (0); if ((out.getDataSize() & 1) != 0)