Skip to content

Commit

Permalink
fle
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Nov 28, 2024
1 parent 4b2234e commit 91a6aa7
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
12 changes: 5 additions & 7 deletions libr/bin/bfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,9 @@ R_API char *r_bin_filter_name(RBinFile *bf, HtSU *db, ut64 vaddr, const char *na
return resname;
}

// R2_600 - return bool for success or not
R_API void r_bin_filter_sym(RBinFile *bf, HtPP *ht, ut64 vaddr, RBinSymbol *sym) {
R_RETURN_IF_FAIL (ht && sym && sym->name);
R_IPI bool r_bin_filter_sym(RBinFile *bf, HtPP *ht, ut64 vaddr, RBinSymbol *sym) {
R_RETURN_VAL_IF_FAIL (ht && sym && sym->name, false);
const char *name = r_bin_name_tostring2 (sym->name, 'o');
#if 1
if (bf && bf->bo && bf->bo->lang) {
const char *lang = r_bin_lang_tostring (bf->bo->lang);
char *dn = r_bin_demangle (bf, lang, name, sym->vaddr, false);
Expand All @@ -92,11 +90,10 @@ R_API void r_bin_filter_sym(RBinFile *bf, HtPP *ht, ut64 vaddr, RBinSymbol *sym)
}
free (dn);
}
#endif
r_strf_var (uname, 256, "%" PFMT64x ".%c.%s", vaddr, sym->is_imported ? 'i' : 's', name);
bool res = ht_pp_insert (ht, uname, sym);
if (!res) {
return;
return false;
}
sym->dup_count = 0;

Expand All @@ -105,12 +102,13 @@ R_API void r_bin_filter_sym(RBinFile *bf, HtPP *ht, ut64 vaddr, RBinSymbol *sym)
if (!prev_sym) {
if (!ht_pp_insert (ht, oname, sym)) {
R_LOG_WARN ("Failed to insert dup_count in ht");
return;
return false;
}
} else {
sym->dup_count = prev_sym->dup_count + 1;
ht_pp_update (ht, oname, sym);
}
return true;
}

R_API void r_bin_filter_symbols(RBinFile *bf, RList *list) {
Expand Down
8 changes: 5 additions & 3 deletions libr/include/r_bin.h
Original file line number Diff line number Diff line change
Expand Up @@ -729,9 +729,7 @@ typedef struct r_bin_bind_t {
ut32 visibility;
} RBinBind;

R_IPI RBinSection *r_bin_section_new(const char *name);
R_API RBinSection *r_bin_section_clone(RBinSection *s);
R_IPI void r_bin_section_free(RBinSection *bs);
R_API void r_bin_info_free(RBinInfo *rb);
R_API void r_bin_import_free(RBinImport *imp);
R_API void r_bin_symbol_free(void *sym);
Expand Down Expand Up @@ -916,10 +914,14 @@ R_API void r_bin_load_filter(RBin *bin, ut64 rules);
R_API void r_bin_filter_symbols(RBinFile *bf, RList *list);
R_API void r_bin_filter_sections(RBinFile *bf, RList *list);
R_API char *r_bin_filter_name(RBinFile *bf, HtSU *db, ut64 addr, const char *name);
R_API void r_bin_filter_sym(RBinFile *bf, HtPP *ht, ut64 vaddr, RBinSymbol *sym);
R_API bool r_bin_strpurge(RBin *bin, const char *str, ut64 addr);
R_API bool r_bin_string_filter(RBin *bin, const char *str, ut64 addr);

// internal apis
R_IPI bool r_bin_filter_sym(RBinFile *bf, HtPP *ht, ut64 vaddr, RBinSymbol *sym);
R_IPI RBinSection *r_bin_section_new(const char *name);
R_IPI void r_bin_section_free(RBinSection *bs);

/* plugin pointers */
extern RBinPlugin r_bin_plugin_any;
extern RBinPlugin r_bin_plugin_fs;
Expand Down
1 change: 1 addition & 0 deletions libr/include/r_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@ R_API void r_core_list_io(RCore *core);
R_API void r_core_list_lang(RCore *core, int mode);

R_API void r_core_visual_slides(RCore *core, const char *file);

/* visual marks */
R_API void r_core_vmark(RCore *core, ut8 ch);
R_API void r_core_vmark_set(RCore *core, ut8 ch, ut64 addr, int x, int y);
Expand Down
2 changes: 1 addition & 1 deletion libr/util/buf_bytes.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static ut64 buf_bytes_get_size(RBuffer *b) {
static st64 buf_bytes_seek(RBuffer *b, st64 addr, int whence) {
r_warn_if_fail (b->rb_bytes);
if (R_UNLIKELY (addr < 0)) {
if (addr > -UT48_MAX) {
if (addr > -(st64)UT48_MAX) {
if (-addr > (st64)b->rb_bytes->offset) {
return -1;
}
Expand Down
2 changes: 1 addition & 1 deletion libr/util/buf_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ static ut64 buf_cache_get_size(RBuffer *b) {
static st64 buf_cache_seek(RBuffer *b, st64 addr, int whence) {
r_warn_if_fail (b->rb_cache);
if (addr < 0) {
if (addr > -UT48_MAX) {
if (addr > -(st64)UT48_MAX) {
if (-addr > (st64)b->rb_cache->offset) {
return -1;
}
Expand Down
2 changes: 1 addition & 1 deletion libr/util/table.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static int sortNumber(const void *a, const void *b) {
static int sortFloat(const void *a, const void *b) {
double fa = strtod ((const char *) a, NULL);
double fb = strtod ((const char *) b, NULL);
return (fa * 100) - (fb * 100);
return (int)((fa * 100) - (fb * 100));
}

// maybe just index by name instead of exposing those symbols as global
Expand Down

0 comments on commit 91a6aa7

Please sign in to comment.