diff --git a/src/core/n-io.c b/src/core/n-io.c index 9a77ef0c81..57310a77a6 100644 --- a/src/core/n-io.c +++ b/src/core/n-io.c @@ -1155,14 +1155,11 @@ static REBSER *Read_All_File(char *fname) OS_REQUEST_PASSWORD(&req); - if (req.file.path == NULL) return R_NONE; + if (req.data == NULL) return R_NONE; -#ifdef TO_WINDOWS - str = Decode_UTF_String(req.file.path, req.file.size, 16, 0, 0); -#else - str = Decode_UTF_String(req.file.path, req.file.size, 8, 0, 0); -#endif - FREE_MEM(req.file.path); + str = Copy_OS_Str(req.data, req.actual); + + FREE_MEM(req.data); SET_STRING(D_RET, str); return R_RET; } diff --git a/src/os/posix/host-lib.c b/src/os/posix/host-lib.c index aa3f4581e3..7dce669500 100644 --- a/src/os/posix/host-lib.c +++ b/src/os/posix/host-lib.c @@ -1382,7 +1382,7 @@ static int Try_Browser(char *browser, REBCHR *url) REBYTE *str = malloc(size); REBYTE c; - req->file.path = NULL; + req->data = NULL; while (read(STDIN_FILENO, &c, 1) && c != '\r') { if (c == 27) { // ESC @@ -1400,8 +1400,8 @@ static int Try_Browser(char *browser, REBCHR *url) str = realloc(str, size); } } - req->file.path = str; - req->file.size = pos; + req->data = str; + req->actual = pos; str[pos++] = 0; // null terminate the tail.. just in case } diff --git a/src/os/win32/host-lib.c b/src/os/win32/host-lib.c index bce895fed7..6c6ef38b1d 100644 --- a/src/os/win32/host-lib.c +++ b/src/os/win32/host-lib.c @@ -1445,28 +1445,28 @@ static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPAR { REBCNT size = 64; REBCNT pos = 0; - REBUNI *str = (REBUNI*)malloc(size * sizeof(REBUNI)); - REBUNI c; + REBCHR *str = (REBUNI*)malloc(size * sizeof(REBCHR)); + REBCHR c; - req->file.path = NULL; + req->data = NULL; while ((c = _getwch()) != '\r') { if (c == 27) { // ESC free(str); return; } - if (c == 127) { // backspace + if (c == '\b') { // backspace if (pos > 0) pos--; continue; } str[pos++] = c; if (pos+1 == size) { size += 64; - str = (REBUNI*)realloc(str, size * sizeof(REBUNI)); + str = (REBCHR *)realloc(str, size * sizeof(REBCHR)); } } - req->file.path = (REBYTE*)str; - req->file.size = pos * sizeof(REBUNI); + req->data = (REBYTE*)str; + req->actual = pos; str[pos++] = 0; }