1
0
mirror of https://github.com/upx/upx.git synced 2025-08-11 22:52:30 +08:00

Minor cleanups.

This commit is contained in:
Markus F.X.J. Oberhumer
2006-12-01 00:57:03 +01:00
parent fa95c3c4a2
commit 83052eafae
5 changed files with 17 additions and 15 deletions

View File

@ -100,8 +100,8 @@ struct PackerNames
Entry names[32];
size_t names_count;
const options_t *o;
PackerNames() { names_count = 0; o = NULL; }
void add(Packer *p)
PackerNames() : names_count(0), o(NULL) { }
void add(const Packer *p)
{
p->assertPacker();
assert(names_count < 32);
@ -161,7 +161,7 @@ static void show_all_packers(FILE *f, int verbose)
//
**************************************************************************/
void show_help(int x/*verbose*/)
void show_help(int verbose)
{
FILE *f = con_term;
int fg;
@ -178,8 +178,8 @@ void show_help(int x/*verbose*/)
" -d decompress -l list compressed file\n"
" -t test compressed file -V display version number\n"
" -h give %s help -L display software license\n%s",
x == 0 ? "" : " --best compress best (can be slow for big files)\n",
x == 0 ? "more" : "this", x == 0 ? "" : "\n");
verbose == 0 ? "" : " --best compress best (can be slow for big files)\n",
verbose == 0 ? "more" : "this", verbose == 0 ? "" : "\n");
fg = con_fg(f,FG_YELLOW);
con_fprintf(f,"Options:\n");
@ -191,15 +191,15 @@ void show_help(int x/*verbose*/)
//" -f force overwrite of output files and compression of suspicious files\n"
" -f force compression of suspicious files\n"
"%s%s"
, (x == 0) ? " -k keep backup files\n" : ""
, (verbose == 0) ? " -k keep backup files\n" : ""
#if 1
, (x > 0) ? " --no-color, --mono, --color, --no-progress change look\n" : ""
, (verbose > 0) ? " --no-color, --mono, --color, --no-progress change look\n" : ""
#else
, ""
#endif
);
if (x > 0)
if (verbose > 0)
{
fg = con_fg(f,FG_YELLOW);
con_fprintf(f,"\nBackup options:\n");
@ -318,7 +318,7 @@ void show_help(int x/*verbose*/)
fg = con_fg(f,FG_YELLOW);
con_fprintf(f,"This version supports:\n");
fg = con_fg(f,fg);
show_all_packers(f, x);
show_all_packers(f, verbose);
con_fprintf(f,"\nUPX comes with ABSOLUTELY NO WARRANTY; for details visit http://upx.sf.net\n"
// "\nUPX comes with ABSOLUTELY NO WARRANTY; for details type `upx -L'.\n"
"");

View File

@ -173,14 +173,14 @@ void ElfLinker::init(const void *pdata_v, int plen)
output = new upx_byte[inputlen];
outputlen = 0;
int pos = find(input, inputlen, "Sections:", 9);
int pos = find(input, inputlen, "Sections:\n", 10);
assert(pos != -1);
char *psections = (char *) input + pos;
char *psymbols = strstr(psections, "SYMBOL TABLE:");
char *psymbols = strstr(psections, "SYMBOL TABLE:\n");
assert(psymbols != NULL);
char *prelocs = strstr(psymbols, "RELOCATION RECORDS FOR");
char *prelocs = strstr(psymbols, "RELOCATION RECORDS FOR ");
assert(prelocs != NULL);
preprocessSections(psections, psymbols);
@ -369,11 +369,13 @@ ElfLinker::Relocation *ElfLinker::addRelocation(const char *section, unsigned of
return rel;
}
#if 0
void ElfLinker::setLoaderAlignOffset(int phase)
{
//assert(phase & 0);
printf("\nFIXME: ElfLinker::setLoaderAlignOffset %d\n", phase);
}
#endif
int ElfLinker::addLoader(const char *sname)
{

View File

@ -81,7 +81,7 @@ public:
virtual ~ElfLinker();
virtual void init(const void *pdata, int plen);
virtual void setLoaderAlignOffset(int phase);
//virtual void setLoaderAlignOffset(int phase);
virtual int addLoader(const char *sname);
virtual Section *addSection(const char *sname, const void *sdata, int slen, unsigned p2align);
virtual int getSection(const char *sname, int *slen=NULL) const;

View File

@ -60,7 +60,7 @@ Packer::~Packer()
// for PackMaster
void Packer::assertPacker()
void Packer::assertPacker() const
{
assert(getFormat() > 0);
assert(getFormat() <= 255);

View File

@ -119,7 +119,7 @@ protected:
Packer(InputFile *f);
public:
virtual ~Packer();
virtual void assertPacker();
virtual void assertPacker() const;
virtual int getVersion() const = 0;
// A unique integer ID for this executable format. See conf.h.