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

Can not compile for single-byte charsets

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • 4.8.7
    • 4.8.0
    • None
    • Visual Studio 2010, 32-bit

    Description

      QFileDialogPrivate::maxNameLength(const QString &path) (in \src\gui\dialogs\qfiledialog_p.h) does not compile if a single-byte charset is used.
      Line ~149:

      if (::GetVolumeInformation(reinterpret_cast<const wchar_t *>(drive.utf16()), NULL, 0, NULL, &maxLength, NULL, NULL, 0) == FALSE)


      uses "GetVolumeInformationA" in that case which doesn't work with wchar *.

      I'd propose something like:

      #if defined(_UNICODE) || defined(_MBCS)
      if (::GetVolumeInformation(reinterpret_cast<const wchar_t *>(drive.utf16()), NULL, 0, NULL, &maxLength, NULL, NULL, 0) == FALSE)
      #else
      if (::GetVolumeInformation(drive.toLocal8Bit().constData(), NULL, 0, NULL, &maxLength, NULL, NULL, 0) == FALSE)
      #endif

      as a patch.

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            kiro Kim
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes