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

QFile::decodeName unnecessarily allocates memory

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.14.0 RC1
    • 5.13.1
    • Core: I/O
    • None
    • All
    • efaa4aa2a1452cf73bc3117c49d1345a4106fd57 (qt/qtbase/5.15)

    Description

      QString QFile::decodeName(const char *localFileName) creates QByteArray from the passed const char * argument in order to finally call QString::fromLocal8Bit(const QByteArray &str).

      QByteArray constructor makes a deep copy of the const char * argument, which can be avoided if QFile::decodeName called QString::fromLocal8Bit(const char *str, int size = -1) instead.

      This is a trivial fix which will save memory allocations and improve performance. I attach a patch for this.

      Attachments

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

        Activity

          People

            adam.sowa Adam Sowa
            adam.sowa Adam Sowa
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes