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

Method checkSizeForOverride

Core/MMKV_IO.cpp:1042–1055  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1040}
1041
1042bool MMKV::checkSizeForOverride(size_t size) {
1043 if (!isFileValid()) {
1044 MMKVWarning("[%s] file not valid", m_mmapID.c_str());
1045 return false;
1046 }
1047
1048 // only override if the file can hole it without ftruncate()
1049 auto fileSize = m_file->getFileSize();
1050 auto spaceNeededForOverride = size + Fixed32Size + ItemSizeHolderSize;
1051 if (size > fileSize || spaceNeededForOverride > fileSize) {
1052 return false;
1053 }
1054 return true;
1055}
1056
1057KVHolderRet_t MMKV::appendDataWithKey(const MMBuffer &data, MMKVKey_t key, bool isDataHolder) {
1058#ifdef MMKV_APPLE

Callers

nothing calls this directly

Calls 2

getFileSizeMethod · 0.80
isFileValidFunction · 0.50

Tested by

no test coverage detected