Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 22a1b428 authored by yingying's avatar yingying Committed by Ricardo Cerqueira
Browse files

idmap: Use local long variable to get the crc value from zip.

As the size of the long is 8 on the 64bit system and it is different from
the uint32_t as it's size is 4. So we need use a local variable of long to
get the crc value from the zip file.

Change-Id: I033251dac0b9478b638e5d68733d74f2fc2f4d8a
parent d609a61d
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -14,6 +14,11 @@ using namespace android;
namespace {
    int get_zip_entry_crc(const char *zip_path, const char *entry_name, uint32_t *crc)
    {
        if (crc == NULL) {
            // As this function used to get the crc, but the address is NULL, do nothing.
            return -1;
        }

        UniquePtr<ZipFileRO> zip(ZipFileRO::open(zip_path));
        if (zip.get() == NULL) {
            return -1;
@@ -22,9 +27,12 @@ namespace {
        if (entry == NULL) {
            return -1;
        }
        if (!zip->getEntryInfo(entry, NULL, NULL, NULL, NULL, NULL, (long*)crc)) {
        long tmp;
        if (!zip->getEntryInfo(entry, NULL, NULL, NULL, NULL, NULL, &tmp)) {
            return -1;
        }
        // As the crc of the apk only contains 32bits, so the convert action is safe.
        *crc = (uint32_t) tmp;
        zip->releaseEntry(entry);
        return 0;
    }