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

QRegularExpression::match() always copies QString created with QString::fromRawData()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Not Evaluated
    • 6.0.0
    • 5.15.6
    • None
    • Linux/X11
    • 529f052add3edbc1afb063a5cbbb118b67434fb6

    Description

      The QString::fromRawData() documentation indicates how to use QRegularExpression with a QString without making a copy if using raw data.

      Unfortunately, this is not possible since QRegularExpressionPrivate::doMatch() uses QString::utf16() which does the copying in this case (as indicated in the documentation of `QString::fromRawData()`).

      PCRE2 doesn't need a 0-terminated string since it takes a size. Qt6 uses a QStringView which does not have this problem with utf16().

      Attachments

        Activity

          People

            peppe Giuseppe D'Angelo
            jonathanp Jonathan Poelen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: