From cc00badd70b31f97e10d82256053146475dce8a8 Mon Sep 17 00:00:00 2001 From: Michael Pyne Date: Wed, 6 Jun 2007 03:56:38 +0000 Subject: [PATCH] Fix another MSVC 2007 STL bug (our bug, not theirs) by not resizing a buffer in writeBlock. It was possible to resize it to 0 and although it would not be written to again, the address would be taken of the buffer and MSVC 2007's STL implementation is strict and will not allow the address of an empty buffer to be taken. git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@672039 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- taglib/toolkit/tfile.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/taglib/toolkit/tfile.cpp b/taglib/toolkit/tfile.cpp index ae6ec82e..58533fe0 100644 --- a/taglib/toolkit/tfile.cpp +++ b/taglib/toolkit/tfile.cpp @@ -260,7 +260,7 @@ long File::rfind(const ByteVector &pattern, long fromOffset, const ByteVector &b } else { seek(fromOffset + -1 * int(d->bufferSize), Beginning); - bufferOffset = tell(); + bufferOffset = tell(); } // See the notes in find() for an explanation of this algorithm. @@ -402,12 +402,11 @@ void File::removeBlock(ulong start, ulong length) ByteVector buffer(static_cast(bufferLength)); - ulong bytesRead = true; + ulong bytesRead = 1; while(bytesRead != 0) { seek(readPosition); bytesRead = fread(buffer.data(), sizeof(char), bufferLength, d->file); - buffer.resize(bytesRead); readPosition += bytesRead; // Check to see if we just read the last block. We need to call clear()