rem: for (uint i = 0; i < len; i++) { us = str[i].unicode(); str[i] = QChar(kmail_swap_16(us));
add: QChar *copy = new QChar[len]; const QChar *orig = str.unicode(); for (uint i = 0; i < len; i++) { copy[i] = kmail_swap_16(orig[i].unicode());
context: static void swapEndian(QString &str){  ushort us;  uint len = str.length();  for (uint i = 0; i < len; i++)  {    us = str[i].unicode();    str[i] = QChar(kmail_swap_16(us));  }}