Skip to content

Commit

Permalink
Force RCons.setRaw just in case
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed May 26, 2023
1 parent 473d139 commit 7db7177
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 21 deletions.
15 changes: 3 additions & 12 deletions libr/cons/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,6 @@ extern volatile sig_atomic_t sigwinchFlag;
#endif

R_API int r_cons_readchar(void) {
const bool doraw = false;
char buf[2];
buf[0] = -1;
if (readbuffer_length > 0) {
Expand All @@ -612,9 +611,7 @@ R_API int r_cons_readchar(void) {
memmove (readbuffer, readbuffer + 1, readbuffer_length);
return ch;
}
if (doraw) {
r_cons_set_raw (true);
}
r_cons_set_raw (true);
#if R2__WINDOWS__
return __cons_readchar_w32 (0);
#elif __wasi__
Expand All @@ -624,9 +621,6 @@ R_API int r_cons_readchar(void) {
if (ret < 1) {
return -1;
}
if (doraw && bufactive) {
r_cons_set_raw (false);
}
return r_cons_controlz (buf[0]);
#else
void *bed = r_cons_sleep_begin ();
Expand Down Expand Up @@ -660,9 +654,6 @@ R_API int r_cons_readchar(void) {
if (ret != 1) {
return -1;
}
if (doraw && bufactive) {
r_cons_set_raw (0);
}
return r_cons_controlz (buf[0]);
#endif
}
Expand Down Expand Up @@ -701,7 +692,7 @@ R_API char *r_cons_password(const char *msg) {
int i = 0;
printf ("\r%s", msg);
fflush (stdout);
r_cons_set_raw (1);
r_cons_set_raw (true);
#if R2__UNIX__ && !__wasi__
RCons *a = r_cons_singleton ();
a->term_raw.c_lflag &= ~(ECHO | ECHONL);
Expand Down Expand Up @@ -731,7 +722,7 @@ R_API char *r_cons_password(const char *msg) {
buf[i++] = ch;
}
buf[i] = 0;
r_cons_set_raw (0);
r_cons_set_raw (false);
printf ("\n");
#if R2__UNIX__
r_sys_signal (SIGTSTP, SIG_DFL);
Expand Down
9 changes: 0 additions & 9 deletions libr/io/io_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,9 @@ R_API bool r_io_cache_read(RIO *io, ut64 addr, ut8 *buf, int len) {
}
const RSkylineItem *last = (RSkylineItem *)skyline->v.a + skyline->v.len;
bool covered = false;
int count = 0;
while (iter != last) {
const ut64 begin = r_itv_begin (iter->itv);
const ut64 end = r_itv_end (iter->itv);
count++;
if (end < addr) {
iter++;
continue;
Expand Down Expand Up @@ -229,19 +227,12 @@ R_API bool r_io_cache_read(RIO *io, ut64 addr, ut8 *buf, int len) {
iter++;
continue;
}
// eprintf ("inrange (%llx %d)\n", begin, (int)(end - begin));
if (read > 0) {
memcpy (buf + buf_offset, cache->data + cache_offset, read);
}
covered = true;
iter++;
}
#if 0
eprintf ("COUNT %d (0x%llx %d)\n", count, addr, len);
if (count > 45000) {
r_sys_breakpoint ();
}
#endif
return covered;
}

Expand Down

0 comments on commit 7db7177

Please sign in to comment.