CEGUI::String::assign() wrong behaviour

Create issue
Issue #152 resolved
Former user created an issue

Automatic migration. Original reporter: "Ayudo"

try CEGUI::String sTest = CEGUI::String("abc").substr(0,10);

sTest.length() will be 10 now -> wrong behaviour IMO.

fix: GEstring& assign(const GEstring& str, size_type str_idx = 0, size_type str_num = npos) { if (str.d_cplength < str_idx) throw std::out_of_range("Index was out of range for CEGUI::GEstring object");

if (str_num == npos || (str_num != npos && str_num > str.d_cplength - str_idx) ) str_num = str.d_cplength - str_idx;

grow(str_num); setlen(str_num); memcpy(ptr(), &str.ptr()[str_idx], str_num * sizeof(GEutf32));

return *this; }

Reproducibility: always

Comments (1)

  1. Paul Turner

    Fixed in trunk, r1529.

    There were also some other assign, append, and insert operations affected by the same issue. I've fixed all of these too.

  2. Log in to comment