diff --git a/libr/bin/format/mach0/fatmach0.c b/libr/bin/format/mach0/fatmach0.c index e89eba4e84..c524a2c1d6 100644 --- a/libr/bin/format/mach0/fatmach0.c +++ b/libr/bin/format/mach0/fatmach0.c @@ -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))) { diff --git a/shlr/java/class.c b/shlr/java/class.c index 6b0ddb9dfc..387be77378 100644 --- a/shlr/java/class.c +++ b/shlr/java/class.c @@ -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); diff --git a/shlr/java/class.h b/shlr/java/class.h index a47499cb5f..461c136e5e 100644 --- a/shlr/java/class.h +++ b/shlr/java/class.h @@ -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);