src/corelib/codecs/qutfcodec.cpp
changeset 7 f7bc934e204c
parent 0 1918ee327afb
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 QtCore module of the Qt Toolkit.
     7 ** This file is part of the QtCore module of the Qt Toolkit.
     8 **
     8 **
   324             } else {
   324             } else {
   325                 ch.setRow(buf);
   325                 ch.setRow(buf);
   326                 ch.setCell(*chars++);
   326                 ch.setCell(*chars++);
   327             }
   327             }
   328             if (!headerdone) {
   328             if (!headerdone) {
       
   329                 headerdone = true;
   329                 if (endian == DetectEndianness) {
   330                 if (endian == DetectEndianness) {
   330                     if (ch == QChar::ByteOrderSwapped && endian != BigEndianness) {
   331                     if (ch == QChar::ByteOrderSwapped) {
   331                         endian = LittleEndianness;
   332                         endian = LittleEndianness;
   332                     } else if (ch == QChar::ByteOrderMark && endian != LittleEndianness) {
   333                     } else if (ch == QChar::ByteOrderMark) {
   333                         // ignore BOM
       
   334                         endian = BigEndianness;
   334                         endian = BigEndianness;
   335                     } else {
   335                     } else {
   336                         if (QSysInfo::ByteOrder == QSysInfo::BigEndian) {
   336                         if (QSysInfo::ByteOrder == QSysInfo::BigEndian) {
   337                             endian = BigEndianness;
   337                             endian = BigEndianness;
   338                         } else {
   338                         } else {
   342                         *qch++ = ch;
   342                         *qch++ = ch;
   343                     }
   343                     }
   344                 } else if (ch != QChar::ByteOrderMark) {
   344                 } else if (ch != QChar::ByteOrderMark) {
   345                     *qch++ = ch;
   345                     *qch++ = ch;
   346                 }
   346                 }
   347                 headerdone = true;
       
   348             } else {
   347             } else {
   349                 *qch++ = ch;
   348                 *qch++ = ch;
   350             }
   349             }
   351             half = false;
   350             half = false;
   352         } else {
   351         } else {