diff options
Diffstat (limited to 'lib/erl_interface/src')
-rw-r--r-- | lib/erl_interface/src/decode/decode_atom.c | 2 | ||||
-rw-r--r-- | lib/erl_interface/src/encode/encode_atom.c | 3 | ||||
-rw-r--r-- | lib/erl_interface/src/legacy/erl_marshal.c | 6 |
3 files changed, 5 insertions, 6 deletions
diff --git a/lib/erl_interface/src/decode/decode_atom.c b/lib/erl_interface/src/decode/decode_atom.c index 2ada418243..556c400cb3 100644 --- a/lib/erl_interface/src/decode/decode_atom.c +++ b/lib/erl_interface/src/decode/decode_atom.c @@ -58,7 +58,7 @@ int ei_decode_atom_as(const char *buf, int *index, char* p, int destlen, return -1; } - if (want_enc == got_enc || want_enc == ERLANG_WHATEVER || want_enc == ERLANG_ASCII) { + if ((want_enc & got_enc) || want_enc == ERLANG_ASCII) { int i, found_non_ascii = 0; if (len >= destlen) return -1; diff --git a/lib/erl_interface/src/encode/encode_atom.c b/lib/erl_interface/src/encode/encode_atom.c index 8bbe962396..044f17cb60 100644 --- a/lib/erl_interface/src/encode/encode_atom.c +++ b/lib/erl_interface/src/encode/encode_atom.c @@ -59,8 +59,7 @@ int ei_encode_atom_len_as(char *buf, int *index, const char *p, int len, char *s0 = s; int offs; - if (len >= MAXATOMLEN && (from_enc == ERLANG_LATIN1 || - from_enc == ERLANG_ASCII)) { + if (len >= MAXATOMLEN && (from_enc & (ERLANG_LATIN1|ERLANG_ASCII))) { return -1; } diff --git a/lib/erl_interface/src/legacy/erl_marshal.c b/lib/erl_interface/src/legacy/erl_marshal.c index 884e9d421b..4c45cebb02 100644 --- a/lib/erl_interface/src/legacy/erl_marshal.c +++ b/lib/erl_interface/src/legacy/erl_marshal.c @@ -662,7 +662,7 @@ static int read_atom(unsigned char** ext, Erl_Atom_data* a) int offs = 0; enum erlang_char_encoding enc; int ret = ei_decode_atom_as((char*)*ext, &offs, buf, MAXATOMLEN_UTF8, - ERLANG_WHATEVER, NULL, &enc); + ERLANG_LATIN1|ERLANG_UTF8, NULL, &enc); *ext += offs; if (ret == 0) { @@ -674,11 +674,11 @@ static int read_atom(unsigned char** ext, Erl_Atom_data* a) a->lenL = 0; a->utf8 = NULL; a->lenU = 0; - if (enc == ERLANG_LATIN1 || enc == ERLANG_ASCII) { + if (enc & (ERLANG_LATIN1 | ERLANG_ASCII)) { a->latin1 = clone; a->lenL = i; } - if (enc == ERLANG_UTF8 || enc == ERLANG_ASCII) { + if (enc & (ERLANG_UTF8 | ERLANG_ASCII)) { a->utf8 = clone; a->lenU = i; } |