From 95a3d1d20d71608a2e93fcaf91ad2218a8be06d2 Mon Sep 17 00:00:00 2001 From: AJR Date: Wed, 14 Dec 2022 19:32:31 -0500 Subject: imgtool/stream: Remove some unused functions --- src/tools/imgtool/stream.cpp | 75 -------------------------------------------- src/tools/imgtool/stream.h | 5 --- 2 files changed, 80 deletions(-) diff --git a/src/tools/imgtool/stream.cpp b/src/tools/imgtool/stream.cpp index bd9ea3bd286..05f105afbc2 100644 --- a/src/tools/imgtool/stream.cpp +++ b/src/tools/imgtool/stream.cpp @@ -22,7 +22,6 @@ #include #include -#include // for crc32 namespace imgtool { @@ -484,28 +483,6 @@ uint64_t stream::size() const } -//------------------------------------------------- -// getptr -//------------------------------------------------- - -void *stream::getptr() -{ - void *ptr; - - switch(imgtype) - { - case IMG_MEM: - ptr = buffer; - break; - - default: - ptr = nullptr; - break; - } - return ptr; -} - - //------------------------------------------------- // seek //------------------------------------------------- @@ -574,58 +551,6 @@ uint64_t stream::transfer_all(stream &dest, stream &source) } -//------------------------------------------------- -// crc -//------------------------------------------------- - -int stream::crc(unsigned long *result) -{ - size_t sz; - void *ptr; - - switch(imgtype) - { - case IMG_MEM: - *result = crc32(0, (unsigned char *) buffer, (size_t) filesize); - break; - - default: - sz = size(); - ptr = malloc(sz); - if (!ptr) - return IMGTOOLERR_OUTOFMEMORY; - seek(0, SEEK_SET); - if (read(ptr, sz) != sz) - { - free(ptr); - return IMGTOOLERR_READERROR; - } - *result = crc32(0, (const Bytef*)ptr, sz); - free(ptr); - break; - } - return 0; -} - - -//------------------------------------------------- -// file_crc -//------------------------------------------------- - -int stream::file_crc(const char *fname, unsigned long *result) -{ - int err; - stream::ptr f; - - f = stream::open(fname, OSD_FOPEN_READ); - if (!f) - return IMGTOOLERR_FILENOTFOUND; - - err = f->crc(result); - return err; -} - - //------------------------------------------------- // fill //------------------------------------------------- diff --git a/src/tools/imgtool/stream.h b/src/tools/imgtool/stream.h index 36872e33c2a..8083dbac9d9 100644 --- a/src/tools/imgtool/stream.h +++ b/src/tools/imgtool/stream.h @@ -40,7 +40,6 @@ public: uint64_t size() const; int seek(int64_t pos, int where); uint64_t tell(); - void *getptr(); uint32_t putc(char c); uint32_t puts(const char *s); uint32_t printf(const char *fmt, ...) ATTR_PRINTF(2, 3); @@ -52,10 +51,6 @@ public: // fills sz bytes with b uint64_t fill(unsigned char b, uint64_t sz); - // returns the CRC of a file - int crc(unsigned long *result); - static int file_crc(const char *fname, unsigned long *result); - // returns whether a stream is read only or not bool is_read_only(); -- cgit v1.2.3