Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • boot/generic/src/payload.c

    rb169619 rdf7dc9e  
    3636#include <gzip.h>
    3737#include <stdbool.h>
    38 #include <mem.h>
     38#include <memstr.h>
    3939#include <errno.h>
    4040#include <str.h>
     
    6161{
    6262        char *e = (char *) ext(s);
    63         if ((e != NULL) && (str_cmp(e, ".gz") == 0))
     63        if (e != NULL && str_cmp(e, ".gz") == 0)
    6464                *e = '\0';
     65}
     66
     67static bool isgzip(const char *s)
     68{
     69        const char *e = ext(s);
     70        return e != NULL && str_cmp(e, ".gz") == 0;
    6571}
    6672
     
    7682{
    7783        const char *name;
     84        const uint8_t *data;
    7885        size_t packed_size;
     86        size_t unpacked_size;
    7987
    8088        if (!tar_info(*cstart, cend, &name, &packed_size))
    8189                return false;
    8290
    83         const uint8_t *data = *cstart + TAR_BLOCK_SIZE;
     91        data = *cstart + TAR_BLOCK_SIZE;
    8492        *cstart += TAR_BLOCK_SIZE + ALIGN_UP(packed_size, TAR_BLOCK_SIZE);
    8593
    86         bool gz = gzip_check(data, packed_size);
    87         size_t unpacked_size = gz ? gzip_size(data, packed_size) : packed_size;
     94        bool gz = isgzip(name);
     95
     96        unpacked_size = gz ? gzip_size(data, packed_size) : packed_size;
    8897
    8998        /* Components must be page-aligned. */
     
    147156        while (tar_info(start, payload_end, &name, &packed_size)) {
    148157                sz = ALIGN_UP(sz, PAGE_SIZE);
    149                 if (gzip_check(start + TAR_BLOCK_SIZE, packed_size))
     158                if (isgzip(name))
    150159                        sz += gzip_size(start + TAR_BLOCK_SIZE, packed_size);
    151160                else
Note: See TracChangeset for help on using the changeset viewer.