1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

Minor cleanups.

This commit is contained in:
Markus F.X.J. Oberhumer 2016-10-01 19:02:05 +02:00
parent 807ab8d19f
commit ee093e5232
3 changed files with 13 additions and 9 deletions

View File

@ -418,7 +418,7 @@ void PackPs1::buildLoader(const Filter *)
bool PackPs1::findBssSection()
{
unsigned char reg;
LE32 *p1 = (LE32 *)(ibuf + (ih.epc - ih.tx_ptr));
const LE32 * const p1 = ACC_CCAST(const LE32 *, ibuf + (ih.epc - ih.tx_ptr));
if ((ih.epc - ih.tx_ptr + (BSS_CHK_LIMIT * 4)) > fdata_size)
return false;
@ -433,7 +433,7 @@ bool PackPs1::findBssSection()
reg = REG1(op);
for (; i >= 0; i--)
{
bss_nfo *p = (bss_nfo *)(void *)&p1[i];
const bss_nfo * const p = ACC_CCAST(const bss_nfo *, &p1[i]);
upx_uint16_t op1 = p->op1, op2 = p->op2;
// check for la (x),bss_start

View File

@ -969,12 +969,12 @@ unsigned PackVmlinuzARMEL::write_vmlinuz_head(OutputFile *const fo)
fo->write(&stub_arm_v5a_linux_kernel_vmlinuz_head[0], 4);
// Second word
LE32 tmp_u32;
upx_uint32_t tmp_u32;
unsigned const t = (0xff000000 &
get_te32(&stub_arm_v5a_linux_kernel_vmlinuz_head[4]))
| (0x00ffffff & (0u - 1 + ((3+ ph.c_len)>>2)));
tmp_u32 = t;
fo->write((void const *)&tmp_u32, 4);
set_te32(&tmp_u32, t);
fo->write(&tmp_u32, 4);
return sizeof(stub_arm_v5a_linux_kernel_vmlinuz_head);
}

View File

@ -65,13 +65,17 @@ void do_one_file(const char *iname, char *oname)
struct stat st;
memset(&st, 0, sizeof(st));
#if (HAVE_LSTAT)
r = lstat(iname,&st);
r = lstat(iname, &st);
#else
r = stat(iname,&st);
r = stat(iname, &st);
#endif
if (r != 0)
throw FileNotFoundException(iname);
{
if (errno == ENOENT)
throw FileNotFoundException(iname, errno);
else
throwIOException(iname, errno);
}
if (!(S_ISREG(st.st_mode)))
throwIOException("not a regular file -- skipped");
#if defined(__unix__)