Skip to content

Commit 38f6e7a

Browse files
rubenwardynerzhul
authored andcommittedMar 12, 2019
Fix cast from const by accessing string data directly (#8354)
Fixes #8327
1 parent 1e3e4fb commit 38f6e7a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎src/irrlicht_changes/irrUString.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -2916,13 +2916,13 @@ class ustring16
29162916
ret[0] = unicode::BOM;
29172917
else if (endian == unicode::EUTFEE_LITTLE)
29182918
{
2919-
uchar8_t* ptr8 = reinterpret_cast<uchar8_t*>(ret.c_str());
2919+
uchar8_t* ptr8 = reinterpret_cast<uchar8_t*>(&ret[0]);
29202920
*ptr8++ = unicode::BOM_ENCODE_UTF16_LE[0];
29212921
*ptr8 = unicode::BOM_ENCODE_UTF16_LE[1];
29222922
}
29232923
else
29242924
{
2925-
uchar8_t* ptr8 = reinterpret_cast<uchar8_t*>(ret.c_str());
2925+
uchar8_t* ptr8 = reinterpret_cast<uchar8_t*>(&ret[0]);
29262926
*ptr8++ = unicode::BOM_ENCODE_UTF16_BE[0];
29272927
*ptr8 = unicode::BOM_ENCODE_UTF16_BE[1];
29282928
}

0 commit comments

Comments
 (0)
Please sign in to comment.