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

Method checkFileCRCValid

Core/MMKV.cpp:438–449  ·  view source on GitHub ↗

assuming m_file is valid

Source from the content-addressed store, hash-verified

436
437// assuming m_file is valid
438bool MMKV::checkFileCRCValid(size_t actualSize, uint32_t crcDigest) {
439 auto ptr = (uint8_t *) m_file->getMemory();
440 if (ptr) {
441 m_crcDigest = (uint32_t) CRC32(0, (const uint8_t *) ptr + Fixed32Size, (uint32_t) actualSize);
442
443 if (m_crcDigest == crcDigest) {
444 return true;
445 }
446 MMKVError("check crc [%s] fail, crc32:%u, m_crcDigest:%u", m_mmapID.c_str(), crcDigest, m_crcDigest);
447 }
448 return false;
449}
450
451void MMKV::recalculateCRCDigestWithIV(const void *iv) {
452 auto ptr = (const uint8_t *) m_file->getMemory();

Callers

nothing calls this directly

Calls 1

getMemoryMethod · 0.80

Tested by

no test coverage detected