mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-13 17:20:46 +00:00
asm.strenc (latin1) (#7857)
This commit is contained in:
parent
e04b82059a
commit
41b944b357
@ -2110,7 +2110,7 @@ R_API int r_core_config_init(RCore *core) {
|
|||||||
SETPREF ("asm.payloads", "false", "Show payload bytes in disasm");
|
SETPREF ("asm.payloads", "false", "Show payload bytes in disasm");
|
||||||
n = NODECB ("asm.strenc", "guess", &cb_asmstrenc);
|
n = NODECB ("asm.strenc", "guess", &cb_asmstrenc);
|
||||||
SETDESC (n, "Assumed string encoding for disasm");
|
SETDESC (n, "Assumed string encoding for disasm");
|
||||||
SETOPTIONS (n, "utf8", "guess", NULL);
|
SETOPTIONS (n, "latin1", "utf8", "guess", NULL);
|
||||||
SETCB ("bin.strpurge", "false", &cb_strpurge, "Try to purge false positive strings");
|
SETCB ("bin.strpurge", "false", &cb_strpurge, "Try to purge false positive strings");
|
||||||
SETPREF ("bin.libs", "false", "Try to load libraries after loading main binary");
|
SETPREF ("bin.libs", "false", "Try to load libraries after loading main binary");
|
||||||
n = NODECB ("bin.strfilter", "", &cb_strfilter);
|
n = NODECB ("bin.strfilter", "", &cb_strfilter);
|
||||||
|
@ -2644,7 +2644,14 @@ static void ds_print_asmop_payload(RDisasmState *ds, const ut8 *buf) {
|
|||||||
|
|
||||||
static void ds_print_str(RDisasmState *ds, const char *str, int len) {
|
static void ds_print_str(RDisasmState *ds, const char *str, int len) {
|
||||||
const char *nl = ds->show_comment_right ? "" : "\n";
|
const char *nl = ds->show_comment_right ? "" : "\n";
|
||||||
if (!strcmp (ds->strenc, "utf8")) {
|
if (!strcmp (ds->strenc, "latin1")) {
|
||||||
|
char *escstr = r_str_escape_latin1 (str);
|
||||||
|
if (escstr) {
|
||||||
|
ALIGN;
|
||||||
|
ds_comment (ds, true, "; \"%s\"%s", escstr, nl);
|
||||||
|
free (escstr);
|
||||||
|
}
|
||||||
|
} else if (!strcmp (ds->strenc, "utf8")) {
|
||||||
char *escstr = r_str_escape_utf8 (str);
|
char *escstr = r_str_escape_utf8 (str);
|
||||||
if (escstr) {
|
if (escstr) {
|
||||||
ALIGN;
|
ALIGN;
|
||||||
@ -2665,7 +2672,7 @@ static void ds_print_str(RDisasmState *ds, const char *str, int len) {
|
|||||||
&& str[i] != '"' && str[i] != '\\') {
|
&& str[i] != '"' && str[i] != '\\') {
|
||||||
ds_comment (ds, false, "%c", str[i]);
|
ds_comment (ds, false, "%c", str[i]);
|
||||||
} else {
|
} else {
|
||||||
char *escchar = r_str_escape_all (&str[i]);
|
char *escchar = r_str_escape_latin1 (&str[i]);
|
||||||
if (escchar) {
|
if (escchar) {
|
||||||
ds_comment (ds, false, "%s", escchar);
|
ds_comment (ds, false, "%s", escchar);
|
||||||
free (escchar);
|
free (escchar);
|
||||||
@ -2677,7 +2684,7 @@ static void ds_print_str(RDisasmState *ds, const char *str, int len) {
|
|||||||
}
|
}
|
||||||
ds_comment (ds, false, "\"%s", nl);
|
ds_comment (ds, false, "\"%s", nl);
|
||||||
} else {
|
} else {
|
||||||
char *escstr = r_str_escape_all (str);
|
char *escstr = r_str_escape_latin1 (str);
|
||||||
if (escstr) {
|
if (escstr) {
|
||||||
ALIGN;
|
ALIGN;
|
||||||
ds_comment (ds, true, "; \"%s\"%s", escstr, nl);
|
ds_comment (ds, true, "; \"%s\"%s", escstr, nl);
|
||||||
|
@ -101,7 +101,7 @@ R_API int r_str_re_replace(const char *str, const char *reg, const char *sub);
|
|||||||
R_API int r_str_unescape(char *buf);
|
R_API int r_str_unescape(char *buf);
|
||||||
R_API char *r_str_escape(const char *buf);
|
R_API char *r_str_escape(const char *buf);
|
||||||
R_API char *r_str_escape_dot(const char *buf);
|
R_API char *r_str_escape_dot(const char *buf);
|
||||||
R_API char *r_str_escape_all(const char *buf);
|
R_API char *r_str_escape_latin1(const char *buf);
|
||||||
R_API char *r_str_escape_utf8(const char *buf);
|
R_API char *r_str_escape_utf8(const char *buf);
|
||||||
R_API void r_str_uri_decode(char *buf);
|
R_API void r_str_uri_decode(char *buf);
|
||||||
R_API char *r_str_uri_encode(const char *buf);
|
R_API char *r_str_uri_encode(const char *buf);
|
||||||
|
@ -1290,14 +1290,14 @@ R_API char *r_str_escape(const char *buf) {
|
|||||||
return r_str_escape_ (buf, false, true);
|
return r_str_escape_ (buf, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
R_API char *r_str_escape_all(const char *buf) {
|
|
||||||
return r_str_escape_ (buf, false, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
R_API char *r_str_escape_dot(const char *buf) {
|
R_API char *r_str_escape_dot(const char *buf) {
|
||||||
return r_str_escape_ (buf, true, true);
|
return r_str_escape_ (buf, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
R_API char *r_str_escape_latin1(const char *buf) {
|
||||||
|
return r_str_escape_ (buf, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
R_API char *r_str_escape_utf8(const char *buf) {
|
R_API char *r_str_escape_utf8(const char *buf) {
|
||||||
char *new_buf, *q;
|
char *new_buf, *q;
|
||||||
const char *p, *end;
|
const char *p, *end;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user