mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-25 14:19:51 +00:00
Fix few warnings and sort w command switch
This commit is contained in:
parent
c70f38325a
commit
306d6aa996
@ -23,7 +23,7 @@ static bool find_export(const ut32 *p, const RBinWasmExportEntry *q) {
|
||||
}
|
||||
|
||||
static bool load_buffer(RBinFile *bf, void **bin_obj, RBuffer *buf, ut64 loadaddr, Sdb *sdb) {
|
||||
r_return_val_if_fail (bf && buf && r_buf_size (buf) != UT64_MAX, NULL);
|
||||
r_return_val_if_fail (bf && buf && r_buf_size (buf) != UT64_MAX, false);
|
||||
|
||||
if (check_buffer (buf)) {
|
||||
*bin_obj = r_bin_wasm_init (bf, buf);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* radare - LGPL - Copyright 2009-2020 - pancake */
|
||||
/* radare - LGPL - Copyright 2009-2021 - pancake */
|
||||
|
||||
#include "r_crypto.h"
|
||||
#include "r_config.h"
|
||||
@ -1867,8 +1867,9 @@ static int wa_handler_old(void *data, const char *input) {
|
||||
|
||||
static int wb_handler_old(void *data, const char *input) {
|
||||
RCore *core = (RCore *)data;
|
||||
int len = strlen (input);
|
||||
ut8 *buf = malloc (len + 2);
|
||||
size_t len = strlen (input);
|
||||
const size_t buf_size = len + 2;
|
||||
ut8 *buf = malloc (buf_size);
|
||||
int wseek = r_config_get_i (core->config, "cfg.wseek");
|
||||
if (buf) {
|
||||
len = r_hex_str2bin (input, buf);
|
||||
@ -1880,11 +1881,12 @@ static int wb_handler_old(void *data, const char *input) {
|
||||
WSEEK (core, core->blocksize);
|
||||
}
|
||||
r_core_block_read (core);
|
||||
} else
|
||||
} else {
|
||||
eprintf ("Wrong argument\n");
|
||||
}
|
||||
free (buf);
|
||||
} else {
|
||||
eprintf ("Cannot malloc %d\n", len + 1);
|
||||
eprintf ("Cannot malloc %zd\n", buf_size);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -1980,9 +1982,6 @@ static int cmd_write(void *data, const char *input) {
|
||||
}
|
||||
|
||||
switch (*input) {
|
||||
case 'B': // "wB"
|
||||
wB_handler_old (data, input + 1);
|
||||
break;
|
||||
case '0': // "w0"
|
||||
w0_handler_old (data, input + 1);
|
||||
break;
|
||||
@ -1995,6 +1994,18 @@ static int cmd_write(void *data, const char *input) {
|
||||
case '6': // "w6"
|
||||
w6_handler_old (core, input + 1);
|
||||
break;
|
||||
case 'a': // "wa"
|
||||
wa_handler_old (core, input + 1);
|
||||
break;
|
||||
case 'b': // "wb"
|
||||
wb_handler_old (core, input + 1);
|
||||
break;
|
||||
case 'B': // "wB"
|
||||
wB_handler_old (data, input + 1);
|
||||
break;
|
||||
case 'c': // "wc"
|
||||
wc_handler_old (core, input + 1);
|
||||
break;
|
||||
case 'h': // "wh"
|
||||
wh_handler_old (core, input + 1);
|
||||
break;
|
||||
@ -2013,9 +2024,6 @@ static int cmd_write(void *data, const char *input) {
|
||||
case 'A': // "wA"
|
||||
wA_handler_old (core, input + 1);
|
||||
break;
|
||||
case 'c': // "wc"
|
||||
wc_handler_old (core, input + 1);
|
||||
break;
|
||||
case ' ': // "w"
|
||||
w_handler_old (core, input + 1);
|
||||
break;
|
||||
@ -2034,12 +2042,6 @@ static int cmd_write(void *data, const char *input) {
|
||||
case 'x': // "wx"
|
||||
wx_handler_old (core, input + 1);
|
||||
break;
|
||||
case 'a': // "wa"
|
||||
wa_handler_old (core, input + 1);
|
||||
break;
|
||||
case 'b': // "wb"
|
||||
wb_handler_old (core, input + 1);
|
||||
break;
|
||||
case 'm': // "wm"
|
||||
wm_handler_old (core, input + 1);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user