tools/linguist/shared/qm.cpp
changeset 7 f7bc934e204c
parent 3 41300fa6a67c
child 30 5dc02b23752f
equal deleted inserted replaced
3:41300fa6a67c 7:f7bc934e204c
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the Qt Linguist of the Qt Toolkit.
     7 ** This file is part of the Qt Linguist of the Qt Toolkit.
     8 **
     8 **
   592                 if (len % 1) {
   592                 if (len % 1) {
   593                     cd.appendError(QLatin1String("QM-Format error"));
   593                     cd.appendError(QLatin1String("QM-Format error"));
   594                     return false;
   594                     return false;
   595                 }
   595                 }
   596                 m += 4;
   596                 m += 4;
   597                 QString str = QString::fromUtf16((const ushort *)m, len/2);
   597                 QString str = QString((const QChar *)m, len/2);
   598                 if (QSysInfo::ByteOrder == QSysInfo::LittleEndian) {
   598                 if (QSysInfo::ByteOrder == QSysInfo::LittleEndian) {
   599                     for (int i = 0; i < str.length(); ++i)
   599                     for (int i = 0; i < str.length(); ++i)
   600                         str[i] = QChar((str.at(i).unicode() >> 8) +
   600                         str[i] = QChar((str.at(i).unicode() >> 8) +
   601                             ((str.at(i).unicode() << 8) & 0xff00));
   601                             ((str.at(i).unicode() << 8) & 0xff00));
   602                 }
   602                 }