imgtool/stream: Remove some unused functions

This commit is contained in:
AJR 2022-12-14 19:32:31 -05:00
parent 55b6acf504
commit 95a3d1d20d
2 changed files with 0 additions and 80 deletions

View File

@ -22,7 +22,6 @@
#include <cstdio>
#include <cstring>
#include <zlib.h> // 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
//-------------------------------------------------

View File

@ -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();