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

[REG 5.4->5.5] QString::simplified() fails to replace newlines by ' ' if length is unchanged

    XMLWordPrintable

Details

    • 5930a2d314d158f67bf3bf2bd940d7b67731ebde (qtbase/5.5, 12.3.2015, 5.5 ∝)

    Description

      #include <QString>
      #include <QDebug>
      
      int main(int argc, char *argv[])
      {
          QString s = QLatin1String(QT_VERSION_STR) + QLatin1String("\nbla\nbla");
          qDebug() << s << "simplified:" << s.simplified();
          return 0;
      }
      

      produces:

      "5.4.2
      bla
      bla" simplified: "5.4.2 bla bla"
      
      "5.5.0\nbla\nbla" simplified: "5.5.0\nbla\nbla"
      

      The check

      if (newlen == str.size()) {
                  // nothing happened, return the original
      

      introduced by https://codereview.qt-project.org/#/c/90980/ does not catch this, apparently.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              kleint Friedemann Kleint
              kleint Friedemann Kleint
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes