Fixed a BUG of VC++ 6.0

评价:
0
(0用户)

MSDN documentation states that for files larger than 4 gigabytes,there is the CFileFind::GetLength64() function that returns the size as 64Bit number.But the function just return a wrong 32Bit number. Damn Microsoft!

Solution: write a derived class(CMyFtpFileFind) from CFtpFileFind,and implementing the GetLength64() member function correctly. Replace this derived class with CFtpFileFind.

Reference: http://www.codeproject.com/KB/bugs/getlength64bug.asp.aspx?print=true
Last version: https://gist.github.com/978421

Source code as following text:

class CMyFtpFileFind : public CFtpFileFind
{
public :
CMyFtpFileFind ( CFtpConnection * pConnection , DWORD dwContext = 1 ) : CFtpFileFind ( pConnection , dwContext )
{
}

virtual ~ CMyFtpFileFind () { }

__int64 GetLength64 () const
{
ASSERT ( m_hContext != NULL );
ASSERT_VALID ( this );
unsigned __int64 uRet = 0 ;

if ( m_pFoundInfo != NULL )
{
unsigned __int64 uFileSizeLow = (( LPWIN32_FIND_DATA ) m_pFoundInfo ) -> nFileSizeLow ;
unsigned __int64 uFileSizeHigh = (( LPWIN32_FIND_DATA ) m_pFoundInfo ) -> nFileSizeHigh ;
uRet = uFileSizeLow + ( uFileSizeHigh << 32 );
}

return uRet ;
}

}; // CMyFtpFileFind

 

本文出自:https://blog.csdn.net/iteye_11067/article/details/82066315

注册并通过认证的用户才可以进行评价!

admin:系统自动奖励,+10,  

发表评论