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

Design Issue in QNetworkRequest

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • None
    • 6.8.2
    • Network
    • None
    • clang
    • All

    Description

      QNetworkRequest contains an enum 'Attribute'. It is defined like this:

      HttpStatusCodeAttribute,
      HttpReasonPhraseAttribute,
      ... more attributes
      User = 1000,
      UserMax = 32767

      The idea was obviously, that User+1 and User+2 could also be used. But they are not part of the enum and thus C++ forbids using them (the underlying datatype might have no representation for these values thus using User+1 might end up in undefined behaviour).
      A fix would be enum values for User1, User2, User3, ... up to User32767. In C89, this would not be an issue but I am using C++17.

      clang directly generates a warning that this is undefined behaviour:
      The value '1001' provided to the cast expression is not in the valid range of values for 'Attribute' [clang-analyzer-optin.core.EnumCastOutOfRange]

      Attachments

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

        Activity

          People

            manordheim MÃ¥rten Nordheim
            frodo Jens
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes