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

QIODevice::readLineInto() should have a QSpan overload

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Fixed
    • Icon: P2: Important P2: Important
    • None
    • None
    • Core: I/O
    • None
    • 3
    • c39c3fe0c (dev)
    • Foundation Sprint 69, Foundation Sprint 70, Foundation Sprint 71, Foundation Sprint 110, Foundation Sprint 111, Foundation Sprint 112, Foundation Sprint 113, Foundation Sprint 114, Foundation Sprint 115, Foundation Sprint 116, Foundation Sprint 117, Foundation Sprint 118, Foundation Sprint 119, Foundation Sprint 120, Foundation Sprint 121

      QIODevice now has readLineInto(QByteArray *, qint64), but that is still dependent on a QByteArray and therefore needs at least one (initial) allocation.

      In many cases, a static or automatic buffer would be sufficient, such as a C array or a QVLA. For these callers, we should also have an overload of the QCryptographicHash::hashInto form:

      QByteArrayView QIODevice::readLineInto(QSpan<std::bytes> buffer); // + char and uchar overloads delegating to this
      

      cf. https://doc-snapshots.qt.io/qt6-dev/qcryptographichash.html#hashInto-3

      Doesn't need the maxSize parameter, as that would be the same as buffer.size().

      Could even have readInto() (non-Line) in the same style.

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

            rybouabi Rym Bouabid
            mmutz Marc Mutz
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes