From 50f9efd70952adc35769a49cc55df4e42e49e6df Mon Sep 17 00:00:00 2001 From: Jan Altensen Date: Tue, 22 Jun 2021 00:03:21 +0200 Subject: [PATCH] resolve compile errors Change-Id: If4db9a27ea4da98ca95f07d90ce54ec415d63dcb --- amlImage.cpp | 11 ++--------- sha1.c | 2 +- sparse_format.cpp | 4 ++-- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/amlImage.cpp b/amlImage.cpp index 7a1b13b..eb8acf3 100644 --- a/amlImage.cpp +++ b/amlImage.cpp @@ -316,7 +316,7 @@ static int image_get_item_count(HIMAGE hImage,const char* mainType) static int image_get_next_item(HIMAGE hImage,unsigned int iItem, char* maintype, char* subtype) { FILE* fp = (FILE*)hImage; - unsigned int nItem = 0; + if(ImageDecoder->AmlFirmwareImg->crc==0){ memset(ImageDecoder->AmlFirmwareImg,0,sizeof(AmlFirmwareImg_t)); fseeko(fp,0,SEEK_SET); @@ -358,7 +358,7 @@ static int image_get_next_item(HIMAGE hImage,unsigned int iItem, char* maintype, #define MTYPE_TAG "main_type=" #define STYPE_TAG "sub_type=" -static int image_cfg_parse(char *data,int length) +static int image_cfg_parse(char *data,int length __attribute__((__unused__))) { int ret = 0; @@ -510,9 +510,6 @@ static int image_check_files(const char* src_dir) static const ItemInfo* previous_duplicated_item_id(const FileList* headFileList, const FileList* const curFileList, const ItemInfo* headItemInfo, const ItemInfo* curItemInfo) { - int itemId = -1; - int i = 0; - for(;headFileList != curFileList && headFileList->next; headFileList = headFileList->next) { int rc = strcmp(curFileList->name, headFileList->name); @@ -794,7 +791,6 @@ int image_unpack(const char* imagefile,const char *outpath) char sub_type[32] = {0}; char outfile[512] = {0}; char cfgfile[128] = {0}; - char buff[256] = {0}; #ifdef BUILD_DLL if(ImageDecoder->AmlFirmwareImg == NULL){ @@ -988,10 +984,7 @@ static const char * const usage = "%s usage:\n\ int main(int argc, char * const* argv) { int ret = 0; - int c = 0; - const char* optstring = "d:r:c:"; - if(argc < 3||argc > 5) { printf("invalid arguments argc==%d\n", argc); fprintf(stderr,usage,argv[0],argv[0],argv[0],argv[0]); diff --git a/sha1.c b/sha1.c index c148be2..b6dee1a 100644 --- a/sha1.c +++ b/sha1.c @@ -312,7 +312,7 @@ void sha1_csum (unsigned char *input, int ilen, unsigned char output[20]) * bytes of input processed. */ void sha1_csum_wd (unsigned char *input, int ilen, unsigned char output[20], - unsigned int chunk_sz) + unsigned int chunk_sz __attribute__((__unused__))) { sha1_context ctx; #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG) diff --git a/sparse_format.cpp b/sparse_format.cpp index b2fa098..c3e32e7 100644 --- a/sparse_format.cpp +++ b/sparse_format.cpp @@ -15,7 +15,7 @@ int optimus_simg_probe(const char* source, const __u32 length) sparse_header_t *header = (sparse_header_t*) source; if(length < sizeof(sparse_header_t)) { - fprintf(stderr,"length %d < sparse_header_t len %d\n", length, FILE_HEAD_SIZE); + fprintf(stderr,"length %d < sparse_header_t len %lu\n", length, FILE_HEAD_SIZE); return 0; } if (header->magic != SPARSE_HEADER_MAGIC) { @@ -27,7 +27,7 @@ int optimus_simg_probe(const char* source, const __u32 length) && FILE_HEAD_SIZE == header->file_hdr_sz && CHUNK_HEAD_SIZE == header->chunk_hdr_sz)) { - fprintf(stderr,"want 0x [%x, %x, %x], but [%x, %x, %x]\n", + fprintf(stderr,"want 0x [%x, %lx, %lx], but [%x, %x, %x]\n", SPARSE_HEADER_MAJOR_VER, FILE_HEAD_SIZE, CHUNK_HEAD_SIZE, header->major_version, header->file_hdr_sz, header->chunk_hdr_sz); return 0; -- 2.20.1