Fix build and some warnings

This commit is contained in:
pancake 2013-10-24 00:27:07 +02:00
parent d1aaa61c58
commit 892a33ef23
3 changed files with 11 additions and 16 deletions

View File

@ -30,7 +30,7 @@ struct r_bin_fatmach0_arch_t *r_bin_fatmach0_extract(struct r_bin_fatmach0_obj_t
struct r_bin_fatmach0_arch_t *ret;
ut8 *buf = NULL;
if (bin->hdr.nfat_arch < 0 || idx < 0 || idx > bin->hdr.nfat_arch)
if ((bin->hdr.nfat_arch<0) || (idx < 0) || (idx > bin->hdr.nfat_arch))
return NULL;
if (narch) *narch = bin->hdr.nfat_arch;
if (!(ret = R_NEW0 (struct r_bin_fatmach0_arch_t))) {

View File

@ -23,7 +23,8 @@
// taken from LLVM Code Byte Swap
inline ut32 r_bin_java_swap_uint(ut32 x){
// TODO: move into r_util
static ut32 r_bin_java_swap_uint(ut32 x){
ut32 Byte0 = x & 0x000000FF;
ut32 Byte1 = x & 0x0000FF00;
ut32 Byte2 = x & 0x00FF0000;
@ -31,28 +32,31 @@ inline ut32 r_bin_java_swap_uint(ut32 x){
return (Byte0 << 24) | (Byte1 << 8) | (Byte2 >> 8) | (Byte3 >> 24);
}
inline ut16 r_bin_java_swap_ushort(ut16 x){
static ut16 r_bin_java_swap_ushort(ut16 x){
ut32 Byte0 = x & 0x00FF;
ut32 Byte1 = x & 0xFF00;
return (Byte0 << 8) | (Byte1 >> 8);
}
inline ut32 r_bin_java_read_int(RBinJavaObj *bin, ut64 offset){
static ut32 r_bin_java_read_int(RBinJavaObj *bin, ut64 offset){
ut32 sh = 0;
r_buf_read_at (bin->b, offset, (ut8*)&sh, 4);
return r_bin_java_swap_uint(sh);
}
inline ut16 r_bin_java_read_short(RBinJavaObj *bin, ut64 offset){
static ut16 r_bin_java_read_short(RBinJavaObj *bin, ut64 offset){
ut16 sh = 0;
r_buf_read_at (bin->b, offset, (ut8*)&sh, 2);
return r_bin_java_swap_ushort (sh);
}
inline ut32 r_bin_java_read_int_from_buffer(ut8 *buffer, ut64 offset){
static ut32 r_bin_java_read_int_from_buffer(ut8 *buffer, ut64 offset){
ut32 sh = 0;
memcpy((ut8 *)&sh, buffer, 4);
return r_bin_java_swap_uint(sh);
}
inline ut16 r_bin_java_read_short_from_buffer(ut8 *buffer, ut64 offset){
static ut16 r_bin_java_read_short_from_buffer(ut8 *buffer, ut64 offset){
ut16 sh = 0;
memcpy((ut8 *)&sh, buffer, 2);
return r_bin_java_swap_ushort (sh);

View File

@ -826,15 +826,6 @@ typedef struct{
} RBinJavaRefMetas;
inline ut32 r_bin_java_swap_uint(ut32 x);
inline ut16 r_bin_java_swap_ushort(ut16 x);
inline ut32 r_bin_java_read_int(RBinJavaObj *bin, ut64 offset);
inline ut16 r_bin_java_read_short(RBinJavaObj *bin, ut64 offset);
inline ut32 r_bin_java_read_int_from_buffer(ut8 *buf, ut64 offset);
inline ut16 r_bin_java_read_short_from_buffer(ut8 *buf, ut64 offset);
R_API static int javasm_init(RBinJavaObj *bin);
R_API ut8* r_bin_java_get_attr_buf(RBinJavaObj *bin, ut64 offset, ut64 sz);