Skip to content

Commit

Permalink
Fix merge conflict remnants
Browse files Browse the repository at this point in the history
  • Loading branch information
DMaroo committed Dec 11, 2022
1 parent 3735881 commit 155057a
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 22 deletions.
30 changes: 30 additions & 0 deletions librz/core/cmd/cmd_print.c
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,36 @@ static const ut32 colormap[256] = {
0xffffff,
};

static void incAlphaBuffer(ut8 *buf, int bufsz) {
int i = 0;
while (i < bufsz) {
buf[i]++;
if (buf[i] && isalpha(buf[i])) {
break;
}
if (!buf[i]) {
i++;
continue;
}
}
// may overflow/hang/end/stop/whatever here
}

static void incDigitBuffer(ut8 *buf, int bufsz) {
int i = 0;
while (i < bufsz) {
buf[i]++;
if (buf[i] && isdigit(buf[i])) {
break;
}
if (!buf[i]) {
i++;
continue;
}
}
// may overflow/hang/end/stop/whatever here
}

// colordump
static void cmd_prc(RzCore *core, const ut8 *block, int len) {
const char *chars = " .,:;!O@#";
Expand Down
2 changes: 1 addition & 1 deletion librz/core/cmd_descs/cmd_descs.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ static const RzCmdDescDetail hash_bang_details[2];
static const RzCmdDescDetail oparen__details[2];
static const RzCmdDescDetail pointer_details[2];
static const RzCmdDescDetail interpret_macro_multiple_details[2];
static const RzCmdDescDetail cmd_search_hex_string_details[3];
static const RzCmdDescDetail analysis_all_esil_details[2];
static const RzCmdDescDetail analyze_all_preludes_details[2];
static const RzCmdDescDetail analysis_functions_merge_details[2];
static const RzCmdDescDetail analysis_appcall_details[2];
static const RzCmdDescDetail ag_details[2];
static const RzCmdDescDetail cmd_search_hex_string_details[3];
static const RzCmdDescDetail analysis_reg_cond_details[4];
static const RzCmdDescDetail ar_details[2];
static const RzCmdDescDetail analysis_hint_set_arch_details[2];
Expand Down
4 changes: 4 additions & 0 deletions librz/core/cmd_descs/cmd_descs.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,13 @@ RZ_IPI RzCmdStatus rz_interpret_pipe_handler(RzCore *core, int argc, const char
RZ_IPI RzCmdStatus rz_interpret_macro_handler(RzCore *core, int argc, const char **argv);
// "..("
RZ_IPI RzCmdStatus rz_interpret_macro_multiple_handler(RzCore *core, int argc, const char **argv);
// "/"
RZ_IPI RzCmdStatus rz_cmd_search_string_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
// "/x"
RZ_IPI RzCmdStatus rz_cmd_search_hex_string_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
// "/a"
RZ_IPI RzCmdStatus rz_cmd_search_assembly_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
// "R"
RZ_IPI RzCmdStatus rz_remote_handler(RzCore *core, int argc, const char **argv);
// "R<"
RZ_IPI RzCmdStatus rz_remote_send_handler(RzCore *core, int argc, const char **argv);
Expand Down
6 changes: 1 addition & 5 deletions librz/core/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2025,11 +2025,7 @@ RZ_API char *rz_core_analysis_hasrefs_to_depth(RzCore *core, ut64 value, PJ *pj,
case 2:
r = rz_utf8_encode_str((const RzRune *)buf, widebuf, sizeof(widebuf) - 1);
if (r == -1) {
<<<<<<< HEAD
RZ_LOG_ERROR("core: something was wrong with refs\n");
=======
RZ_LOG_ERROR("Something was wrong with refs\n");
>>>>>>> 1222d09384 (Rearrange functions and remove "currently" unused functions)
} else {
if (pj) {
pj_ks(pj, "string", (const char *)widebuf);
Expand Down Expand Up @@ -3906,7 +3902,7 @@ static int __prelude_cb_hit(RzSearchKeyword *kw, void *user, ut64 addr) {
RzCore *core = (RzCore *)user;
int depth = rz_config_get_i(core->config, "analysis.depth");
// eprintf ("ap: Found function prelude %d at 0x%08"PFMT64x"\n", preludecnt, addr);
rz_core_analysis_fcn(core, addr, -1, RZ_ANALYSIS_REF_TYPE_NULL, depth);
rz_core_analysis_fcn(core, addr, -1, RZ_ANALYSIS_XREF_TYPE_NULL, depth);
preludecnt++;
return 1;
}
Expand Down
14 changes: 1 addition & 13 deletions librz/include/rz_util/rz_str.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,7 @@ RZ_API char *rz_str_dup(char *ptr, const char *string);
RZ_API int rz_str_delta(char *p, char a, char b);
RZ_API void rz_str_filter(char *str);
RZ_API const char *rz_str_tok(const char *str1, const char b, size_t len);
<<<<<<< HEAD
RZ_API const char *rz_str_str_xy(const char *s, const char *word, const char *prev, int *x, int *y);
=======
RZ_API wchar_t *rz_str_mb_to_wc(const char *buf);
RZ_API char *rz_str_wc_to_mb(const wchar_t *buf);
RZ_API wchar_t *rz_str_mb_to_wc_l(const char *buf, int len);
RZ_API char *rz_str_wc_to_mb_l(const wchar_t *buf, int len);
RZ_API const char *rz_str_str_xy(RZ_NONNULL const char *s, RZ_NONNULL const char *word, const char *prev, RZ_NONNULL int *x, RZ_NONNULL int *y);
>>>>>>> 04ffa57ecf (Add `RZ_NONNULL` decoration for function arguments in `str.c`)

typedef void (*str_operation)(char *c);

Expand Down Expand Up @@ -263,11 +255,7 @@ RZ_API char *rz_str_from_ut64(ut64 val);
RZ_API void rz_str_stripLine(char *str, const char *key);
RZ_API char *rz_str_list_join(RzList /*<char *>*/ *str, const char *sep);
RZ_API char *rz_str_array_join(const char **a, size_t n, const char *sep);
<<<<<<< HEAD
RZ_API RzList /*<char *>*/ *rz_str_wrap(char *str, size_t width);
=======
RZ_API RzList *rz_str_wrap(RZ_NONNULL char *str, size_t width);
>>>>>>> 04ffa57ecf (Add `RZ_NONNULL` decoration for function arguments in `str.c`)
RZ_API RzList /*<char *>*/ *rz_str_wrap(RZ_NONNULL char *str, size_t width);

RZ_API const char *rz_str_sep(const char *base, const char *sep);
RZ_API const char *rz_str_rsep(const char *base, const char *p, const char *sep);
Expand Down
13 changes: 10 additions & 3 deletions librz/util/str.c
Original file line number Diff line number Diff line change
Expand Up @@ -2366,10 +2366,13 @@ RZ_API void rz_str_filter(char *str) {
}

/**
* \brief Extract all printable characters in \p str, and return a string of maximum length \p len
* \brief Extract all printable characters in \p str, and return a string of length \p len
*
* \param str String to extract printable characters from
* \param len The maximum length of the resulting string
* \param len The length of the resulting string
* \p len is the length, excluding the NULL terminator
* If the number of printable characters in \p str is less than \p len,
* then the resulting string will also be of length less than \p len
* \return char* Extracted printable string
*/
RZ_API RZ_OWN char *rz_str_extract_printable(RZ_NONNULL const char *str, int len) {
Expand All @@ -2379,9 +2382,13 @@ RZ_API RZ_OWN char *rz_str_extract_printable(RZ_NONNULL const char *str, int len
return NULL;
}
int i;
for (i = 0, r = res; i < len; str++, i++) {
for (i = 0, r = res; i < len; str++) {
if (*str == 0) {
break;
}
if (IS_PRINTABLE(*str)) {
*r++ = *str;
i++;
}
}
*r = 0;
Expand Down
2 changes: 2 additions & 0 deletions test/unit/test_str.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,8 @@ bool test_rz_str_isXutf8(void) {
mu_assert_false(rz_str_isXutf8(broken_u4, 4), "Broken 4 byte UTF-8");
mu_assert_false(rz_str_isXutf8(null, 4), "0x00 checks");
mu_assert_false(rz_str_isXutf8(ascii, 5), "Invalid UTF-8 length");

mu_end;
}

bool test_rz_str_extract_printable(void) {
Expand Down

0 comments on commit 155057a

Please sign in to comment.