diff --git a/docs/changes.txt b/docs/changes.txt index 214ed1f1b7..0dc9025a39 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -67,6 +67,11 @@ wxMac - Corrected top border size for wxStaticBox with empty label (nusi) +wxMSW: + +- Fixed wxFileName::GetSize() for large files + + 2.8.2 ----- diff --git a/src/common/filename.cpp b/src/common/filename.cpp index 52a8dcd296..3c5764a6bb 100644 --- a/src/common/filename.cpp +++ b/src/common/filename.cpp @@ -2331,14 +2331,11 @@ wxULongLong wxFileName::GetSize(const wxString &filename) DWORD lpFileSizeHigh; DWORD ret = GetFileSize(f, &lpFileSizeHigh); - if (ret == INVALID_FILE_SIZE) + if ( ret == INVALID_FILE_SIZE && ::GetLastError() != NO_ERROR ) return wxInvalidSize; - // compose the low-order and high-order byte sizes - return wxULongLong(ret | (lpFileSizeHigh << sizeof(WORD)*2)); - -#else // ! __WIN32__ - + return wxULongLong(lpFileSizeHigh, ret); +#else // ! __WIN32__ wxStructStat st; #ifndef wxNEED_WX_UNISTD_H if (wxStat( filename.fn_str() , &st) != 0)