From e844e3c5c0803c699afb15f4bf0d009859a23115 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 10 Dec 2003 05:48:31 +0000 Subject: [PATCH] fix copied filepos --- stepmania/src/RageFile.cpp | 7 +++++-- stepmania/src/RageFileDriverDirect.cpp | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/stepmania/src/RageFile.cpp b/stepmania/src/RageFile.cpp index 362afdbc8e..73f5736b5c 100644 --- a/stepmania/src/RageFile.cpp +++ b/stepmania/src/RageFile.cpp @@ -66,14 +66,17 @@ RageFile::RageFile( const CString& path, RageFile::OpenMode mode ) RageFile::RageFile( const RageFile &cpy ) { + ResetBuf(); + + /* This will copy the file driver, including its internal file pointer. */ m_File = cpy.m_File->Copy( *this ); m_Path = cpy.m_Path; m_Mode = cpy.m_Mode; m_Error = cpy.m_Error; m_EOF = cpy.m_EOF; m_FilePos = cpy.m_FilePos; - - ResetBuf(); + memcpy( this->m_Buffer, cpy.m_Buffer, cpy.m_BufUsed ); + m_BufUsed = cpy.m_BufUsed; } CString RageFile::GetPath() const diff --git a/stepmania/src/RageFileDriverDirect.cpp b/stepmania/src/RageFileDriverDirect.cpp index ea80ff7b74..b27cd605a0 100644 --- a/stepmania/src/RageFileDriverDirect.cpp +++ b/stepmania/src/RageFileDriverDirect.cpp @@ -246,6 +246,8 @@ RageFileObj *RageFileObjDirect::Copy( RageFile &p ) const if( ret == NULL ) RageException::Throw("Couldn't reopen \"%s\": %s", path.c_str(), strerror(err) ); + ret->Seek( parent.Tell() ); + return ret; }