diff options
author | Sverker Eriksson <[email protected]> | 2012-12-21 15:50:21 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2013-01-08 11:15:01 +0100 |
commit | 685d009efcfd7521e9c918a14b58eac19755299d (patch) | |
tree | 83515a7dcc21f52ecc008bf16da1e7278750e9ca /lib/erl_interface/src/decode/decode_ref.c | |
parent | e4e007afd032f7aca359d2665f91ddb12727521a (diff) | |
download | otp-685d009efcfd7521e9c918a14b58eac19755299d.tar.gz otp-685d009efcfd7521e9c918a14b58eac19755299d.tar.bz2 otp-685d009efcfd7521e9c918a14b58eac19755299d.zip |
erl_interface: Enable decode of unicode atoms
No API changes or additions. Just the ability for erl_interface to decode
unicode atoms and convert them into latin1 strings to preserve backward
compatibility for the existing API.
Diffstat (limited to 'lib/erl_interface/src/decode/decode_ref.c')
-rw-r--r-- | lib/erl_interface/src/decode/decode_ref.c | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/lib/erl_interface/src/decode/decode_ref.c b/lib/erl_interface/src/decode/decode_ref.c index 7b15808bc5..df3c30777b 100644 --- a/lib/erl_interface/src/decode/decode_ref.c +++ b/lib/erl_interface/src/decode/decode_ref.c @@ -21,6 +21,7 @@ #include "eiext.h" #include "putget.h" + int ei_decode_ref(const char *buf, int *index, erlang_ref *p) { const char *s = buf + *index; @@ -30,18 +31,8 @@ int ei_decode_ref(const char *buf, int *index, erlang_ref *p) switch (get8(s)) { case ERL_REFERENCE_EXT: - /* first the nodename */ - if (get8(s) != ERL_ATOM_EXT) return -1; - - len = get16be(s); - - if (len > MAXATOMLEN) return -1; - - if (p) { - memmove(p->node, s, len); - p->node[len] = (char)0; - } - s += len; + /* nodename */ + if (get_atom(&s, p->node) < 0) return -1; /* now the numbers: num (4), creation (1) */ if (p) { @@ -62,15 +53,7 @@ int ei_decode_ref(const char *buf, int *index, erlang_ref *p) if (p) p->len = count; /* then the nodename */ - if (get8(s) != ERL_ATOM_EXT) return -1; - len = get16be(s); - if (len > MAXATOMLEN) return -1; - - if (p) { - memmove(p->node, s, len); - p->node[len] = (char)0; - } - s += len; + if (get_atom(&s, p->node) < 0) return -1; /* creation */ if (p) { @@ -95,3 +78,4 @@ int ei_decode_ref(const char *buf, int *index, erlang_ref *p) return -1; } } + |