Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-47176

QTextStream bad line ending

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.6.1
    • 5.2.1, 5.4.1
    • Core: I/O
    • None
    • Tested on Windows 7/2008 server:
      Qt 5.2.1 MSVC2012 32bit
      Qt 5.2.1 Mingw 32bit
      Qt 5.4.1 MSVC2013 32bit
      Qt 5.4.0 Linux GCC 64bit

    Description

      QTextStream writes wrong end line characters after readLine method was called at end of file.

      After inspecting QTextStreamPrivate::fillReadBuffer:

      Here texMode flag is changed in QIODevice:

          // handle text translation and bypass the Text flag in the device.
          bool textModeEnabled = device->isTextModeEnabled();
          if (textModeEnabled)
              device->setTextModeEnabled(false);
      

      Here it is restored:

          // reset the Text flag.
          if (textModeEnabled)
              device->setTextModeEnabled(true);
      

      But it will never be restored if this condition is true:

          if (bytesRead <= 0)
              return false;
      

      Attachments

        For Gerrit Dashboard: QTBUG-47176
        # Subject Branch Project Status CR V

        Activity

          People

            laknoll Lars Knoll
            dor666 Dorian Apanel
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes