Fix force-safe-string on Windows

master
David Allsopp 2019-11-13 20:59:18 +00:00
parent 2801fdf011
commit fc03370f88
4 changed files with 5 additions and 5 deletions

View File

@ -83,7 +83,7 @@ CAMLprim value unix_readlink(value opath)
win_wide_char_to_multi_byte(
point->SymbolicLinkReparseBuffer.PathBuffer + point->SymbolicLinkReparseBuffer.SubstituteNameOffset / sizeof(WCHAR),
cbLen,
String_val(result),
(char *)String_val(result),
len);
CloseHandle(h);
}

View File

@ -297,7 +297,7 @@ static int safe_do_stat(int do_lstat, int use_64, wchar_t* path, HANDLE fstat, _
return 1;
}
static int do_stat(int do_lstat, int use_64, char* opath, HANDLE fstat, __int64* st_ino, struct _stat64* res)
static int do_stat(int do_lstat, int use_64, const char* opath, HANDLE fstat, __int64* st_ino, struct _stat64* res)
{
wchar_t* wpath;
int ret;

View File

@ -440,7 +440,7 @@ CAMLexport value caml_alloc_sprintf(const char * format, ...)
"n" is the actual length of the output.
Allocate a Caml string of length "n" and copy the characters into it. */
res = caml_alloc_string(n);
memcpy(String_val(res), buf, n);
memcpy((char *)String_val(res), buf, n);
} else {
/* PR#7568: if the format is in the Caml heap, the following
caml_alloc_string could move or free the format. To prevent
@ -455,7 +455,7 @@ CAMLexport value caml_alloc_sprintf(const char * format, ...)
Note that caml_alloc_string left room for a '\0' at position n,
so the size passed to _vsnprintf is n+1. */
va_start(args, format);
_vsnprintf(String_val(res), n + 1, saved_format, args);
_vsnprintf((char *)String_val(res), n + 1, saved_format, args);
va_end(args);
caml_stat_free(saved_format);
}

View File

@ -883,7 +883,7 @@ CAMLexport value caml_copy_string_of_utf16(const wchar_t *s)
/* Do not include final NULL */
retcode = win_wide_char_to_multi_byte(s, slen, NULL, 0);
v = caml_alloc_string(retcode);
win_wide_char_to_multi_byte(s, slen, String_val(v), retcode);
win_wide_char_to_multi_byte(s, slen, (char *)String_val(v), retcode);
return v;
}