Skip to content

Commit

Permalink
Fix build and some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Oct 23, 2013
1 parent d1aaa61 commit 892a33e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion libr/bin/format/mach0/fatmach0.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))) {
Expand Down
16 changes: 10 additions & 6 deletions shlr/java/class.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,36 +23,40 @@


// 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;
ut32 Byte3 = x & 0xFF000000;
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);
Expand Down
9 changes: 0 additions & 9 deletions shlr/java/class.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 892a33e

Please sign in to comment.