MCPcopy Create free account
hub / github.com/catboost/catboost / GetFileLength

Function GetFileLength

util/system/fstat.cpp:230–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228}
229
230i64 GetFileLength(FHANDLE fd) {
231#if defined(_win_)
232 LARGE_INTEGER pos;
233 if (!::GetFileSizeEx(fd, &pos)) {
234 return -1L;
235 }
236 return pos.QuadPart;
237#elif defined(_unix_)
238 struct stat statbuf;
239 if (::fstat(fd, &statbuf) != 0) {
240 return -1L;
241 }
242 if (!(statbuf.st_mode & (S_IFREG | S_IFBLK | S_IFCHR))) {
243 // st_size only makes sense for regular files or devices
244 errno = EINVAL;
245 return -1L;
246 }
247 return statbuf.st_size;
248#else
249 #error unsupported platform
250#endif
251}
252
253i64 GetFileLength(const char* name) {
254#if defined(_win_)

Callers 3

ApplyFuncTotokenizedTextFunction · 0.85
MergeSubprocessReportMethod · 0.85
GetLengthMethod · 0.85

Calls 3

statClass · 0.70
fstatFunction · 0.50
dataMethod · 0.45

Tested by

no test coverage detected