Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get file size error #86

Open
LoveChina-3000 opened this issue Apr 15, 2022 · 0 comments
Open

Get file size error #86

LoveChina-3000 opened this issue Apr 15, 2022 · 0 comments

Comments

@LoveChina-3000
Copy link

In line 879 code,On 32-bite ,Get file size error,I modified part of the code 。

inline unsigned __int64 query_file_size(file_handle_type handle, std::error_code& error)
{
error.clear();
#ifdef _WIN32
// LARGE_INTEGER file_size;
// if(::GetFileSizeEx(handle, &file_size) == 0)
// {
// error = detail::last_error();
// return 0;
// }
//return static_cast<int64_t>(file_size.QuadPart);

DWORD dwFileSizeHigh;
__int64 qwFileSize = GetFileSize(handle, &dwFileSizeHigh);
qwFileSize += (((_int64)dwFileSizeHigh) << 32);
return qwFileSize;

#else // POSIX
struct stat sbuf;
if(::fstat(handle, &sbuf) == -1)
{
error = detail::last_error();
return 0;
}
return sbuf.st_size;
#endif
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant