aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_bits.c
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2011-10-20 10:49:13 +0200
committerBjörn Gustavsson <[email protected]>2011-10-20 10:49:13 +0200
commit6ef9aef50dbe839098e4330a97247aa21a15ecde (patch)
tree4e556a50e08da2e9ab139ec0c82c00c7de1a4b4f /erts/emulator/beam/erl_bits.c
parent907772538853d2f89d60702eb140e164a72503ad (diff)
parent34db76765561487e526fe66d3d19ecf3b3fb9dc8 (diff)
downloadotp-6ef9aef50dbe839098e4330a97247aa21a15ecde.tar.gz
otp-6ef9aef50dbe839098e4330a97247aa21a15ecde.tar.bz2
otp-6ef9aef50dbe839098e4330a97247aa21a15ecde.zip
Merge branch 'bjorn/unicode-noncharacters/OTP-9624'
* bjorn/unicode-noncharacters/OTP-9624: Allow noncharacter code points in unicode encoding and decoding
Diffstat (limited to 'erts/emulator/beam/erl_bits.c')
-rw-r--r--erts/emulator/beam/erl_bits.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/erts/emulator/beam/erl_bits.c b/erts/emulator/beam/erl_bits.c
index 326a5c136b..6f7309f493 100644
--- a/erts/emulator/beam/erl_bits.c
+++ b/erts/emulator/beam/erl_bits.c
@@ -845,8 +845,7 @@ erts_bs_put_utf8(ERL_BITS_PROTO_1(Eterm arg))
dst[1] = 0x80 | (val & 0x3F);
num_bits = 16;
} else if (val < 0x10000UL) {
- if ((0xD800 <= val && val <= 0xDFFF) ||
- val == 0xFFFE || val == 0xFFFF) {
+ if (0xD800 <= val && val <= 0xDFFF) {
return 0;
}
dst[0] = 0xE0 | (val >> 12);
@@ -886,8 +885,7 @@ erts_bs_put_utf16(ERL_BITS_PROTO_2(Eterm arg, Uint flags))
return 0;
}
val = unsigned_val(arg);
- if (val > 0x10FFFF || (0xD800 <= val && val <= 0xDFFF) ||
- val == 0xFFFE || val == 0xFFFF) {
+ if (val > 0x10FFFF || (0xD800 <= val && val <= 0xDFFF)) {
return 0;
}
@@ -1652,8 +1650,7 @@ erts_bs_get_utf8(ErlBinMatchBuffer* mb)
return THE_NON_VALUE;
}
result = (((result << 6) + a) << 6) + b - (Eterm) 0x000E2080UL;
- if ((0xD800 <= result && result <= 0xDFFF) ||
- result == 0xFFFE || result == 0xFFFF) {
+ if (0xD800 <= result && result <= 0xDFFF) {
return THE_NON_VALUE;
}
mb->offset += 24;
@@ -1723,9 +1720,6 @@ erts_bs_get_utf16(ErlBinMatchBuffer* mb, Uint flags)
w1 = (src[0] << 8) | src[1];
}
if (w1 < 0xD800 || w1 > 0xDFFF) {
- if (w1 == 0xFFFE || w1 == 0xFFFF) {
- return THE_NON_VALUE;
- }
mb->offset += 16;
return make_small(w1);
} else if (w1 > 0xDBFF) {