mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-28 15:41:38 +00:00
More core fixes for Windows
This commit is contained in:
parent
86b1dc9f4a
commit
21e99d6fa6
@ -514,19 +514,27 @@ R_API void r_line_hist_free(void) {
|
||||
}
|
||||
|
||||
/* load history from file. TODO: if file == NULL load from ~/.<prg>.history or so */
|
||||
#if R2_580
|
||||
R_API bool r_line_hist_load(const char *file) {
|
||||
#else
|
||||
R_API int r_line_hist_load(const char *file) {
|
||||
FILE *fd;
|
||||
char buf[R_LINE_BUFSIZE], *path = r_str_home (file);
|
||||
#endif
|
||||
r_return_val_if_fail (file, false);
|
||||
char buf[R_LINE_BUFSIZE] = {0};
|
||||
char *path = r_str_home (file);
|
||||
if (!path) {
|
||||
return false;
|
||||
}
|
||||
if (!(fd = r_sandbox_fopen (path, "r"))) {
|
||||
FILE *fd = r_sandbox_fopen (path, "rb");
|
||||
if (!fd) {
|
||||
free (path);
|
||||
return false;
|
||||
}
|
||||
while (fgets (buf, sizeof (buf), fd)) {
|
||||
buf[0] = 0;
|
||||
while (fgets (buf, sizeof (buf) - 1, fd)) {
|
||||
r_str_trim_tail (buf);
|
||||
r_line_hist_add (buf);
|
||||
buf[0] = 0;
|
||||
}
|
||||
fclose (fd);
|
||||
free (path);
|
||||
|
@ -381,8 +381,8 @@ static int r2pm_uninstall_pkg(const char *pkg) {
|
||||
srcdir, pkg, script);
|
||||
int res = r_sandbox_system (s, 1);
|
||||
free (s);
|
||||
free (srcdir);
|
||||
#endif
|
||||
free (srcdir);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -584,11 +584,14 @@ R_API int r_main_radare2(int argc, const char **argv) {
|
||||
case 'C':
|
||||
do_connect = true;
|
||||
break;
|
||||
case 'd':
|
||||
#if DEBUGGER
|
||||
case 'd': debug = 1; break;
|
||||
debug = 1;
|
||||
#else
|
||||
case 'd': eprintf ("Sorry. No debugger backend available.\n"); return 1;
|
||||
eprintf ("Sorry. No debugger backend available.\n");
|
||||
return 1;
|
||||
#endif
|
||||
break;
|
||||
case 'D':
|
||||
debug = 2;
|
||||
free (debugbackend);
|
||||
|
@ -696,7 +696,7 @@ R_API char *r_file_slurp_lines(const char *file, int line, int count) {
|
||||
return NULL;
|
||||
}
|
||||
lines = line - 1;
|
||||
for (i = 0; str[i]&&lines; i++) {
|
||||
for (i = 0; str[i] && lines; i++) {
|
||||
if (str[i] == '\n') {
|
||||
lines--;
|
||||
}
|
||||
@ -1399,7 +1399,6 @@ R_API bool r_file_rm_rf(const char *dir) {
|
||||
return r_file_rm (dir);
|
||||
}
|
||||
|
||||
|
||||
static void recursive_glob(const char *path, const char *glob, RList* list, int depth) {
|
||||
if (depth < 1) {
|
||||
return;
|
||||
|
@ -658,7 +658,7 @@ R_API wchar_t *r_utf8_to_utf16_l(const char *cstring, int len) {
|
||||
|
||||
if ((wcsize = MultiByteToWideChar (CP_UTF8, 0, cstring, len, NULL, 0))) {
|
||||
wcsize ++;
|
||||
if ((rutf16 = (wchar_t *) calloc (wcsize + 1, sizeof (wchar_t)))) {
|
||||
if ((rutf16 = (wchar_t *) calloc (wcsize + 2, sizeof (wchar_t)))) {
|
||||
MultiByteToWideChar (CP_UTF8, 0, cstring, len, rutf16, wcsize);
|
||||
if (len != -1) {
|
||||
rutf16[wcsize - 1] = L'\0';
|
||||
|
Loading…
Reference in New Issue
Block a user