Silence some gcc-8-snapshot compiler warnings.

This commit is contained in:
Markus F.X.J. Oberhumer 2018-01-19 14:13:58 +01:00
parent 9485a56af1
commit 9248f02557
9 changed files with 17 additions and 25 deletions

View File

@ -43,7 +43,7 @@
void lzma_compress_config_t::reset()
{
memset(this, 0, sizeof(*this));
mem_clear(this, sizeof(*this));
pos_bits.reset();
lit_pos_bits.reset();

View File

@ -33,7 +33,7 @@
void zlib_compress_config_t::reset()
{
memset(this, 0, sizeof(*this));
mem_clear(this, sizeof(*this));
mem_level.reset();
window_bits.reset();

View File

@ -46,7 +46,7 @@ int _crt0_startup_flags = _CRT0_FLAG_UNIX_SBRK;
void options_t::reset()
{
options_t *o = this;
memset(o, 0, sizeof(*o));
mem_clear(o, sizeof(*o));
o->crp.reset();
o->cmd = CMD_NONE;

View File

@ -92,15 +92,6 @@ void PackArmPe::processImports2(unsigned myimport, unsigned iat_off) // pass 2
{
PeFile::processImports2(myimport, iat_off);
__packed_struct(import_desc)
LE32 oft; // orig first thunk
char _[8];
LE32 dllname;
LE32 iat; // import address table
__packed_struct_end()
COMPILE_TIME_ASSERT(sizeof(import_desc) == 20);
// adjust import data
for (import_desc *im = (import_desc*) oimpdlls; im->dllname; im++)
{

View File

@ -47,7 +47,7 @@ Packer::Packer(InputFile *f) :
if (fi != NULL)
file_size = fi->st_size();
uip = new UiPacker(this);
memset(&ph, 0, sizeof(ph));
mem_clear(&ph, sizeof(ph));
}
@ -665,7 +665,7 @@ unsigned Packer::getRandomId() const
// this is called directly after the constructor from class PackMaster
void Packer::initPackHeader()
{
memset(&ph, 0, sizeof(ph));
mem_clear(&ph, sizeof(ph));
ph.version = getVersion();
ph.format = getFormat();
ph.method = M_NONE;

View File

@ -560,13 +560,6 @@ void PeFile64::processRelocs() // pass1
// import handling
**************************************************************************/
//__packed_struct(import_desc)
// LE32 oft; // orig first thunk
// char _[8];
// LE32 dllname;
// LE32 iat; // import address table
//__packed_struct_end()
LE32& PeFile::IDSIZE(unsigned x) { return iddirs[x].size; }
LE32& PeFile::IDADDR(unsigned x) { return iddirs[x].vaddr; }
LE32& PeFile::ODSIZE(unsigned x) { return oddirs[x].size; }

View File

@ -179,10 +179,10 @@ protected:
ddirs_t *oddirs;
__packed_struct(import_desc)
LE32 oft; // orig first thunk
char _[8];
LE32 dllname;
LE32 iat; // import address table
LE32 oft; // orig first thunk
char _[8];
LE32 dllname;
LE32 iat; // import address table
__packed_struct_end()
LE32 &IDSIZE(unsigned x);

View File

@ -115,6 +115,12 @@ unsigned ptr_udiff(const void *p1, const void *p2) {
return ACC_ICONV(unsigned, d);
}
void mem_clear(void *p, size_t n)
{
mem_size_assert(1, n);
memset(p, 0, n);
}
/*************************************************************************
// bele.h
**************************************************************************/

View File

@ -50,6 +50,8 @@ bool mem_size_valid_bytes(upx_uint64_t bytes);
int ptr_diff(const void *p1, const void *p2);
unsigned ptr_udiff(const void *p1, const void *p2); // asserts p1 >= p2
void mem_clear(void *p, size_t n);
/*************************************************************************
// misc. support functions
**************************************************************************/