--- a/libkwave/SampleWriter.cpp
+++ b/libkwave/SampleWriter.cpp
@@ -34,7 +34,7 @@
     :Kwave::SampleSink(),
      m_first(left), m_last(right), m_mode(mode), m_track(track),
      m_position(left),
-     m_buffer(BUFFER_SIZE), m_buffer_used(0)
+     m_buffer(BUFFER_SIZE), m_buffer_size(BUFFER_SIZE), m_buffer_used(0)
 {
     m_track.use();
 }
@@ -55,12 +55,12 @@
 {
     unsigned int count = samples.size();
 
-    if (m_buffer_used + count < m_buffer.size()) {
+    if (m_buffer_used + count < m_buffer_size) {
 	// append to the internal buffer if there is still some room
 	MEMCPY(&(m_buffer[m_buffer_used]), &(samples[0]),
 	       count * sizeof(sample_t));
 	m_buffer_used += count;
-	if (m_buffer_used >= m_buffer.size()) flush();
+	if (m_buffer_used >= m_buffer_size) flush();
     } else {
 	// first flush the single-sample buffer before doing block operation
 	if (m_buffer_used) flush();
@@ -77,7 +77,7 @@
 SampleWriter &SampleWriter::operator << (const sample_t &sample)
 {
     m_buffer[m_buffer_used++] = sample;
-    if (m_buffer_used >= m_buffer.size()) flush();
+    if (m_buffer_used >= m_buffer_size) flush();
     return *this;
 }
 
@@ -87,7 +87,7 @@
     if (m_buffer_used) flush();
 
     // transfer data, using our internal buffer
-    unsigned int buflen = m_buffer.size();
+    unsigned int buflen = m_buffer_size;
     while (!reader.eof() && (m_position <= m_last)) {
 	if (m_position+buflen-1 > m_last) buflen = (m_last-m_position)+1;