mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
Minor cleanups.
This commit is contained in:
parent
807ab8d19f
commit
ee093e5232
|
@ -418,7 +418,7 @@ void PackPs1::buildLoader(const Filter *)
|
||||||
bool PackPs1::findBssSection()
|
bool PackPs1::findBssSection()
|
||||||
{
|
{
|
||||||
unsigned char reg;
|
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)
|
if ((ih.epc - ih.tx_ptr + (BSS_CHK_LIMIT * 4)) > fdata_size)
|
||||||
return false;
|
return false;
|
||||||
|
@ -433,7 +433,7 @@ bool PackPs1::findBssSection()
|
||||||
reg = REG1(op);
|
reg = REG1(op);
|
||||||
for (; i >= 0; i--)
|
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;
|
upx_uint16_t op1 = p->op1, op2 = p->op2;
|
||||||
|
|
||||||
// check for la (x),bss_start
|
// check for la (x),bss_start
|
||||||
|
|
|
@ -969,12 +969,12 @@ unsigned PackVmlinuzARMEL::write_vmlinuz_head(OutputFile *const fo)
|
||||||
fo->write(&stub_arm_v5a_linux_kernel_vmlinuz_head[0], 4);
|
fo->write(&stub_arm_v5a_linux_kernel_vmlinuz_head[0], 4);
|
||||||
|
|
||||||
// Second word
|
// Second word
|
||||||
LE32 tmp_u32;
|
upx_uint32_t tmp_u32;
|
||||||
unsigned const t = (0xff000000 &
|
unsigned const t = (0xff000000 &
|
||||||
get_te32(&stub_arm_v5a_linux_kernel_vmlinuz_head[4]))
|
get_te32(&stub_arm_v5a_linux_kernel_vmlinuz_head[4]))
|
||||||
| (0x00ffffff & (0u - 1 + ((3+ ph.c_len)>>2)));
|
| (0x00ffffff & (0u - 1 + ((3+ ph.c_len)>>2)));
|
||||||
tmp_u32 = t;
|
set_te32(&tmp_u32, t);
|
||||||
fo->write((void const *)&tmp_u32, 4);
|
fo->write(&tmp_u32, 4);
|
||||||
|
|
||||||
return sizeof(stub_arm_v5a_linux_kernel_vmlinuz_head);
|
return sizeof(stub_arm_v5a_linux_kernel_vmlinuz_head);
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,9 +69,13 @@ void do_one_file(const char *iname, char *oname)
|
||||||
#else
|
#else
|
||||||
r = stat(iname, &st);
|
r = stat(iname, &st);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (r != 0)
|
if (r != 0)
|
||||||
throw FileNotFoundException(iname);
|
{
|
||||||
|
if (errno == ENOENT)
|
||||||
|
throw FileNotFoundException(iname, errno);
|
||||||
|
else
|
||||||
|
throwIOException(iname, errno);
|
||||||
|
}
|
||||||
if (!(S_ISREG(st.st_mode)))
|
if (!(S_ISREG(st.st_mode)))
|
||||||
throwIOException("not a regular file -- skipped");
|
throwIOException("not a regular file -- skipped");
|
||||||
#if defined(__unix__)
|
#if defined(__unix__)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user