MCPcopy Create free account
hub / github.com/Tencent/MMKV / ftruncate

Function ftruncate

Core/MemoryFile_Win32.cpp:421–434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

419}
420
421static bool ftruncate(MMKVFileHandle_t file, size_t size) {
422 LARGE_INTEGER large = {};
423 large.QuadPart = size;
424 if (SetFilePointerEx(file, large, 0, FILE_BEGIN)) {
425 if (SetEndOfFile(file)) {
426 return true;
427 }
428 MMKVError("fail to SetEndOfFile:%d", GetLastError());
429 return false;
430 } else {
431 MMKVError("fail to SetFilePointer:%d", GetLastError());
432 return false;
433 }
434}
435
436static bool getFileSize(MMKVFileHandle_t fd, size_t &size) {
437 LARGE_INTEGER filesize = {0};

Callers 5

truncateMethod · 0.85
copyFileContentFunction · 0.85
copyFileContentFunction · 0.85
truncateMethod · 0.85
copyFileContentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected