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

QFile::map regression under OS X

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.7.0
    • 4.6.0
    • Core: I/O
    • None
    • OS X 10.6.2
    • macOS

    Description

      About QFile::map(...) something has been broken in Qt 4.6 rc1 for OS X.
      No problem under Windows.
      The following code was wroking before:

      QFile file("/myfile");
      file.open(QIODevice::ReadWrite | QIODevice::Truncate | QIODevice::Unbuffered);
      char buf[100];
      memset(buf, 0, 100);
      file.write(buf, 100);
      uchar* p = file.map(0, 100);

      now p is NULL !!!

      By comparing the code in beta1 and rc1, I see some modification
      in qfsfileengine_unix.cpp.
      The problem is about this code which has been added:

      if (doStat()
      && (QT_OFF_T(size) > st.st_size - QT_OFF_T(offset)))
      return 0;

      The problem is that "st.st_size" is 0 because it does not take into account the recently written data.

      Attachments

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

        Activity

          People

            biochimia João Abecasis
            jirauser26727 user-04d21 (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes