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
This commit is contained in:
Michael Pyne 2007-06-06 03:56:38 +00:00
parent 26751ba95b
commit cc00badd70

View File

@ -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<uint>(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()