summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfsfileengine.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix CreateFileMapping() error handlingPeter Kümmel2013-03-011-1/+1
| | | | | | | | | | | CreateFileMapping() returns NULL in case of an error. The patch corrects the wrong testing on INVALID_HANDLE_VALUE, and sets NULL for invalid handles. Change-Id: Iaab4945ed88ee92bbf9a0871e95a5820dd1a56ed (cherry-picked from qtbase/1a8f67938c4146614fec3788c7868dc1a314cc84) Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Make compile with QT_NO_FILESYSTEMITERATORThomas Zander2013-01-301-0/+2
| | | | | | | Change-Id: Ie79dda5a48288a1d9cd4b7e0a7934ee9db48c953 Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com> Reviewed-by: Thomas Zander <zander@kde.org> Reviewed-by: João Abecasis <joao@abecasis.name>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-131-1/+1
| | | | | | Change-Id: I52bf8ef0447b701b4ebf7d7d240013a72adb9425 Reviewed-by: Akseli Salovaara <akseli.salovaara@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-291-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: I280c0a575987d1770e354b4948f1d4d767d711ea Reviewed-by: Simo Fält <simo.falt@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Update contact information in license headers.Sergio Ahumada2012-08-011-2/+2
| | | | | | | | | | | | | - Replace Nokia contact email address with Qt Project website. - Remove "All rights reserved" line from license headers. As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: Ie7ba62011752fcb149b99b26317c54f2a0cfa931 Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* Update year in Nokia copyright messages.Jason McDonald2012-01-111-1/+1
| | | | | | | | | Simple search and replace. This commit doesn't touch 3rd-party files, nor translations (where the change is not so simple and will be handled in a separate commit). Change-Id: I4e48513b8078a44a8cd272326685b25338890148 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Fix uninitialised variable in temporary filesShane Kearns2011-09-131-1/+4
| | | | | | | | | | | | The symbianFilePos variable was only initialised in the nativeOpen function and not in the constructor called init(). Due to the fix for QTBUG-4796, QTemporaryFile now bypasses the nativeOpen function. Zero initialising in init() ensures it is always valid (it only needs a non zero initialisation when opening a file for append, which is still covered by nativeOpen) Task-Number: QTBUG-21418 Reviewed-By: mread
* Doc: Fixed qdoc warnings.David Boddie2011-08-151-0/+16
|
* Native memory mapped file supportShane Kearns2011-06-281-2/+4
| | | | | Task-number: QT-5026 Reviewed-by: mread
* Merge branch '4.8' of scm.dev.nokia.troll.no:qt/qtDavid Boddie2011-05-241-17/+17
|\ | | | | | | | | | | | | | | Conflicts: src/gui/text/qrawfont.cpp src/gui/text/qtextlayout.cpp src/gui/util/qscroller.cpp src/gui/widgets/qlineedit.cpp
| * Update licenseheader text in source files for qt4.8Jyri Tahtela2011-05-131-17/+17
| | | | | | | | | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* | Squashed merge of the master-temp branch.David Boddie2011-05-061-1/+1
|/ | | | | Conflicts: doc/src/examples/maemovibration.qdoc
* Merge remote branch 'origin/4.7' into qt-master-from-4.7Olivier Goffart2011-01-171-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/webkit/imageanalyzer/imageanalyzer.h examples/webkit/imageanalyzer/mainwindow.h mkspecs/unsupported/qws/linux-x86-openkode-g++/qplatformdefs.h src/corelib/io/qfsfileengine_iterator_unix.cpp src/corelib/io/qfsfileengine_iterator_win.cpp src/corelib/kernel/qcoreapplication.cpp src/network/access/qnetworkaccessdatabackend.cpp src/plugins/bearer/connman/qconnmanservice_linux.cpp src/plugins/platforms/openvglite/qwindowsurface_vglite.h src/s60installs/bwins/QtCoreu.def src/s60installs/eabi/QtCoreu.def src/s60installs/s60installs.pro tools/assistant/tools/assistant/helpviewer_qwv.h tools/qdoc3/test/qt-html-templates.qdocconf
| * Update copyright year to 2011.Jason McDonald2011-01-101-1/+1
| | | | | | | | Reviewed-by: Trust Me
* | QFile API: add API to specify if adopted file handles should be closedShane Kearns2010-12-201-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QFile behaviour has been to not close file handles adopted by open(FILE*, OpenMode) and open(int fd, OpenMode) functions. This is inconvenient for frameworks which want to return an opened QFile to the user. In this case it would be better to transfer ownership of the handle to the QFile. New overloads are added which take an additional parameter from the QFile::FileHandleFlags flags. Currently only one bit is used to provide the AutoCloseHandle option, but it is extensible. The AutoCloseHandle option tells the QFile backend that it should close the handle when close() is called, rather than the default behaviour which remains to flush the handle and leave it open. The DontCloseHandle option is the inverse of this, specifying the old behaviour of flushing but not closing the file handle. Symbian OS file handles are not compatible with int, they are an opaque data type which contains two integers. The first identifies to the kernel the file server session The second identifies to the file server the subsession object (the file) The reason for this is that it has a microkernel architecture, the kernel has no support for files - all files and file systems are handled by a user mode process called the "file server". So for symbian, a new QFile::open() overload is added for adopting a symbian RFile handle. The API mirrors the existing API for POSIX file handles, but takes an RFile reference rather than an integer file descriptor. Task-number: QT-2924 Reviewed-by: joao Reviewed-by: mread Reviewed-by: Oswald Buddenhagen
* | Re-enable emulated QFile::map on symbianShane Kearns2010-10-291-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | Memory mapping of RFile handles is not supported in current symbian OS versions. However the "open C" libraries provide an emulated mmap() implementation which was used by QFile::map in Qt 4.6 release. To avoid breaking applications which rely on this function, QFile::map will now open the file with open C as well in order to use that handle to call mmap(). When symbian implements a file mapping API, we can switch the implementation to use that for RFile handles. Reviewed-By: joao
* | Move QDir::fromNativeSeparators call to the QFileSystemEntry constructorShane Kearns2010-10-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | The m_filePath should always have / as the separator, while m_nativeFilePath should always have the native separator. Almost every place the constructor is used, the path could be one passed into an API from code outside our control. So it's easier to do the path conversion in the constructor than to have to remember to call fromNativeSeparators in every place a QFileSystemEntry is constructed (especially since unix tests won't reveal any error) Reviewed-By: joao
* | Implement basic symbian native file IO to QFsFileEngineShane Kearns2010-09-091-1/+5
| | | | | | | | | | | | | | Enough functionality to be able to read/write files for the tst_qfileinfo autotest to pass. Reviewed-By: joao
* | Enable symbian IO code in the buildShane Kearns2010-09-081-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch contains several changes that needed to be done atomically. The native file path im QFileSystemEntry is changed from 8 bit to 16 bit character set. QFsFileEngine has some new symbian specific code (as the unix code does not compile with the above change), and forwards more calls to the new QFileSystemEngine. Unix implementations of link, rename and remove are moved to the unix version of this class, so less ifdef'ing is needed. Finally, io.pri now selects the _symbian.cpp source files instead of the _unix.cpp equivalents when building for symbian.
* | QFileSystemEngine::fillMetaData for Unix platformsJoão Abecasis2010-09-031-24/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This shuffles a lot of code out of QFSFileEngine. fillMetaData, however is almost a reimplementation of the logic. Goals for this function are to maximize data gathered and minimize file system queries. Symbian had an optimization to lstat first and only stat again on links, having noticed a lot of lstat were being done that weren't really necessary. That optimization was also made in the new fillMetaData function and extended to all platforms, whenever the LinkType attribute is requested (QFSFileEngine will now typically request this in reply to a fileFlags request). We now try to cache all meta data we get from the file system, while still requesting "refreshes" as often as we did before. Client code going straight to QFileSystemEngine API can choose it's behaviour by clearing and querying specific flags in the QFileSystemMetaData instance. Reviewed-by: Prasanth Ullattil
* | Finish canonicalized for all platformsThomas Zander2010-09-011-50/+0
| | | | | | | | | | | | | | QFSFileEnginePrivate::canonicalized is now removed and spread out over the qfsfileengine_unix.cpp and qfsfileengine.cpp Reviewed-by: João Abecasis
* | Move canonicalPath() to the new qfilesystemengine_unixThomas Zander2010-08-301-55/+2
| | | | | | | | Reviewed-by: João Abecasis
* | Removed native file path handling from QFSFileEngineJoão Abecasis2010-08-301-12/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Moved it into QFileSystemEntry, instead. For the time being, QFileSystemEntry may look like an unnecessary extra layer of indirection. For the time being, this allows us to do some code cleanup and de-duplication. It is also a stepping stone to becoming completely independent of the current file engine abstraction. Changes to QFileSystemEntry: - native file path on Windows is now a QString, instead of a QByteArray. Accordingly, constructors taking a QByteArray were removed for these platforms. - Encoding/decoding of file names uses QFile::encode/decodeName API, instead of assuming local 8 bit. On Windows, UTF-16 is used for native, as was being done in QFSFileEngine. - new functions isRoot(), isDriveRoot() [Windows/Symbian], and path() - convenience functions clear() and isEmpty() added to facilitate porting. Changes to QFSFileEngine (Windows): - removed QFSFileEnginePrivate::sizeFdFh(): the function was broken and never used, so might as well not get compiled in. - repeated pattern for use of FindFirstFile/FindClose hidden away in a static inline function. - repeated and inconsistent conversions from QString to native file paths reduced through the use of QFileSystemEntry. Done-with: Prasanth Ullattil Done-with: Thomas Zander
* | avoid infinite recursion in canonicalized() if cwd is a symlinkRitt Konstantin2010-04-301-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | if current directory is a symlink to another directory on the same drive (the simplest example; say, c:\current\dir is a symlink to c:\target) then the first valid prefix for "c:\target" in canonicalized() is "c:" (NOT "c:\") and would be treated like "c:\current\dir" again...and again... until stack overflow :) Merge-Request: 494 Task-number: QTBUG-7610 Reviewed-by: Zeno Albisser
* | Added support for symlinks and junction points on WindowsZeno Albisser2010-04-231-0/+2
|/ | | | | | | | | | | | | | | | | Since ntfs symlinks (not .lnk files) can use relative paths to targets, support for relative links needed to be added. Directory junctions can also be used to mount another filesystem directly into an existing folder. Such junctions in that case use the volume id of the target volume for the link path. Therefor this commit also includes an implementation for resolving volume ids. To be independent of existing directories in test code i added a function to create own junction points. Reviewed-by: Joao Task-number: QTBUG-9009, QTBUG-7036
* _close(fd) closes the associated handle and not the other way aroundJoão Abecasis2010-03-231-0/+2
| | | | | | | | | | ... according to the online MSDN documentation. Hid the cachedFd member in private data under WinCE, since it's never used there. Task-number: QTBUG-9085 Reviewed-by: Zeno Albisser
* doc: Fixed three new qdoc errors.Martin Smith2010-03-111-0/+4
|
* Merge remote branch 'origin/4.6' into qt-4.7-from-4.6Rohan McGovern2010-03-061-0/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure.exe examples/multimedia/audioinput/audioinput.cpp src/corelib/io/qfsfileengine.cpp src/gui/egl/qegl_wince.cpp src/gui/egl/qeglproperties.cpp src/gui/egl/qeglproperties_p.h src/gui/embedded/directfb.pri src/gui/kernel/qapplication_win.cpp src/gui/painting/qdrawutil.cpp src/opengl/qgl_p.h src/sql/drivers/odbc/qsql_odbc.cpp src/sql/drivers/odbc/qsql_odbc.h tests/auto/auto.pro tests/auto/qgl/tst_qgl.cpp translations/assistant_adp_ru.ts
| * Do not use realpath() with uclibcMarkus Goetz2010-03-041-0/+3
| | | | | | | | | | Task-number: QTBUG-8365 Reviewed-by: denis
* | Merge branch '4.6'Thiago Macieira2010-01-131-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | Conflicts: bin/syncqt doc/src/deployment/deployment.qdoc src/corelib/io/qfsfileengine_win.cpp src/corelib/xml/qxmlstream.cpp src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h tools/assistant/tools/assistant/centralwidget.cpp tools/linguist/lupdate/main.cpp
| * Update copyright year to 2010Jason McDonald2010-01-061-1/+1
| | | | | | | | Reviewed-by: Trust Me
| * Fix typo in QFSFileEnginePrivate::canonicalizedMarkus Goetz2010-01-041-1/+1
| | | | | | | | Reviewed-by: TrustMe
| * Use realpath() only on systems we know it works on.Denis Dzyubenko2009-12-091-1/+1
| | | | | | | | | | | | | | | | | | | | We use realpath(X,0) extension that is defined by the latest POSIX standard and not many systems support it at the moment. For now we limit it to Linux and Symbian. Mac supports it starting with 10.6, and we'll implement it properly for Mac in 4.7. We know that neither *BSD systems nor Solaris do not support it. Reviewed-by: Markus Goetz
* | Implemented getting a canonical file name on Mac OS X 10.5Denis Dzyubenko2009-12-091-1/+16
| | | | | | | | | | | | | | Using FSRef to get a canonical file path on OS X 10.5 which doesn't support realpath(X,0) extension. Reviewed-by: Prasanth
* | Use realpath only on OS we know it works on.Denis Dzyubenko2009-12-091-3/+9
|/ | | | | | | | | | | | | | | | | | | As far as we know realpath(X,0) extenstion is only supported on Linux, Mac OS X starting with 10.6 and on Symbian. Here goes the trick: realpath() on Mac properly handles file systems case-sensitivity, meaning two files with different cases will are the same file if the file system is case insensitive (which is the default on Mac). However the QFSFileEngine will still say that the file system is case sensitive because on Mac you can have several drives with different file systems (with different case sensitivity), and QFSFileEngine doesn't allow to return different values depending on the file path, so we still say that the file system is case-sensitive, which is the safiest behavior. This changes the behavior on Mac, but changes it to be correct. Reviewed-by: Markus Goetz Reviewed-by: João Abecasis
* Re-enabled realpath() on symbian.Denis Dzyubenko2009-12-011-1/+1
| | | | | | That was disabled by accident when we were disabling it for Mac. Reviewed-by: Prasanth
* Fix a crash in QFSFileEnginePrivate::canonicalized() on Mac OS X 10.5Prasanth Ullattil2009-12-011-3/+4
| | | | | | | The realpath() extension we use in this function is only available from 10.6 onwards. For the time being this optimization is turned off on Mac. Reviewed-by: Markus Goetz
* Fixes a crash on Mac with QFileInfo.Denis Dzyubenko2009-11-301-1/+5
| | | | | | | | | | realpath() crashes on mac if the input file path is the root ("/") - on 10.6 calling a free on the returned value shows a warning saying the memory was not allocated. To workaround that just added a special case - if the input string is '/', we don't need to use realpath as we already know that the path is canonical. Reviewed-by: Prasanth
* Avoid using return value from a temporary objectMarius Storm-Olsen2009-11-261-2/+1
| | | | | | | | The temporary object goes away before the next line is executed, so the pointer to the const data is invalid. Just put it all on one line, and we're ok. Reviewed-by: Brad
* Optimize QFSFileEnginePrivate::canonicalized() by using realpath()Markus Goetz2009-11-251-0/+12
| | | | | | | | In our benchmark, this makes QFileInfo.canonical*Path() up to 50% faster. This should also improve application startup time. Let's see if it works on all Unices and Symbian. Reviewed-by: mariusSO
* Fix regression introduced in c08e708037d33271825ce6a6a1ac640e96b70c36João Abecasis2009-11-171-4/+2
| | | | | | | | | | | When writing nothing to a file, not actually writing anything is not an error. Also, from a change introduced in the same commit, there is no point in checking for EOF when writing. Task-number: QTBUG-5847 Reviewed-by: Olivier Goffart
* Merge commit 'b65fd82299' from qt-core-team 4.6 into 4.6Marius Storm-Olsen2009-11-091-90/+78
|\ | | | | | | | | | | | | Conflicts: configure.exe src/corelib/io/qfsfileengine.cpp tests/auto/qfile/tst_qfile.cpp
| * Remove 4k-chunking in QFSFileEngine::read/writeFdFhJoão Abecasis2009-11-041-85/+78
| | | | | | | | | | | | | | | | | | | | | | This was a serious performance issue on Symbian and not necessarily optimal on other platforms. For the time being, we'll allow the OS to read/write as much as it can. Otherwise cleaned up the code, adding checks for invalid len arguments. Task-number: QT-2347 Reviewed-by: Peter Hartmann
* | Merge commit 'origin/4.6' into large-file-supportJoão Abecasis2009-11-051-12/+16
|\ \
| * | Increased block size for file IO in Symbian.Miikka Heikkinen2009-10-281-12/+16
| |/ | | | | | | | | | | | | | | | | | | | | | | Each read requires costly IPC call to Symbian file server, so reading and writing large files has lot of unnecessary overhead when using 4k block size. Increased the block size to 16k, which is what QIODevice will request at maximum. This speeds up reading large files up to 10%. Also included are some unnecessary whitespace removals. Task-number: QT-2347 Reviewed-by: axis
* | Check for non-zero return from fseekJoão Abecasis2009-10-231-4/+4
| | | | | | | | | | | | | | | | While POSIX specifies a -1 return on error, on Windows only non-zero is documented for error conditions. All platforms agree that zero is returned on success so we check for that instead. Reviewed-by: Markus Goetz
* | Fixes some issues with large files in 32-bit systemsJoão Abecasis2009-10-211-1/+4
| | | | | | | | Reviewed-by: Thiago Macieira
* | (Windows) Don't create a file mapping for each view that is mappedJoão Abecasis2009-10-211-3/+1
|/ | | | | | | | | | | | | Creating a file mapping for each view mapped to memory is sub-optimal and slow. With this change, a single mapping is created and reused when mapping subsequent views of the file. The handle returned from CreateFileForMapping (used in WinCE 5) is now discarded, since the kernel manages it automatically with the file mapping. This simplifies use of the deprecated map API. Reviewed-by: Maurice Kalinowski Reviewed-by: Marius Storm-Olsen
* Merge branch '4.6' of git@scm.dev.troll.no:qt/qt into 4.6Miikka Heikkinen2009-09-101-4/+4
|\
| * Update license headers again.Jason McDonald2009-09-091-4/+4
| | | | | | | | Reviewed-by: Trust Me