From 43865045695e670f6e04d8b2a9b964411475c16d Mon Sep 17 00:00:00 2001 From: "v.audacity" Date: Mon, 6 Feb 2012 22:02:50 +0000 Subject: [PATCH] Martyn, good catch on commit r11461. I had gone back and forth between what you did and this commit, and messed up the edit. I like this one better because it doesn't duplicate the constant, and keeps all the wxLogDebug calls consistent -- less cognitive overhead. --- src/blockfile/SimpleBlockFile.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/blockfile/SimpleBlockFile.cpp b/src/blockfile/SimpleBlockFile.cpp index 8c31eb9be..b3b9925a7 100644 --- a/src/blockfile/SimpleBlockFile.cpp +++ b/src/blockfile/SimpleBlockFile.cpp @@ -231,15 +231,16 @@ bool SimpleBlockFile::WriteSimpleBlockFile( for( int i = 0; i < sampleLen; i++ ) { + nBytesToWrite = 3; nBytesWritten = #if wxBYTE_ORDER == wxBIG_ENDIAN - file.Write((char*)&int24sampleData[i] + 1, 3); + file.Write((char*)&int24sampleData[i] + 1, nBytesToWrite); #else - file.Write((char*)&int24sampleData[i], 3); + file.Write((char*)&int24sampleData[i], nBytesToWrite); #endif - if (nBytesWritten != 3) + if (nBytesWritten != nBytesToWrite) { - wxLogDebug(wxT("Wrote %d bytes, expected 3."), nBytesWritten); + wxLogDebug(wxT("Wrote %d bytes, expected %d."), nBytesWritten, nBytesToWrite); return false; } }