Minor cleanups.

This commit is contained in:
Markus F.X.J. Oberhumer
2016-10-09 03:12:19 +02:00
parent 554f8a376c
commit 22178f2224
3 changed files with 6 additions and 14 deletions
+1 -1
View File
@@ -117,7 +117,7 @@ endif
mostlyclean clean distclean maintainer-clean:
rm -f *.d *.map *.o *.obj *.res ./.depend upx.exe upx.out upx.ttp upx$(exeext)
./.depend compress_lzma$(objext) : override INCLUDES += -I$(UPX_LZMADIR)
./.depend compress_lzma$(objext) : INCLUDES += -I$(UPX_LZMADIR)
compress_lzma$(objext) : CXXFLAGS += -Wno-shadow
p_mach$(objext) : CXXFLAGS += -Wno-cast-align
+2 -2
View File
@@ -76,11 +76,11 @@ bool mem_size_valid_bytes(upx_uint64_t bytes)
}
int ptr_diff(const char *p1, const char *p2)
int ptr_diff(const void *p1, const void *p2)
{
assert(p1 != NULL);
assert(p2 != NULL);
ptrdiff_t d = p1 - p2;
ptrdiff_t d = (const char *)p1 - (const char *)p2;
if (p1 >= p2)
assert(mem_size_valid_bytes(d));
else
+3 -11
View File
@@ -75,21 +75,13 @@ bool mem_size_valid_bytes(upx_uint64_t bytes);
#define New(type, n) new type[mem_size_get_n(sizeof(type), n)]
int ptr_diff(const char *p1, const char *p2);
inline int ptr_diff(const unsigned char *p1, const unsigned char *p2) {
return ptr_diff((const char *) p1, (const char *) p2);
}
inline int ptr_diff(const void *p1, const void *p2) {
return ptr_diff((const char *) p1, (const char *) p2);
}
int ptr_diff(const void *p1, const void *p2);
template <class T1, class T2>
inline int ptr_udiff(const T1 &p1, const T2 &p2) {
inline unsigned ptr_udiff(const T1 &p1, const T2 &p2) {
int d = ptr_diff(p1, p2);
assert(d >= 0);
return d;
return ACC_ICONV(unsigned, d);
}
/*************************************************************************