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

Can not compile for single-byte charsets

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Done
    • Affects Version/s: 4.8.0
    • Fix Version/s: 4.8.7
    • Labels:
      None
    • Environment:
      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

            Assignee:
            Unassigned Unassigned
            Reporter:
            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