summaryrefslogtreecommitdiff
path: root/src/corelib/io
Commit message (Collapse)AuthorAgeFilesLines
* Fixed QResource to respect the explicitely set localeDenis Dzyubenko2009-12-171-1/+1
| | | | | | | When using QResource directly, the loader should respect the locale that the user asked to use for the resource. Reviewed-by: João Abecasis
* An optimisation to QTextStreamDenis Dzyubenko2009-12-161-5/+4
| | | | | | | | Using QLocale::operator== is faster than comparing languages, because when getting a language from a default constructed QLocale object, it initializes the system locale and quieries the system which languge it supports. Reviewed-by: Olivier Goffart
* Ensure that QProcessEnvironment::operator== doesn't crashThiago Macieira2009-12-101-1/+2
| | | | | | | Also add an extensive autotest suite for QProcessEnvironment Task-number: QTBUG-6701 Reviewed-by: Markus Goetz
* 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
* Fix regression in tst_QFileSystemWatcherBradley T. Hughes2009-12-011-7/+3
| | | | | | | Dnotify doesn't work on dup'ed file descriptors apparently, so we need to closedir() before using fcntl() to set the watches. Reviewed-by: TrustMe
* Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.6Bradley T. Hughes2009-12-011-3/+4
|\
| * 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
* | Make sure file descriptors are valid in the dnotify implementation of ↵Bradley T. Hughes2009-12-011-2/+2
|/ | | | | | | | | | | QFileSystemWatcher Commit 71c3227ba260b964b0c9516f05ad4f2e6fa72f69 fixed a memory leak by calling closedir(), which would also close the file descriptor we were wanting to watch. Fix this by duplicating the file descriptor that we store. Reviewed-by: TrustMe
* 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
* Unix: Avoid stat() when opening a fileMarkus Goetz2009-11-301-12/+20
| | | | | | | | | The open() syscall can open directories for reading, which we in QFile and file engines don't support. However, there is no need for stat() to find out if it is a directory if we open() with a write flag because then the syscall will fail anyway. Reviewed-by: joao
* Fix memory leak in the DNotify implementation of QFileSystemWatcherBradley T. Hughes2009-11-271-0/+3
| | | | | | | Make sure that all calls to opendir() are paired with a call closedir(). Reviewed-by: Marius Storm-Olsen Task-number: QTBUG-4840
* Improve QFileInfo benchmarkMarkus Goetz2009-11-271-1/+1
| | | | Reviewed-by: TrustMe
* 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 QFile::map in Linux 64bitOlivier Goffart2009-11-251-1/+1
| | | | | | | | On 64bit, qint64(size_t(-1)) = -1 Reviewed-by: Joao Reviewed-by: Thiago (cherry picked from commit 829d9e10ad3d26fb2fddef01c8e36352018c3fec)
* Fix regression introduced in 1e6b424b692b20dcfec920f8d3563e520ec1ff05João Abecasis2009-11-201-1/+5
| | | | | | | | | | | | When processing the result of QIODevice::readLine, forgot to take into account that a '\0' is appended to the array. The terminating character is not accounted for in the number of bytes returned. By pre-allocating a byte for the terminating null character, we make sure we'll actually read 16k bytes on each and every iteration. Task-number: QTBUG-6019 Reviewed-by: Thiago Macieira
* Revert check for file size to a warning in QFile::mapJoão Abecasis2009-11-191-1/+1
| | | | | | | | | | | | The check, introduced in c66de8a19b558e14097c402480eeabf0b5ec2351, changes behavior and it is not clear whether we should prevent mmaping beyond EOF. FWIW, python prevents it. Leaving a warning in there for now so as not to break applications that depend on the feature. Task-number: QTBUG-6008 Reviewed-by: Thiago Macieira
* Merge branch '4.6' of oslo-staging-1 into 4.6Simon Hausmann2009-11-191-0/+3
|\
| * Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt into 4.6Simon Hausmann2009-11-183-3/+3
| |\ | | | | | | | | | | | | Conflicts: configure.exe
| * | Fix regression introduced in 98a05681851db9d88b1364af52be543715fbe306João Abecasis2009-11-181-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Some network tests were set up to ignore a qWarning that was removed. Fixed those tests. Made warning from QIODevice::getChar have the right function name. Reviewed-by: Thiago Macieira
* | | Merge oslo-staging-2/4.6 into upstream/4.6Olivier Goffart2009-11-191-4/+4
|\ \ \
| * | | Ran the script utils/normalizeOlivier Goffart2009-11-181-4/+4
| | | | | | | | | | | | | | | | Over src/ tools/ examples/ and demos/
* | | | Merge remote branch 'staging/4.6' into 4.6Simon Hausmann2009-11-183-117/+103
|\ \ \ \ | | |/ / | |/| / | |_|/ |/| | Conflicts: configure.exe
| * | Removing unnecessary chunking and stat'ing when reading QIODeviceJoão Abecasis2009-11-171-54/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Chunk size increased to QIODEVICE_BUFFERSIZE (currently 16k) where chunking is still needed. Namely, on sequential devices and when QByteArray is unable to allocate a large enough buffer. This is necessary for backward compatibility Improved validation and prevention of overflow in maxSize argument. Updated autotest that relied on a null QByteArray when no data was available and no errors were found. The only guarantee we should be providing in this case is an empty result -- even though that behavior is preserved for the time being. Affected functions: * QIODevice::read(qint64 maxSize) Chunking will still happen for large maxSize (i.e., QByteArray resize fails), where it could be used as a synonym for QIODevice::readAll(). No stat'ing performed. Read from device continues for as long as it is successful. Stops if an error occurs or if we get less data than requested. * QIODevice::readAll() Chunking is performed for sequential devices where total size wouldn't be known beforehand. For sequential devices, reading continues as long as data is returned, even if less than requested. Non-sequential devices will be stat'ed once. If QIODevice::size returns 0, this is taken to mean unknown size and chunking is performed. Otherwise, a single read request is made for the specified size. On failure to resize QByteArray, nothing is returned. * QIODevice::readLine(qint64 maxSize) Chunking is performed for maxSize == 0, or if we can't allocate a large enough buffer. No stat'ing performed at this level. Read from device continues until EOL is found, as long as we get all requested data. Task-number: QT-2347 Reviewed-by: Thiago Macieira Reviewed-by: Miikka Heikkinen
| * | 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
| * | Fix QIODevice::getChar optimizationJoão Abecasis2009-11-171-46/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Text mode there would be a huge penalty on each '\r' found even if the internal buffer was not exhausted, because we would repeatedly remove the '\r' from the buffer and put it back it. Before following through to the unoptimized code, anyway. Instead, we now loop over the internal buffer until we find a suitable character. Reduced code duplication by having QIODevice::getChar directly call QIODevice::read and letting compilers do their job. Reviewed-by: Markus Goetz
| * | Remove needless loop in QIODevice::seekJoão Abecasis2009-11-171-12/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Either the buffer has more data than is being skipped and it can be cleared or it doesn't and we must skip it. If the total size of QRingBuffer exceeds INT_MAX there'll be bigger problems (e.g., QRingBuffer::size() will overflow) that can only be handled there and there's no point trying to work around them here. Reviewed-by: Markus Goetz
| * | There should only be one write buffer at a time in QFileJoão Abecasis2009-11-171-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | To be sure, we should explicitly use the size of that buffer and not the whole QRingBuffer when flushing the data. With this change, we make violations of the one-buffer-rule explicitly fail on flush(), but we avoid corrupting data and reading past the buffer's end. Reviewed-by: Markus Goetz
* | Merge remote branch 'mainline/4.6' into 4.6Oswald Buddenhagen2009-11-171-21/+22
|\ \ | |/
| * QUrl::fromUserInput: improvements, corrections and make the demoJocelyn Turcotte2009-11-121-21/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | browser use it. - Handle windows files names by looking for paths first (and don't check that it exists first) - Handle host names without dots (it was not handled because of difficulties with the case host:port) - Return the parsed url only if the host or the path is not empty instead of returning a url that looks like "http:" Reviewed-by: Thiago Macieira
* | Merge remote branch 'mainline/4.6' into 4.6Oswald Buddenhagen2009-11-101-90/+78
|\ \ | |/ | | | | | | Conflicts: tools/configure/configureapp.cpp
| * Merge branch 'tools-team/4.6' (early part) into 4.6Oswald Buddenhagen2009-11-101-0/+1
| |\ | | | | | | | | | | | | Conflicts: src/corelib/tools/qscopedpointer.h
| * \ 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
* | | | build lrelease bootstrappedOswald Buddenhagen2009-11-103-3/+3
| |_|/ |/| | | | | | | | | | | | | | | | | | | | needed for build-time qm generation in qt itself. the downsides are a) that the other bootstrapped tools grow by ~12kB (on x86) due to qdatastream being pulled in by qbytearray and qstring and b) that lrelease isn't l10n'd itself anymore (the latter could be fixed by building a non-qobject qtranslator).
* | | Move QCustomScopedPointer to a private headerHarald Fernengel2009-11-091-0/+1
|/ / | | | | | | | | | | | | | | | | The API is internal, so it should live in its private header. The class was introduced during the lifetime of 4.6 (not in 4.5), so the move is binary compatible. Task-number: QTBUG-5617 Reviewed-by: João Abecasis <joao@abecasis.name>
* | Fix a signed/unsigned comparison warningJoão Abecasis2009-11-061-1/+1
| |
* | Merge commit 'origin/4.6' into large-file-supportJoão Abecasis2009-11-053-89/+133
|\ \
| * \ Merge commit 'e4bec39a139363d1ee4cf3fb15a3fe4499215e77' into 4.6Thiago Macieira2009-11-021-4/+14
| |\ \ | | |/
| | * Merge remote branch 'origin/4.6' into core-4.6Thiago Macieira2009-10-291-73/+103
| | |\
| | * | Make QProcess report errors from a failed subprocess start.Thiago Macieira2009-10-271-4/+14
| | | | | | | | | | | | | | | | Reviewed-by: João Abecasis
| * | | Merge branch '4.6-s60' into 4.6axis2009-10-301-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
| * | Import a new implementation of fromUserInput.Thiago Macieira2009-10-291-0/+57
| | | | | | | | | | | | | | | | | | Imported from http://github.com/icefox/guessurlfromstring Licensed under the 3-clause BSD license by the copyright holder.
| * | Remove the fromUserInput implementation and tests.Thiago Macieira2009-10-291-73/+46
| |/ | | | | | | Reviewed-by: Trust Me
* | Updating documentation to reflect actual behaviorJoão Abecasis2009-11-041-9/+11
| | | | | | | | | | | | | | | | QFile::seek is supposed to work on Windows CE with FILE* streams. size() returns 0 on errors and sequential files. Probably on empty files as well ;-) Reviewed-by: Olivier Goffart
* | Further fixes to file size handling on Windows with fd and FILE*João Abecasis2009-11-041-17/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | filelength is not available on Windows CE instead, we must fallback to fseek/ftell as was being done previously. Still on Windows CE, we still don't report the file size for file descriptors, but we also won't set a random error string. Changed qt_error_string calls to use errno when errors come from CRT functions. Also, if we're using filelength on FILE* streams, there's no reason not to use it for file descriptors, instead of requesting a native handle. Reviewed-by: Olivier Goffart
* | Don't try to mmap past EOFJoão Abecasis2009-10-281-0/+6
| | | | | | | | | | | | | | | | | | | | On Mac OS, mmap would succeed, returning a valid pointer, but trying to read from it would result in a SIGBUS. By adding this check we commit to a safe cross-platform behavior users can depend on. Reviewed-by: Thiago Macieira
* | Fix silly error in bit fiddlingJoão Abecasis2009-10-261-1/+1
| | | | | | | | | | | | | | That's what I get for not having the brain on when accepting suggestions... Reviewed-by: Thiago Macieira