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

QFile::size() and QFile::map() does not do flush() before operation

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 4.6.1, 4.6.2, 4.6.3, 4.7.0
    • Core: I/O
    • None
    • windows and linux

    Description

      QFile::size() and QFile::map() does not do flush() before operation

      Suppose this scenario:
      1. open file for write|append
      2. write something to the file
      3. call ->getsize() to get size (we need this for map())
      4. call ->map()

      if flush() does not issued this error will be printed: "mapping beyond file size is not portable" or something else.
      SO:
      1. size() function should have argument (bool what_to_return=default_value)
      what_to_return switchs between "size when file will be flushed" and "current file size on file system."
      2. if map() uses area beyond file size on file system, flush should be issued. at least, QT should write (not sync()! only write syscall) file data needed for mmap().

      for quick and dirty implementation, just call flush() before any of this opertaions.

      Attachments

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

        Activity

          People

            earthdomain Earth Domain (Inactive)
            socketpair@gmail.com Коренберг Марк
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes