@@ -214,9 +214,8 @@ MultifileBlobCache::MultifileBlobCache(size_t maxKeySize, size_t maxValueSize, s
214214 }
215215
216216 // Ensure we have a good CRC
217- if (header.crc !=
218- crc32c (mappedEntry + sizeof (MultifileHeader),
219- fileSize - sizeof (MultifileHeader))) {
217+ if (header.crc != GenerateCRC32 (mappedEntry + sizeof (MultifileHeader),
218+ fileSize - sizeof (MultifileHeader))) {
220219 ALOGV (" INIT: Entry %u failed CRC check! Removing." , entryHash);
221220 if (remove (fullPath.c_str ()) != 0 ) {
222221 ALOGE (" Error removing %s: %s" , fullPath.c_str (), std::strerror (errno));
@@ -532,9 +531,9 @@ bool MultifileBlobCache::createStatus(const std::string& baseDir) {
532531 mBuildId .length () > PROP_VALUE_MAX ? PROP_VALUE_MAX : mBuildId .length ());
533532
534533 // Finally update the crc, using cacheVersion and everything the follows
535- status.crc =
536- crc32c ( reinterpret_cast <uint8_t *>(&status) + offsetof (MultifileStatus, cacheVersion),
537- sizeof (status) - offsetof (MultifileStatus, cacheVersion));
534+ status.crc = GenerateCRC32 (
535+ reinterpret_cast <uint8_t *>(&status) + offsetof (MultifileStatus, cacheVersion),
536+ sizeof (status) - offsetof (MultifileStatus, cacheVersion));
538537
539538 // Create the status file
540539 std::string cacheStatus = baseDir + " /" + kMultifileBlobCacheStatusFile ;
@@ -599,9 +598,9 @@ bool MultifileBlobCache::checkStatus(const std::string& baseDir) {
599598 }
600599
601600 // Ensure we have a good CRC
602- if (status.crc !=
603- crc32c ( reinterpret_cast < uint8_t *>(&status) + offsetof (MultifileStatus, cacheVersion),
604- sizeof (status) - offsetof (MultifileStatus, cacheVersion))) {
601+ if (status.crc != GenerateCRC32 ( reinterpret_cast < uint8_t *>(&status) +
602+ offsetof (MultifileStatus, cacheVersion),
603+ sizeof (status) - offsetof (MultifileStatus, cacheVersion))) {
605604 ALOGE (" STATUS(CHECK): Cache status failed CRC check!" );
606605 return false ;
607606 }
@@ -840,8 +839,8 @@ void MultifileBlobCache::processTask(DeferredTask& task) {
840839
841840 // Add CRC check to the header (always do this last!)
842841 MultifileHeader* header = reinterpret_cast <MultifileHeader*>(buffer);
843- header->crc =
844- crc32c (buffer + sizeof (MultifileHeader), bufferSize - sizeof (MultifileHeader));
842+ header->crc = GenerateCRC32 (buffer + sizeof (MultifileHeader),
843+ bufferSize - sizeof (MultifileHeader));
845844
846845 ssize_t result = write (fd, buffer, bufferSize);
847846 if (result != bufferSize) {
0 commit comments