mirror of
https://github.com/radareorg/radare2.git
synced 2025-03-06 21:39:38 +00:00
Fix warnings
This commit is contained in:
parent
fb141bdb0d
commit
374037a4d2
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -185,8 +185,6 @@ jobs:
|
|||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Installing the musl runtime
|
- name: Installing the musl runtime
|
||||||
run: |
|
run: |
|
||||||
sudo apt update
|
|
||||||
sudo apt upgrade
|
|
||||||
sudo apt install musl-tools
|
sudo apt install musl-tools
|
||||||
- name: Building static r2 with acr
|
- name: Building static r2 with acr
|
||||||
run: |
|
run: |
|
||||||
|
@ -3126,15 +3126,15 @@ static RBinElfSymbol* get_symbols_from_phdr(ELFOBJ *bin, int type) {
|
|||||||
for (i = 1, ret_ctr = 0; i < nsym; i++) {
|
for (i = 1, ret_ctr = 0; i < nsym; i++) {
|
||||||
if (i >= capacity1) { // maybe grow
|
if (i >= capacity1) { // maybe grow
|
||||||
// You take what you want, but you eat what you take.
|
// You take what you want, but you eat what you take.
|
||||||
Elf_(Sym)* temp_sym = (Elf_(Sym)*) realloc (sym, (capacity1 * GROWTH_FACTOR) * sym_size);
|
Elf_(Sym)* temp_sym = (Elf_(Sym)*) realloc (sym, (size_t)(capacity1 * GROWTH_FACTOR) * sym_size);
|
||||||
if (!temp_sym) {
|
if (!temp_sym) {
|
||||||
goto beach;
|
goto beach;
|
||||||
}
|
}
|
||||||
sym = temp_sym;
|
sym = temp_sym;
|
||||||
capacity1 *= GROWTH_FACTOR;
|
capacity1 = (size_t)(capacity1 * GROWTH_FACTOR);
|
||||||
}
|
}
|
||||||
if (ret_ctr >= capacity2) { // maybe grow
|
if (ret_ctr >= capacity2) { // maybe grow
|
||||||
RBinElfSymbol *temp_ret = realloc (ret, capacity2 * GROWTH_FACTOR * sizeof (struct r_bin_elf_symbol_t));
|
RBinElfSymbol *temp_ret = realloc (ret, (size_t)(capacity2 * GROWTH_FACTOR) * sizeof (struct r_bin_elf_symbol_t));
|
||||||
if (!temp_ret) {
|
if (!temp_ret) {
|
||||||
goto beach;
|
goto beach;
|
||||||
}
|
}
|
||||||
@ -3223,7 +3223,7 @@ done:
|
|||||||
// Size everything down to only what is used
|
// Size everything down to only what is used
|
||||||
{
|
{
|
||||||
nsym = i > 0? i: 1;
|
nsym = i > 0? i: 1;
|
||||||
Elf_(Sym) *temp_sym = (Elf_(Sym) *)realloc (sym, (nsym * GROWTH_FACTOR) * sym_size);
|
Elf_(Sym) *temp_sym = (Elf_(Sym) *)realloc (sym, (size_t)(nsym * GROWTH_FACTOR) * sym_size);
|
||||||
if (!temp_sym) {
|
if (!temp_sym) {
|
||||||
goto beach;
|
goto beach;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ static int wad_header_load(WadObj *wo, Sdb *kv) {
|
|||||||
(void) r_buf_fread_at (wo->buf, 0, (ut8 *) hdr, "uuu", 1);
|
(void) r_buf_fread_at (wo->buf, 0, (ut8 *) hdr, "uuu", 1);
|
||||||
sdb_set (kv, "header.num_lumps", sdb_fmt ("%u", hdr->numlumps), 0);
|
sdb_set (kv, "header.num_lumps", sdb_fmt ("%u", hdr->numlumps), 0);
|
||||||
sdb_set (kv, "header.diroffset", sdb_fmt ("0x%x", hdr->diroffset), 0);
|
sdb_set (kv, "header.diroffset", sdb_fmt ("0x%x", hdr->diroffset), 0);
|
||||||
ut32 numlumps = sdb_get (kv, "header.diroffset", 0);
|
ut32 numlumps = sdb_num_get (kv, "header.diroffset", 0);
|
||||||
eprintf("NumLumps: %x", numlumps);
|
eprintf("NumLumps: %x", numlumps);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -102,7 +102,7 @@ static RList *symbols(RBinFile *bf) {
|
|||||||
while (i < wo->hdr.numlumps) {
|
while (i < wo->hdr.numlumps) {
|
||||||
memset (&dir, 0, sizeof (dir));
|
memset (&dir, 0, sizeof (dir));
|
||||||
r_buf_read_at (bf->buf, wo->hdr.diroffset + (i * 16), (ut8*)&dir, sizeof (dir));
|
r_buf_read_at (bf->buf, wo->hdr.diroffset + (i * 16), (ut8*)&dir, sizeof (dir));
|
||||||
addsym (ret, strndup(dir.name, 8), dir.filepos, dir.size);
|
addsym (ret, r_str_ndup (dir.name, 8), dir.filepos, dir.size);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@ -118,7 +118,6 @@ static void wad_header_fields(RBinFile *bf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static RList *wad_fields(RBinFile *bf) {
|
static RList *wad_fields(RBinFile *bf) {
|
||||||
RBuffer *buf = bf->buf;
|
|
||||||
RList *ret = r_list_new ();
|
RList *ret = r_list_new ();
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -87,9 +87,9 @@ static void render_greyscale(PrintfCallback cb_printf, const ut8 *c, const ut8 *
|
|||||||
static void render_ascii(PrintfCallback cb_printf, const ut8 *c, const ut8 *d) {
|
static void render_ascii(PrintfCallback cb_printf, const ut8 *c, const ut8 *d) {
|
||||||
const char *pal = " `.,-:+*%$#";
|
const char *pal = " `.,-:+*%$#";
|
||||||
int idx, pal_len = strlen (pal);
|
int idx, pal_len = strlen (pal);
|
||||||
float p = (c[0]+c[1]+c[2])/3;
|
float p = ((double)(c[0]+c[1]+c[2])/3);
|
||||||
float q = (d[0]+d[1]+d[2])/3;
|
float q = ((double)(d[0]+d[1]+d[2])/3);
|
||||||
idx = ((p+q)/2) / (255/pal_len);
|
idx = (int)(((p+q)/2) / (255/pal_len));
|
||||||
if (idx >= pal_len) idx = pal_len-1;
|
if (idx >= pal_len) idx = pal_len-1;
|
||||||
cb_printf ("%c", pal[idx]);
|
cb_printf ("%c", pal[idx]);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user