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

Replace uses of QString:::utf16() with QString::(const)data()

    XMLWordPrintable

Details

    • 8
    • Team 2 Foundation_Sprint 48, Team Two Foundation Sprint 49, Team Two Foundation Sprint 50, Team Two Foundation Sprint 51

    Description

      The utf16() function guarantees a NUL-terminated UTF-16 string, and will reallocate when it can't be sure (most prominently, from objects constructed fromRawData()). Some code uses this function just because it returns a ushort* instead of a (const) QChar*, to avoid a reinterpret_cast, but invokes the detach() path for common QString objects such as {{QStringLiteral}}s.

      So, search for, and replace with QString::(const)data(), all uses of QString::utf16() that don't actually need the NUL-termination.

      QStringView::utf16() is not affected, and should stay.

      The casual use of utf16() has caused QTBUG-98653. Who knows what else is brewing.

      Attachments

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

        Activity

          People

            oyheskes Øystein Heskestad
            mmutz Marc Mutz
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: