MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / size

Method size

extlibs/fmt/src/os.cc:207–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205}
206
207long long file::size() const {
208# ifdef _WIN32
209 // Use GetFileSize instead of GetFileSizeEx for the case when _WIN32_WINNT
210 // is less than 0x0500 as is the case with some default MinGW builds.
211 // Both functions support large file sizes.
212 DWORD size_upper = 0;
213 HANDLE handle = reinterpret_cast<HANDLE>(_get_osfhandle(fd_));
214 DWORD size_lower = FMT_SYSTEM(GetFileSize(handle, &size_upper));
215 if (size_lower == INVALID_FILE_SIZE) {
216 DWORD error = GetLastError();
217 if (error != NO_ERROR)
218 FMT_THROW(windows_error(GetLastError(), "cannot get file size"));
219 }
220 unsigned long long long_size = size_upper;
221 return (long_size << sizeof(DWORD) * CHAR_BIT) | size_lower;
222# else
223 using Stat = struct stat;
224 Stat file_stat = Stat();
225 if (FMT_POSIX_CALL(fstat(fd_, &file_stat)) == -1)
226 FMT_THROW(system_error(errno, "cannot get file attributes"));
227 static_assert(sizeof(long long) >= sizeof(file_stat.st_size),
228 "return type of file::size is not large enough");
229 return file_stat.st_size;
230# endif
231}
232
233std::size_t file::read(void* buffer, std::size_t count) {
234 RWResult result = 0;

Callers 15

joinFunction · 0.45
isSurroundedByFunction · 0.45
getRandomKeyFunction · 0.45
startsWithFunction · 0.45
endsWithFunction · 0.45
distanceFunction · 0.45
sortByDistanceFunction · 0.45
BindingTree.cppFile · 0.45
getPathMethod · 0.45
StringPathsMethod · 0.45
LoaderMultipleResultMethod · 0.45
drawPolygonFunction · 0.45

Calls 2

windows_errorClass · 0.85
system_errorFunction · 0.85

Tested by

no test coverage detected