diff options
author | Sverker Eriksson <[email protected]> | 2013-01-11 17:27:29 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2013-01-18 15:04:03 +0100 |
commit | b553664f54034e8c04ae6f9cc44f16b7f516518b (patch) | |
tree | 1522c655fea9aa52476e997aa26f1512d3ecada4 /lib/erl_interface/src/legacy/erl_connect.c | |
parent | 97abb095cd2182d5c3fafd525da4943ef74dc8e5 (diff) | |
download | otp-b553664f54034e8c04ae6f9cc44f16b7f516518b.tar.gz otp-b553664f54034e8c04ae6f9cc44f16b7f516518b.tar.bz2 otp-b553664f54034e8c04ae6f9cc44f16b7f516518b.zip |
erl_interface: utf8 atoms continued
Diffstat (limited to 'lib/erl_interface/src/legacy/erl_connect.c')
-rw-r--r-- | lib/erl_interface/src/legacy/erl_connect.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/erl_interface/src/legacy/erl_connect.c b/lib/erl_interface/src/legacy/erl_connect.c index 41d4fa3138..be83fa8469 100644 --- a/lib/erl_interface/src/legacy/erl_connect.c +++ b/lib/erl_interface/src/legacy/erl_connect.c @@ -247,9 +247,15 @@ int erl_send(int fd, ETERM *to ,ETERM *msg) erl_errno = EINVAL; return -1; } - - strncpy(topid.node, (char *)ERL_PID_NODE(to), sizeof(topid.node)); - topid.node[sizeof(topid.node)-1] = '\0'; + + if (to->uval.pidval.node.latin1) { + strcpy(topid.node, to->uval.pidval.node.latin1); + topid.node_org_enc = ERLANG_LATIN1; + } + else { + strcpy(topid.node, to->uval.pidval.node.utf8); + topid.node_org_enc = ERLANG_UTF8; + } topid.num = ERL_PID_NUMBER(to); topid.serial = ERL_PID_SERIAL(to); topid.creation = ERL_PID_CREATION(to); @@ -263,7 +269,7 @@ static int erl_do_receive_msg(int fd, ei_x_buff* x, ErlMessage* emsg) erlang_msg msg; int r; - msg.from.node[0] = msg.to.node[0] = '\0'; + msg.from.node[0] = msg.to.node[0] = msg.toname[0] = '\0'; r = ei_do_receive_msg(fd, 0, &msg, x, 0); if (r == ERL_MSG) { @@ -299,7 +305,7 @@ static int erl_do_receive_msg(int fd, ei_x_buff* x, ErlMessage* emsg) emsg->to = erl_mk_pid(msg.to.node, msg.to.num, msg.to.serial, msg.to.creation); else emsg->to = NULL; - memcpy(emsg->to_name, msg.toname, MAXATOMLEN+1); + strcpy(emsg->to_name, msg.toname); return r; } |