mirror of git://gcc.gnu.org/git/gcc.git
runtime: Fix handling of surrogate pairs in string([]rune).
From-SVN: r205422
This commit is contained in:
parent
b168a8dfcc
commit
763d87526f
|
|
@ -30,6 +30,8 @@ __go_int_array_to_string (const void* p, intgo len)
|
||||||
|
|
||||||
if (v < 0 || v > 0x10ffff)
|
if (v < 0 || v > 0x10ffff)
|
||||||
v = 0xfffd;
|
v = 0xfffd;
|
||||||
|
else if (0xd800 <= v && v <= 0xdfff)
|
||||||
|
v = 0xfffd;
|
||||||
|
|
||||||
if (v <= 0x7f)
|
if (v <= 0x7f)
|
||||||
slen += 1;
|
slen += 1;
|
||||||
|
|
@ -56,6 +58,8 @@ __go_int_array_to_string (const void* p, intgo len)
|
||||||
character. */
|
character. */
|
||||||
if (v < 0 || v > 0x10ffff)
|
if (v < 0 || v > 0x10ffff)
|
||||||
v = 0xfffd;
|
v = 0xfffd;
|
||||||
|
else if (0xd800 <= v && v <= 0xdfff)
|
||||||
|
v = 0xfffd;
|
||||||
|
|
||||||
if (v <= 0x7f)
|
if (v <= 0x7f)
|
||||||
*s++ = v;
|
*s++ = v;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue