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

QString::sprintf - gcc compiler warns when using QString::utf16() as argument for %ls placeholder

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • None
    • 5.3.0 Alpha
    • None

    Description

      The documentation of QString::sprintf says:

      The %ls escape sequence expects a pointer to a zero-terminated array of unicode characters of type ushort (as returned by QString::utf16()).
      

      However, e.g.

      QString world("World");
      QString().sprintf("Hello %ls", str.utf16());
      

      will generate a gcc warning:

      warning: format '%ls' expects argument of type 'wchar_t*', but argument 3 has type 'const ushort* {aka const short unsigned int*}' [-Wformat=]
      

      Attachments

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

        Activity

          People

            kkohne Kai Köhne
            kkohne Kai Köhne
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes