aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_unicode.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2013-12-20 14:25:03 +0100
committerSverker Eriksson <[email protected]>2013-12-20 14:25:35 +0100
commit1e4f6c5e85a821333dc1cea38d057fb92547e160 (patch)
tree26a0075dce302f2d3dd025d4b1c17494b5c0cb7a /erts/emulator/beam/erl_unicode.c
parent6f0b3bd3fc28de703490470630922873775c97f5 (diff)
parent21408235bd6915001cbc5051a1b7c38a3fef9d05 (diff)
downloadotp-1e4f6c5e85a821333dc1cea38d057fb92547e160.tar.gz
otp-1e4f6c5e85a821333dc1cea38d057fb92547e160.tar.bz2
otp-1e4f6c5e85a821333dc1cea38d057fb92547e160.zip
Merge branch 'sverk/unicode-driver-paths'
OTP-11549 * sverk/unicode-driver-paths: erts: Support loading of drivers with unicode paths erts: Add 'extra' argument to erts_convert_filename_to_encoding erts: Refactor remove erts_sys_dll_open2 erts: Fix compiler warning
Diffstat (limited to 'erts/emulator/beam/erl_unicode.c')
-rw-r--r--erts/emulator/beam/erl_unicode.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/erts/emulator/beam/erl_unicode.c b/erts/emulator/beam/erl_unicode.c
index 7e3c6681d9..3a968594f3 100644
--- a/erts/emulator/beam/erl_unicode.c
+++ b/erts/emulator/beam/erl_unicode.c
@@ -1990,12 +1990,14 @@ char *erts_convert_filename_to_native(Eterm name, char *statbuf, size_t statbuf_
{
int encoding = erts_get_native_filename_encoding();
return erts_convert_filename_to_encoding(name, statbuf, statbuf_size, alloc_type,
- allow_empty, allow_atom, encoding, used);
+ allow_empty, allow_atom, encoding,
+ used, 0);
}
char *erts_convert_filename_to_encoding(Eterm name, char *statbuf, size_t statbuf_size,
ErtsAlcType_t alloc_type, int allow_empty,
- int allow_atom, int encoding, Sint *used)
+ int allow_atom, int encoding, Sint *used,
+ Uint extra)
{
char* name_buf = NULL;
@@ -2008,13 +2010,14 @@ char *erts_convert_filename_to_encoding(Eterm name, char *statbuf, size_t statbu
}
if (encoding == ERL_FILENAME_WIN_WCHAR) {
need += 2;
+ extra *= 2;
} else {
++need;
}
if (used)
*used = (Sint) need;
- if (need > statbuf_size) {
- name_buf = (char *) erts_alloc(alloc_type, need);
+ if (need+extra > statbuf_size) {
+ name_buf = (char *) erts_alloc(alloc_type, need+extra);
} else {
name_buf = statbuf;
}
@@ -2035,8 +2038,8 @@ char *erts_convert_filename_to_encoding(Eterm name, char *statbuf, size_t statbu
/*Add 0 termination only*/
if (used)
*used = (Sint) size+1;
- if (size+1 > statbuf_size) {
- name_buf = (char *) erts_alloc(alloc_type, size+1);
+ if (size+1+extra > statbuf_size) {
+ name_buf = (char *) erts_alloc(alloc_type, size+1+extra);
} else {
name_buf = statbuf;
}
@@ -2045,7 +2048,7 @@ char *erts_convert_filename_to_encoding(Eterm name, char *statbuf, size_t statbu
} else {
name_buf = erts_convert_filename_to_wchar(bytes, size,
statbuf, statbuf_size,
- alloc_type, used, 0);
+ alloc_type, used, extra);
}
erts_free_aligned_binary_bytes(temp_alloc);
} else {