mirror of
https://github.com/minetest/minetest.git
synced 2024-11-30 11:33:44 +01:00
Fix cast from const by accessing string data directly (#8354)
Fixes #8327
This commit is contained in:
parent
1e3e4fb649
commit
38f6e7a198
@ -2916,13 +2916,13 @@ public:
|
|||||||
ret[0] = unicode::BOM;
|
ret[0] = unicode::BOM;
|
||||||
else if (endian == unicode::EUTFEE_LITTLE)
|
else if (endian == unicode::EUTFEE_LITTLE)
|
||||||
{
|
{
|
||||||
uchar8_t* ptr8 = reinterpret_cast<uchar8_t*>(ret.c_str());
|
uchar8_t* ptr8 = reinterpret_cast<uchar8_t*>(&ret[0]);
|
||||||
*ptr8++ = unicode::BOM_ENCODE_UTF16_LE[0];
|
*ptr8++ = unicode::BOM_ENCODE_UTF16_LE[0];
|
||||||
*ptr8 = unicode::BOM_ENCODE_UTF16_LE[1];
|
*ptr8 = unicode::BOM_ENCODE_UTF16_LE[1];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uchar8_t* ptr8 = reinterpret_cast<uchar8_t*>(ret.c_str());
|
uchar8_t* ptr8 = reinterpret_cast<uchar8_t*>(&ret[0]);
|
||||||
*ptr8++ = unicode::BOM_ENCODE_UTF16_BE[0];
|
*ptr8++ = unicode::BOM_ENCODE_UTF16_BE[0];
|
||||||
*ptr8 = unicode::BOM_ENCODE_UTF16_BE[1];
|
*ptr8 = unicode::BOM_ENCODE_UTF16_BE[1];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user