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

Commit cb47bdac authored by Pawan Wagh's avatar Pawan Wagh
Browse files

Add Extra field info in ZipFileRO

Adding extra field size info in ZipFileRO.
Adding a new method for backward compatability.

Test: m libandroidfw
Bug: 301631861
Change-Id: I55992c50f7db212fdf78a8708ac5dee6af66d83c
parent 8948d071
Loading
Loading
Loading
Loading
+18 −7
Original line number Diff line number Diff line
@@ -121,28 +121,39 @@ ZipEntryRO ZipFileRO::findEntryByName(const char* entryName) const
bool ZipFileRO::getEntryInfo(ZipEntryRO entry, uint16_t* pMethod,
 uint32_t* pUncompLen, uint32_t* pCompLen, off64_t* pOffset,
 uint32_t* pModWhen, uint32_t* pCrc32) const
{
     return getEntryInfo(entry, pMethod, pUncompLen, pCompLen, pOffset, pModWhen,
      pCrc32, nullptr);
}

bool ZipFileRO::getEntryInfo(ZipEntryRO entry, uint16_t* pMethod,
    uint32_t* pUncompLen, uint32_t* pCompLen, off64_t* pOffset,
    uint32_t* pModWhen, uint32_t* pCrc32, uint16_t* pExtraFieldSize) const
{
    const _ZipEntryRO* zipEntry = reinterpret_cast<_ZipEntryRO*>(entry);
    const ZipEntry& ze = zipEntry->entry;

    if (pMethod != NULL) {
    if (pMethod != nullptr) {
        *pMethod = ze.method;
    }
    if (pUncompLen != NULL) {
    if (pUncompLen != nullptr) {
        *pUncompLen = ze.uncompressed_length;
    }
    if (pCompLen != NULL) {
    if (pCompLen != nullptr) {
        *pCompLen = ze.compressed_length;
    }
    if (pOffset != NULL) {
    if (pOffset != nullptr) {
        *pOffset = ze.offset;
    }
    if (pModWhen != NULL) {
    if (pModWhen != nullptr) {
        *pModWhen = ze.mod_time;
    }
    if (pCrc32 != NULL) {
    if (pCrc32 != nullptr) {
        *pCrc32 = ze.crc32;
    }
    if (pExtraFieldSize != nullptr) {
        *pExtraFieldSize = ze.extra_field_size;
    }

    return true;
}
+4 −0
Original line number Diff line number Diff line
@@ -151,6 +151,10 @@ public:
        uint32_t* pCompLen, off64_t* pOffset, uint32_t* pModWhen,
        uint32_t* pCrc32) const;

    bool getEntryInfo(ZipEntryRO entry, uint16_t* pMethod,
        uint32_t* pUncompLen, uint32_t* pCompLen, off64_t* pOffset,
        uint32_t* pModWhen, uint32_t* pCrc32, uint16_t* pExtraFieldSize) const;

    /*
     * Create a new FileMap object that maps a subset of the archive. For
     * an uncompressed entry this effectively provides a pointer to the