summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-01-13 18:55:05 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-01-13 18:55:05 (GMT)
commit7d1e48639d6d3897e66779f22fe02d17d6c38707 (patch)
tree7abc16568274e1f54c976f890e92d73f7a00160c /src/corelib/io
parent20e0e7a849d70139f9106f60c78fd0c736ec3c4b (diff)
parente1b03bac22f87edbbe78eba366966259be6eb0ed (diff)
downloadQt-7d1e48639d6d3897e66779f22fe02d17d6c38707.zip
Qt-7d1e48639d6d3897e66779f22fe02d17d6c38707.tar.gz
Qt-7d1e48639d6d3897e66779f22fe02d17d6c38707.tar.bz2
Merge branch '4.6'
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
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qabstractfileengine.cpp2
-rw-r--r--src/corelib/io/qabstractfileengine.h2
-rw-r--r--src/corelib/io/qabstractfileengine_p.h2
-rw-r--r--src/corelib/io/qbuffer.cpp2
-rw-r--r--src/corelib/io/qbuffer.h2
-rw-r--r--src/corelib/io/qdatastream.cpp16
-rw-r--r--src/corelib/io/qdatastream.h2
-rw-r--r--src/corelib/io/qdatastream_p.h2
-rw-r--r--src/corelib/io/qdebug.cpp2
-rw-r--r--src/corelib/io/qdebug.h2
-rw-r--r--src/corelib/io/qdir.cpp2
-rw-r--r--src/corelib/io/qdir.h2
-rw-r--r--src/corelib/io/qdiriterator.cpp2
-rw-r--r--src/corelib/io/qdiriterator.h2
-rw-r--r--src/corelib/io/qfile.cpp21
-rw-r--r--src/corelib/io/qfile.h2
-rw-r--r--src/corelib/io/qfile_p.h2
-rw-r--r--src/corelib/io/qfileinfo.cpp2
-rw-r--r--src/corelib/io/qfileinfo.h2
-rw-r--r--src/corelib/io/qfileinfo_p.h2
-rw-r--r--src/corelib/io/qfilesystemwatcher.cpp2
-rw-r--r--src/corelib/io/qfilesystemwatcher.h2
-rw-r--r--src/corelib/io/qfilesystemwatcher_dnotify.cpp2
-rw-r--r--src/corelib/io/qfilesystemwatcher_dnotify_p.h2
-rw-r--r--src/corelib/io/qfilesystemwatcher_fsevents.cpp2
-rw-r--r--src/corelib/io/qfilesystemwatcher_fsevents_p.h2
-rw-r--r--src/corelib/io/qfilesystemwatcher_inotify.cpp2
-rw-r--r--src/corelib/io/qfilesystemwatcher_inotify_p.h2
-rw-r--r--src/corelib/io/qfilesystemwatcher_kqueue.cpp2
-rw-r--r--src/corelib/io/qfilesystemwatcher_kqueue_p.h2
-rw-r--r--src/corelib/io/qfilesystemwatcher_p.h2
-rw-r--r--src/corelib/io/qfilesystemwatcher_symbian.cpp2
-rw-r--r--src/corelib/io/qfilesystemwatcher_symbian_p.h2
-rw-r--r--src/corelib/io/qfilesystemwatcher_win.cpp2
-rw-r--r--src/corelib/io/qfilesystemwatcher_win_p.h2
-rw-r--r--src/corelib/io/qfsfileengine.cpp2
-rw-r--r--src/corelib/io/qfsfileengine.h2
-rw-r--r--src/corelib/io/qfsfileengine_iterator.cpp2
-rw-r--r--src/corelib/io/qfsfileengine_iterator_p.h2
-rw-r--r--src/corelib/io/qfsfileengine_iterator_unix.cpp2
-rw-r--r--src/corelib/io/qfsfileengine_iterator_win.cpp2
-rw-r--r--src/corelib/io/qfsfileengine_p.h2
-rw-r--r--src/corelib/io/qfsfileengine_unix.cpp2
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp80
-rw-r--r--src/corelib/io/qiodevice.cpp7
-rw-r--r--src/corelib/io/qiodevice.h2
-rw-r--r--src/corelib/io/qiodevice_p.h2
-rw-r--r--src/corelib/io/qnoncontiguousbytedevice.cpp2
-rw-r--r--src/corelib/io/qnoncontiguousbytedevice_p.h2
-rw-r--r--src/corelib/io/qprocess.cpp2
-rw-r--r--src/corelib/io/qprocess.h2
-rw-r--r--src/corelib/io/qprocess_p.h2
-rw-r--r--src/corelib/io/qprocess_symbian.cpp2
-rw-r--r--src/corelib/io/qprocess_unix.cpp2
-rw-r--r--src/corelib/io/qprocess_win.cpp2
-rw-r--r--src/corelib/io/qresource.cpp4
-rw-r--r--src/corelib/io/qresource.h2
-rw-r--r--src/corelib/io/qresource_iterator.cpp2
-rw-r--r--src/corelib/io/qresource_iterator_p.h2
-rw-r--r--src/corelib/io/qresource_p.h2
-rw-r--r--src/corelib/io/qsettings.cpp2
-rw-r--r--src/corelib/io/qsettings.h2
-rw-r--r--src/corelib/io/qsettings_mac.cpp2
-rw-r--r--src/corelib/io/qsettings_p.h2
-rw-r--r--src/corelib/io/qsettings_win.cpp2
-rw-r--r--src/corelib/io/qtemporaryfile.cpp2
-rw-r--r--src/corelib/io/qtemporaryfile.h2
-rw-r--r--src/corelib/io/qtextstream.cpp2
-rw-r--r--src/corelib/io/qtextstream.h2
-rw-r--r--src/corelib/io/qurl.cpp148
-rw-r--r--src/corelib/io/qurl.h2
-rw-r--r--src/corelib/io/qwindowspipewriter.cpp2
-rw-r--r--src/corelib/io/qwindowspipewriter_p.h2
73 files changed, 267 insertions, 143 deletions
diff --git a/src/corelib/io/qabstractfileengine.cpp b/src/corelib/io/qabstractfileengine.cpp
index 7f52f31..e239ee9 100644
--- a/src/corelib/io/qabstractfileengine.cpp
+++ b/src/corelib/io/qabstractfileengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qabstractfileengine.h b/src/corelib/io/qabstractfileengine.h
index a867ed7..8ca831a 100644
--- a/src/corelib/io/qabstractfileengine.h
+++ b/src/corelib/io/qabstractfileengine.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qabstractfileengine_p.h b/src/corelib/io/qabstractfileengine_p.h
index f4d7638..e1eba30 100644
--- a/src/corelib/io/qabstractfileengine_p.h
+++ b/src/corelib/io/qabstractfileengine_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qbuffer.cpp b/src/corelib/io/qbuffer.cpp
index 556cf27..c1ff353 100644
--- a/src/corelib/io/qbuffer.cpp
+++ b/src/corelib/io/qbuffer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qbuffer.h b/src/corelib/io/qbuffer.h
index ab630de..ecbd934 100644
--- a/src/corelib/io/qbuffer.h
+++ b/src/corelib/io/qbuffer.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp
index e6cda93..27f7632 100644
--- a/src/corelib/io/qdatastream.cpp
+++ b/src/corelib/io/qdatastream.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -593,15 +593,17 @@ void QDataStream::setByteOrder(ByteOrder bo)
recommend that you do; see \l{Versioning} in the Detailed
Description.
- In order to accommodate new functionality, the datastream
- serialization format of some Qt classes has changed in some
- versions of Qt. If you want to read data that was created by an
- earlier version of Qt, or write data that can be read by a
- program that was compiled with an earlier version of Qt, use this
- function to modify the serialization format used by QDataStream.
+ To accommodate new functionality, the datastream serialization
+ format of some Qt classes has changed in some versions of Qt. If
+ you want to read data that was created by an earlier version of
+ Qt, or write data that can be read by a program that was compiled
+ with an earlier version of Qt, use this function to modify the
+ serialization format used by QDataStream.
\table
\header \i Qt Version \i QDataStream Version
+ \row \i Qt 4.6 \i 12
+ \row \i Qt 4.5 \i 11
\row \i Qt 4.4 \i 10
\row \i Qt 4.3 \i 9
\row \i Qt 4.2 \i 8
diff --git a/src/corelib/io/qdatastream.h b/src/corelib/io/qdatastream.h
index cf7633f..ec4ba2f 100644
--- a/src/corelib/io/qdatastream.h
+++ b/src/corelib/io/qdatastream.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qdatastream_p.h b/src/corelib/io/qdatastream_p.h
index 98dd21f..73f73ee 100644
--- a/src/corelib/io/qdatastream_p.h
+++ b/src/corelib/io/qdatastream_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp
index ce24351..9c54416 100644
--- a/src/corelib/io/qdebug.cpp
+++ b/src/corelib/io/qdebug.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h
index c1c7812..1c68716 100644
--- a/src/corelib/io/qdebug.h
+++ b/src/corelib/io/qdebug.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index bac508a..dc7f17e 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qdir.h b/src/corelib/io/qdir.h
index d2b8f0a..6be4922 100644
--- a/src/corelib/io/qdir.h
+++ b/src/corelib/io/qdir.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp
index 6247b00..860fb63 100644
--- a/src/corelib/io/qdiriterator.cpp
+++ b/src/corelib/io/qdiriterator.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qdiriterator.h b/src/corelib/io/qdiriterator.h
index ae8f99c..6c4e4aa 100644
--- a/src/corelib/io/qdiriterator.h
+++ b/src/corelib/io/qdiriterator.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp
index d4077bc..6395cc7 100644
--- a/src/corelib/io/qfile.cpp
+++ b/src/corelib/io/qfile.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -968,9 +968,6 @@ bool QFile::isSequential() const
mode, if the relevant file does not already exist, this function
will try to create a new file before opening it.
- \note Because of limitations in the native API, QFile ignores the
- Unbuffered flag on Windows.
-
\sa QIODevice::OpenMode, setFileName()
*/
bool QFile::open(OpenMode mode)
@@ -988,7 +985,9 @@ bool QFile::open(OpenMode mode)
qWarning("QIODevice::open: File access not specified");
return false;
}
- if (fileEngine()->open(mode)) {
+
+ // QIODevice provides the buffering, so there's no need to request it from the file engine.
+ if (fileEngine()->open(mode | QIODevice::Unbuffered)) {
QIODevice::open(mode);
if (mode & Append)
seek(size());
@@ -1387,11 +1386,17 @@ QFile::close()
Q_D(QFile);
if(!isOpen())
return;
- flush();
+ bool flushed = flush();
QIODevice::close();
- unsetError();
- if(!fileEngine()->close())
+ // reset write buffer
+ d->lastWasWrite = false;
+ d->writeBuffer.clear();
+
+ // keep earlier error from flush
+ if (fileEngine()->close() && flushed)
+ unsetError();
+ else if (flushed)
d->setError(fileEngine()->error(), fileEngine()->errorString());
}
diff --git a/src/corelib/io/qfile.h b/src/corelib/io/qfile.h
index f65c845..212576c 100644
--- a/src/corelib/io/qfile.h
+++ b/src/corelib/io/qfile.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfile_p.h b/src/corelib/io/qfile_p.h
index d7a37bf..f8f5f5c 100644
--- a/src/corelib/io/qfile_p.h
+++ b/src/corelib/io/qfile_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp
index 0a435b9..b4437db 100644
--- a/src/corelib/io/qfileinfo.cpp
+++ b/src/corelib/io/qfileinfo.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfileinfo.h b/src/corelib/io/qfileinfo.h
index 367c250..7e82aed 100644
--- a/src/corelib/io/qfileinfo.h
+++ b/src/corelib/io/qfileinfo.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfileinfo_p.h b/src/corelib/io/qfileinfo_p.h
index f92daa5..065f860 100644
--- a/src/corelib/io/qfileinfo_p.h
+++ b/src/corelib/io/qfileinfo_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp
index e9f413c..7223e49 100644
--- a/src/corelib/io/qfilesystemwatcher.cpp
+++ b/src/corelib/io/qfilesystemwatcher.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfilesystemwatcher.h b/src/corelib/io/qfilesystemwatcher.h
index 9be9bdd..f957d2a 100644
--- a/src/corelib/io/qfilesystemwatcher.h
+++ b/src/corelib/io/qfilesystemwatcher.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfilesystemwatcher_dnotify.cpp b/src/corelib/io/qfilesystemwatcher_dnotify.cpp
index c70232c..1a218c7 100644
--- a/src/corelib/io/qfilesystemwatcher_dnotify.cpp
+++ b/src/corelib/io/qfilesystemwatcher_dnotify.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfilesystemwatcher_dnotify_p.h b/src/corelib/io/qfilesystemwatcher_dnotify_p.h
index e6783c0..ec6bc3f 100644
--- a/src/corelib/io/qfilesystemwatcher_dnotify_p.h
+++ b/src/corelib/io/qfilesystemwatcher_dnotify_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfilesystemwatcher_fsevents.cpp b/src/corelib/io/qfilesystemwatcher_fsevents.cpp
index bbf7f99..54ae24e 100644
--- a/src/corelib/io/qfilesystemwatcher_fsevents.cpp
+++ b/src/corelib/io/qfilesystemwatcher_fsevents.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfilesystemwatcher_fsevents_p.h b/src/corelib/io/qfilesystemwatcher_fsevents_p.h
index cafa6c9..b0462b6 100644
--- a/src/corelib/io/qfilesystemwatcher_fsevents_p.h
+++ b/src/corelib/io/qfilesystemwatcher_fsevents_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp
index 281b2dd..a7dc8fa 100644
--- a/src/corelib/io/qfilesystemwatcher_inotify.cpp
+++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfilesystemwatcher_inotify_p.h b/src/corelib/io/qfilesystemwatcher_inotify_p.h
index fcc9343..4c52afa 100644
--- a/src/corelib/io/qfilesystemwatcher_inotify_p.h
+++ b/src/corelib/io/qfilesystemwatcher_inotify_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfilesystemwatcher_kqueue.cpp b/src/corelib/io/qfilesystemwatcher_kqueue.cpp
index 7ceed27..f088ded 100644
--- a/src/corelib/io/qfilesystemwatcher_kqueue.cpp
+++ b/src/corelib/io/qfilesystemwatcher_kqueue.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfilesystemwatcher_kqueue_p.h b/src/corelib/io/qfilesystemwatcher_kqueue_p.h
index 9efa738..eda646b 100644
--- a/src/corelib/io/qfilesystemwatcher_kqueue_p.h
+++ b/src/corelib/io/qfilesystemwatcher_kqueue_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfilesystemwatcher_p.h b/src/corelib/io/qfilesystemwatcher_p.h
index 32ab21c..e7775a4 100644
--- a/src/corelib/io/qfilesystemwatcher_p.h
+++ b/src/corelib/io/qfilesystemwatcher_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfilesystemwatcher_symbian.cpp b/src/corelib/io/qfilesystemwatcher_symbian.cpp
index d738c18..69daae7 100644
--- a/src/corelib/io/qfilesystemwatcher_symbian.cpp
+++ b/src/corelib/io/qfilesystemwatcher_symbian.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfilesystemwatcher_symbian_p.h b/src/corelib/io/qfilesystemwatcher_symbian_p.h
index edba47c..7e3f045 100644
--- a/src/corelib/io/qfilesystemwatcher_symbian_p.h
+++ b/src/corelib/io/qfilesystemwatcher_symbian_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfilesystemwatcher_win.cpp b/src/corelib/io/qfilesystemwatcher_win.cpp
index 87fe630..249ce0f 100644
--- a/src/corelib/io/qfilesystemwatcher_win.cpp
+++ b/src/corelib/io/qfilesystemwatcher_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfilesystemwatcher_win_p.h b/src/corelib/io/qfilesystemwatcher_win_p.h
index 5bf63c4..7d8ab2a 100644
--- a/src/corelib/io/qfilesystemwatcher_win_p.h
+++ b/src/corelib/io/qfilesystemwatcher_win_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp
index b4611f1..1672dfc 100644
--- a/src/corelib/io/qfsfileengine.cpp
+++ b/src/corelib/io/qfsfileengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfsfileengine.h b/src/corelib/io/qfsfileengine.h
index 48063af..6b077ed 100644
--- a/src/corelib/io/qfsfileengine.h
+++ b/src/corelib/io/qfsfileengine.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfsfileengine_iterator.cpp b/src/corelib/io/qfsfileengine_iterator.cpp
index 059f9b5..7e7d70a 100644
--- a/src/corelib/io/qfsfileengine_iterator.cpp
+++ b/src/corelib/io/qfsfileengine_iterator.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfsfileengine_iterator_p.h b/src/corelib/io/qfsfileengine_iterator_p.h
index f87d668..be670e0 100644
--- a/src/corelib/io/qfsfileengine_iterator_p.h
+++ b/src/corelib/io/qfsfileengine_iterator_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfsfileengine_iterator_unix.cpp b/src/corelib/io/qfsfileengine_iterator_unix.cpp
index adfe47c..b68b1a1 100644
--- a/src/corelib/io/qfsfileengine_iterator_unix.cpp
+++ b/src/corelib/io/qfsfileengine_iterator_unix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfsfileengine_iterator_win.cpp b/src/corelib/io/qfsfileengine_iterator_win.cpp
index 67da066..7181025 100644
--- a/src/corelib/io/qfsfileengine_iterator_win.cpp
+++ b/src/corelib/io/qfsfileengine_iterator_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h
index 41a6a1b..0f63eb8 100644
--- a/src/corelib/io/qfsfileengine_p.h
+++ b/src/corelib/io/qfsfileengine_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp
index ea262bf..722d6d3 100644
--- a/src/corelib/io/qfsfileengine_unix.cpp
+++ b/src/corelib/io/qfsfileengine_unix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index 9f336a6..eb99f27 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1414,22 +1414,20 @@ QAbstractFileEngine::FileFlags QFSFileEnginePrivate::getPermissions() const
#if !defined(QT_NO_LIBRARY)
if((qt_ntfs_permission_lookup > 0) && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)) {
- PSID pOwner = 0;
- PSID pGroup = 0;
- PACL pDacl;
- PSECURITY_DESCRIPTOR pSD;
- ACCESS_MASK access_mask;
-
- enum { ReadMask = 0x00000001, WriteMask = 0x00000002, ExecMask = 0x00000020 };
resolveLibs();
if(ptrGetNamedSecurityInfoW && ptrBuildTrusteeWithSidW && ptrGetEffectiveRightsFromAclW) {
+ enum { ReadMask = 0x00000001, WriteMask = 0x00000002, ExecMask = 0x00000020 };
QString fname = filePath.endsWith(QLatin1String(".lnk")) ? readLink(filePath) : filePath;
+ PSID pOwner = 0;
+ PSID pGroup = 0;
+ PACL pDacl;
+ PSECURITY_DESCRIPTOR pSD;
DWORD res = ptrGetNamedSecurityInfoW((wchar_t*)fname.utf16(), SE_FILE_OBJECT,
OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION,
&pOwner, &pGroup, &pDacl, 0, &pSD);
-
if(res == ERROR_SUCCESS) {
+ ACCESS_MASK access_mask;
TRUSTEE_W trustee;
{ //user
if(ptrGetEffectiveRightsFromAclW(pDacl, &currentUserTrusteeW, &access_mask) != ERROR_SUCCESS)
@@ -1715,40 +1713,50 @@ uint QFSFileEngine::ownerId(FileOwner /*own*/) const
QString QFSFileEngine::owner(FileOwner own) const
{
+ QString name;
#if !defined(QT_NO_LIBRARY)
Q_D(const QFSFileEngine);
if((qt_ntfs_permission_lookup > 0) && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)) {
- PSID pOwner = 0;
- PSECURITY_DESCRIPTOR pSD;
- QString name;
- QFSFileEnginePrivate::resolveLibs();
-
- if(ptrGetNamedSecurityInfoW && ptrLookupAccountSidW) {
- if(ptrGetNamedSecurityInfoW((wchar_t*)d->filePath.utf16(), SE_FILE_OBJECT,
- own == OwnerGroup ? GROUP_SECURITY_INFORMATION : OWNER_SECURITY_INFORMATION,
- NULL, &pOwner, NULL, NULL, &pSD) == ERROR_SUCCESS) {
- DWORD lowner = 0, ldomain = 0;
- SID_NAME_USE use;
- // First call, to determine size of the strings (with '\0').
- ptrLookupAccountSidW(NULL, pOwner, NULL, &lowner, NULL, &ldomain, (SID_NAME_USE*)&use);
- wchar_t *owner = new wchar_t[lowner];
- wchar_t *domain = new wchar_t[ldomain];
- // Second call, size is without '\0'
- if(ptrLookupAccountSidW(NULL, pOwner, (LPWSTR)owner, &lowner,
- (LPWSTR)domain, &ldomain, (SID_NAME_USE*)&use)) {
- name = QString::fromUtf16((ushort*)owner);
- }
- LocalFree(pSD);
- delete [] owner;
- delete [] domain;
- }
- }
- return name;
+ QFSFileEnginePrivate::resolveLibs();
+ if (ptrGetNamedSecurityInfoW && ptrLookupAccountSidW) {
+ PSID pOwner = 0;
+ PSECURITY_DESCRIPTOR pSD;
+ if (ptrGetNamedSecurityInfoW((wchar_t*)d->filePath.utf16(), SE_FILE_OBJECT,
+ own == OwnerGroup ? GROUP_SECURITY_INFORMATION : OWNER_SECURITY_INFORMATION,
+ own == OwnerUser ? &pOwner : 0, own == OwnerGroup ? &pOwner : 0,
+ 0, 0, &pSD) == ERROR_SUCCESS) {
+ DWORD lowner = 64;
+ DWORD ldomain = 64;
+ QVarLengthArray<wchar_t, 64> owner(lowner);
+ QVarLengthArray<wchar_t, 64> domain(ldomain);
+ SID_NAME_USE use = SidTypeUnknown;
+ // First call, to determine size of the strings (with '\0').
+ if (!ptrLookupAccountSidW(NULL, pOwner, (LPWSTR)owner.data(), &lowner,
+ (LPWSTR)domain.data(), &ldomain, (SID_NAME_USE*)&use)) {
+ if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+ if (lowner > (DWORD)owner.size())
+ owner.resize(lowner);
+ if (ldomain > (DWORD)domain.size())
+ domain.resize(ldomain);
+ // Second call, try on resized buf-s
+ if (!ptrLookupAccountSidW(NULL, pOwner, (LPWSTR)owner.data(), &lowner,
+ (LPWSTR)domain.data(), &ldomain, (SID_NAME_USE*)&use)) {
+ lowner = 0;
+ }
+ } else {
+ lowner = 0;
+ }
+ }
+ if (lowner != 0)
+ name = QString::fromWCharArray(owner.data());
+ LocalFree(pSD);
+ }
+ }
}
#else
Q_UNUSED(own);
#endif
- return QString();
+ return name;
}
bool QFSFileEngine::setPermissions(uint perms)
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index 8dcccb4..4e14ba8 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -970,6 +970,7 @@ QByteArray QIODevice::readAll()
if (!(d->openMode & Text) && !d->buffer.isEmpty()) {
result = d->buffer.readAll();
readBytes = result.size();
+ d->pos += readBytes;
}
qint64 theSize;
@@ -985,8 +986,8 @@ QByteArray QIODevice::readAll()
} else {
// Read it all in one go.
// If resize fails, don't read anything.
- result.resize(int(theSize - d->pos));
- readBytes = read(result.data(), result.size());
+ result.resize(int(readBytes + theSize - d->pos));
+ readBytes += read(result.data() + readBytes, result.size() - readBytes);
}
if (readBytes <= 0)
diff --git a/src/corelib/io/qiodevice.h b/src/corelib/io/qiodevice.h
index 60ca74c..2f40e66 100644
--- a/src/corelib/io/qiodevice.h
+++ b/src/corelib/io/qiodevice.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qiodevice_p.h b/src/corelib/io/qiodevice_p.h
index f6cbcc7..cc4a237 100644
--- a/src/corelib/io/qiodevice_p.h
+++ b/src/corelib/io/qiodevice_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qnoncontiguousbytedevice.cpp b/src/corelib/io/qnoncontiguousbytedevice.cpp
index a4f59f7..553312c 100644
--- a/src/corelib/io/qnoncontiguousbytedevice.cpp
+++ b/src/corelib/io/qnoncontiguousbytedevice.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qnoncontiguousbytedevice_p.h b/src/corelib/io/qnoncontiguousbytedevice_p.h
index 34d6980..ebd6e24 100644
--- a/src/corelib/io/qnoncontiguousbytedevice_p.h
+++ b/src/corelib/io/qnoncontiguousbytedevice_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index c78af3c..12a992a 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qprocess.h b/src/corelib/io/qprocess.h
index ffcd5de..f84b855 100644
--- a/src/corelib/io/qprocess.h
+++ b/src/corelib/io/qprocess.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h
index 09be544..60b7b5a 100644
--- a/src/corelib/io/qprocess_p.h
+++ b/src/corelib/io/qprocess_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qprocess_symbian.cpp b/src/corelib/io/qprocess_symbian.cpp
index 1f5117f..ddced73 100644
--- a/src/corelib/io/qprocess_symbian.cpp
+++ b/src/corelib/io/qprocess_symbian.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index f040d16..0bf7d3f 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index dee0162..f3fc28e 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp
index a061ad1..adfbb15 100644
--- a/src/corelib/io/qresource.cpp
+++ b/src/corelib/io/qresource.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1285,7 +1285,7 @@ bool QResourceFileEngine::close()
bool QResourceFileEngine::flush()
{
- return false;
+ return true;
}
qint64 QResourceFileEngine::read(char *data, qint64 len)
diff --git a/src/corelib/io/qresource.h b/src/corelib/io/qresource.h
index 13cd436..cae1989 100644
--- a/src/corelib/io/qresource.h
+++ b/src/corelib/io/qresource.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qresource_iterator.cpp b/src/corelib/io/qresource_iterator.cpp
index e58018c..d5fe828 100644
--- a/src/corelib/io/qresource_iterator.cpp
+++ b/src/corelib/io/qresource_iterator.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qresource_iterator_p.h b/src/corelib/io/qresource_iterator_p.h
index 2047180..67f7ed5 100644
--- a/src/corelib/io/qresource_iterator_p.h
+++ b/src/corelib/io/qresource_iterator_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qresource_p.h b/src/corelib/io/qresource_p.h
index b63ed30..9c49cc6 100644
--- a/src/corelib/io/qresource_p.h
+++ b/src/corelib/io/qresource_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index a1c9833..2c31509 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qsettings.h b/src/corelib/io/qsettings.h
index de33156..38010bf 100644
--- a/src/corelib/io/qsettings.h
+++ b/src/corelib/io/qsettings.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp
index 8fcaccc..38ab585 100644
--- a/src/corelib/io/qsettings_mac.cpp
+++ b/src/corelib/io/qsettings_mac.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qsettings_p.h b/src/corelib/io/qsettings_p.h
index 5ad72e4..ec345be 100644
--- a/src/corelib/io/qsettings_p.h
+++ b/src/corelib/io/qsettings_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp
index f38d72c..de96e06 100644
--- a/src/corelib/io/qsettings_win.cpp
+++ b/src/corelib/io/qsettings_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp
index f9e75aa..c34c4a4 100644
--- a/src/corelib/io/qtemporaryfile.cpp
+++ b/src/corelib/io/qtemporaryfile.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qtemporaryfile.h b/src/corelib/io/qtemporaryfile.h
index 67b4704..2270a1f 100644
--- a/src/corelib/io/qtemporaryfile.h
+++ b/src/corelib/io/qtemporaryfile.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp
index 47f340c..9e79894 100644
--- a/src/corelib/io/qtextstream.cpp
+++ b/src/corelib/io/qtextstream.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qtextstream.h b/src/corelib/io/qtextstream.h
index 463924a..d82da59 100644
--- a/src/corelib/io/qtextstream.h
+++ b/src/corelib/io/qtextstream.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 6ac6468..74e5f74 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -350,8 +350,8 @@ public:
};
int stateFlags;
- QByteArray encodedNormalized;
- const QByteArray & normalized();
+ mutable QByteArray encodedNormalized;
+ const QByteArray & normalized() const;
mutable QUrlErrorInfo errorInfo;
QString createErrorString();
@@ -3850,6 +3850,9 @@ QByteArray QUrlPrivate::toEncoded(QUrl::FormattingOptions options) const
if (!QURL_HASFLAG(stateFlags, Parsed)) parse();
else ensureEncodedParts();
+ if (options==0x100) // private - see qHash(QUrl)
+ return normalized();
+
QByteArray url;
if (!(options & QUrl::RemoveScheme) && !scheme.isEmpty()) {
@@ -3920,12 +3923,13 @@ QByteArray QUrlPrivate::toEncoded(QUrl::FormattingOptions options) const
#define qToLower(ch) (((ch|32) >= 'a' && (ch|32) <= 'z') ? (ch|32) : ch)
-const QByteArray &QUrlPrivate::normalized()
+const QByteArray &QUrlPrivate::normalized() const
{
if (QURL_HASFLAG(stateFlags, QUrlPrivate::Normalized))
return encodedNormalized;
- QURL_SETFLAG(stateFlags, QUrlPrivate::Normalized);
+ QUrlPrivate *that = const_cast<QUrlPrivate *>(this);
+ QURL_SETFLAG(that->stateFlags, QUrlPrivate::Normalized);
QUrlPrivate tmp = *this;
tmp.scheme = tmp.scheme.toLower();
@@ -4074,7 +4078,7 @@ QString QUrlPrivate::createErrorString()
\sa setUrl(), setEncodedUrl(), fromEncoded(), TolerantMode
*/
-QUrl::QUrl(const QString &url) : d(new QUrlPrivate)
+QUrl::QUrl(const QString &url) : d(0)
{
if (!url.isEmpty())
setUrl(url);
@@ -4087,18 +4091,20 @@ QUrl::QUrl(const QString &url) : d(new QUrlPrivate)
\sa setUrl()
*/
-QUrl::QUrl(const QString &url, ParsingMode parsingMode) : d(new QUrlPrivate)
+QUrl::QUrl(const QString &url, ParsingMode parsingMode) : d(0)
{
if (!url.isEmpty())
setUrl(url, parsingMode);
- else
+ else {
+ d = new QUrlPrivate;
d->parsingMode = parsingMode;
+ }
}
/*!
Constructs an empty QUrl object.
*/
-QUrl::QUrl() : d(new QUrlPrivate)
+QUrl::QUrl() : d(0)
{
}
@@ -4107,7 +4113,8 @@ QUrl::QUrl() : d(new QUrlPrivate)
*/
QUrl::QUrl(const QUrl &other) : d(other.d)
{
- d->ref.ref();
+ if (d)
+ d->ref.ref();
}
/*!
@@ -4115,7 +4122,7 @@ QUrl::QUrl(const QUrl &other) : d(other.d)
*/
QUrl::~QUrl()
{
- if (!d->ref.deref())
+ if (d && !d->ref.deref())
delete d;
}
@@ -4130,6 +4137,8 @@ QUrl::~QUrl()
*/
bool QUrl::isValid() const
{
+ if (!d) return false;
+
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Validated)) d->validate();
@@ -4141,6 +4150,8 @@ bool QUrl::isValid() const
*/
bool QUrl::isEmpty() const
{
+ if (!d) return true;
+
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed))
return d->encodedOriginal.isEmpty();
else
@@ -4161,8 +4172,9 @@ bool QUrl::isEmpty() const
*/
void QUrl::clear()
{
- detach();
- d->clear();
+ if (d && !d->ref.deref())
+ delete d;
+ d = 0;
}
/*!
@@ -4261,8 +4273,9 @@ static inline char toHex(quint8 c)
*/
void QUrl::setEncodedUrl(const QByteArray &encodedUrl, ParsingMode parsingMode)
{
- clear();
QByteArray tmp = encodedUrl;
+ if (!d) d = new QUrlPrivate;
+ else d->clear();
if ((d->parsingMode = parsingMode) == TolerantMode) {
// Replace stray % with %25
QByteArray copy = tmp;
@@ -4336,6 +4349,7 @@ void QUrl::setEncodedUrl(const QByteArray &encodedUrl, ParsingMode parsingMode)
*/
void QUrl::setScheme(const QString &scheme)
{
+ if (!d) d = new QUrlPrivate;
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized);
@@ -4351,6 +4365,7 @@ void QUrl::setScheme(const QString &scheme)
*/
QString QUrl::scheme() const
{
+ if (!d) return QString();
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
return d->scheme;
@@ -4374,6 +4389,8 @@ QString QUrl::scheme() const
*/
void QUrl::setAuthority(const QString &authority)
{
+ if (!d) d = new QUrlPrivate;
+
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized);
@@ -4389,6 +4406,8 @@ void QUrl::setAuthority(const QString &authority)
*/
QString QUrl::authority() const
{
+ if (!d) return QString();
+
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
return d->authority();
@@ -4409,6 +4428,8 @@ QString QUrl::authority() const
*/
void QUrl::setUserInfo(const QString &userInfo)
{
+ if (!d) d = new QUrlPrivate;
+
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized);
@@ -4422,6 +4443,8 @@ void QUrl::setUserInfo(const QString &userInfo)
*/
QString QUrl::userInfo() const
{
+ if (!d) return QString();
+
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
return d->userInfo();
@@ -4436,6 +4459,8 @@ QString QUrl::userInfo() const
*/
void QUrl::setUserName(const QString &userName)
{
+ if (!d) d = new QUrlPrivate;
+
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized);
@@ -4452,6 +4477,8 @@ void QUrl::setUserName(const QString &userName)
*/
QString QUrl::userName() const
{
+ if (!d) return QString();
+
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
d->userInfo(); // causes the unencoded form to be set
@@ -4473,6 +4500,7 @@ QString QUrl::userName() const
*/
void QUrl::setEncodedUserName(const QByteArray &userName)
{
+ if (!d) d = new QUrlPrivate;
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized);
@@ -4493,6 +4521,7 @@ void QUrl::setEncodedUserName(const QByteArray &userName)
*/
QByteArray QUrl::encodedUserName() const
{
+ if (!d) return QByteArray();
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
d->ensureEncodedParts();
@@ -4508,6 +4537,7 @@ QByteArray QUrl::encodedUserName() const
*/
void QUrl::setPassword(const QString &password)
{
+ if (!d) d = new QUrlPrivate;
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized);
@@ -4524,6 +4554,7 @@ void QUrl::setPassword(const QString &password)
*/
QString QUrl::password() const
{
+ if (!d) return QString();
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
d->userInfo(); // causes the unencoded form to be set
@@ -4545,6 +4576,7 @@ QString QUrl::password() const
*/
void QUrl::setEncodedPassword(const QByteArray &password)
{
+ if (!d) d = new QUrlPrivate;
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized);
@@ -4565,6 +4597,7 @@ void QUrl::setEncodedPassword(const QByteArray &password)
*/
QByteArray QUrl::encodedPassword() const
{
+ if (!d) return QByteArray();
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
d->ensureEncodedParts();
@@ -4579,6 +4612,7 @@ QByteArray QUrl::encodedPassword() const
*/
void QUrl::setHost(const QString &host)
{
+ if (!d) d = new QUrlPrivate;
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized | QUrlPrivate::HostCanonicalized);
@@ -4592,6 +4626,7 @@ void QUrl::setHost(const QString &host)
*/
QString QUrl::host() const
{
+ if (!d) return QString();
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
if (d->host.isEmpty() || d->host.at(0) != QLatin1Char('['))
@@ -4645,6 +4680,7 @@ QByteArray QUrl::encodedHost() const
*/
void QUrl::setPort(int port)
{
+ if (!d) d = new QUrlPrivate;
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized);
@@ -4662,6 +4698,7 @@ void QUrl::setPort(int port)
*/
int QUrl::port() const
{
+ if (!d) return -1;
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Validated)) d->validate();
return d->port;
@@ -4680,6 +4717,7 @@ int QUrl::port() const
*/
int QUrl::port(int defaultPort) const
{
+ if (!d) return defaultPort;
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
return d->port == -1 ? defaultPort : d->port;
}
@@ -4699,6 +4737,7 @@ int QUrl::port(int defaultPort) const
*/
void QUrl::setPath(const QString &path)
{
+ if (!d) d = new QUrlPrivate;
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized);
@@ -4714,6 +4753,7 @@ void QUrl::setPath(const QString &path)
*/
QString QUrl::path() const
{
+ if (!d) return QString();
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
if (d->path.isNull()) {
@@ -4745,6 +4785,7 @@ QString QUrl::path() const
*/
void QUrl::setEncodedPath(const QByteArray &path)
{
+ if (!d) d = new QUrlPrivate;
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized);
@@ -4765,6 +4806,7 @@ void QUrl::setEncodedPath(const QByteArray &path)
*/
QByteArray QUrl::encodedPath() const
{
+ if (!d) return QByteArray();
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
d->ensureEncodedParts();
@@ -4780,6 +4822,7 @@ QByteArray QUrl::encodedPath() const
*/
bool QUrl::hasQuery() const
{
+ if (!d) return false;
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
return d->hasQuery;
@@ -4809,6 +4852,7 @@ bool QUrl::hasQuery() const
*/
void QUrl::setQueryDelimiters(char valueDelimiter, char pairDelimiter)
{
+ if (!d) d = new QUrlPrivate;
detach();
d->valueDelimiter = valueDelimiter;
@@ -4821,6 +4865,7 @@ void QUrl::setQueryDelimiters(char valueDelimiter, char pairDelimiter)
*/
char QUrl::queryPairDelimiter() const
{
+ if (!d) return '&';
return d->pairDelimiter;
}
@@ -4830,6 +4875,7 @@ char QUrl::queryPairDelimiter() const
*/
char QUrl::queryValueDelimiter() const
{
+ if (!d) return '=';
return d->valueDelimiter;
}
@@ -4852,6 +4898,7 @@ char QUrl::queryValueDelimiter() const
*/
void QUrl::setEncodedQuery(const QByteArray &query)
{
+ if (!d) d = new QUrlPrivate;
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized);
@@ -4871,6 +4918,7 @@ void QUrl::setEncodedQuery(const QByteArray &query)
*/
void QUrl::setQueryItems(const QList<QPair<QString, QString> > &query)
{
+ if (!d) d = new QUrlPrivate;
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
@@ -4910,6 +4958,7 @@ void QUrl::setQueryItems(const QList<QPair<QString, QString> > &query)
*/
void QUrl::setEncodedQueryItems(const QList<QPair<QByteArray, QByteArray> > &query)
{
+ if (!d) d = new QUrlPrivate;
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
@@ -4939,6 +4988,7 @@ void QUrl::setEncodedQueryItems(const QList<QPair<QByteArray, QByteArray> > &que
*/
void QUrl::addQueryItem(const QString &key, const QString &value)
{
+ if (!d) d = new QUrlPrivate;
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
@@ -4973,6 +5023,7 @@ void QUrl::addQueryItem(const QString &key, const QString &value)
*/
void QUrl::addEncodedQueryItem(const QByteArray &key, const QByteArray &value)
{
+ if (!d) d = new QUrlPrivate;
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
@@ -4993,6 +5044,7 @@ void QUrl::addEncodedQueryItem(const QByteArray &key, const QByteArray &value)
*/
QList<QPair<QString, QString> > QUrl::queryItems() const
{
+ if (!d) return QList<QPair<QString, QString> >();
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
QList<QPair<QString, QString> > itemMap;
@@ -5025,6 +5077,7 @@ QList<QPair<QString, QString> > QUrl::queryItems() const
*/
QList<QPair<QByteArray, QByteArray> > QUrl::encodedQueryItems() const
{
+ if (!d) return QList<QPair<QByteArray, QByteArray> >();
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
QList<QPair<QByteArray, QByteArray> > itemMap;
@@ -5053,6 +5106,7 @@ QList<QPair<QByteArray, QByteArray> > QUrl::encodedQueryItems() const
*/
bool QUrl::hasQueryItem(const QString &key) const
{
+ if (!d) return false;
return hasEncodedQueryItem(toPercentEncoding(key, queryExcludeChars));
}
@@ -5071,6 +5125,7 @@ bool QUrl::hasQueryItem(const QString &key) const
*/
bool QUrl::hasEncodedQueryItem(const QByteArray &key) const
{
+ if (!d) return false;
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
int pos = 0;
@@ -5093,6 +5148,7 @@ bool QUrl::hasEncodedQueryItem(const QByteArray &key) const
*/
QString QUrl::queryItemValue(const QString &key) const
{
+ if (!d) return QString();
QByteArray tmp = encodedQueryItemValue(toPercentEncoding(key, queryExcludeChars));
return fromPercentEncodingMutable(&tmp);
}
@@ -5112,6 +5168,7 @@ QString QUrl::queryItemValue(const QString &key) const
*/
QByteArray QUrl::encodedQueryItemValue(const QByteArray &key) const
{
+ if (!d) return QByteArray();
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
int pos = 0;
@@ -5135,6 +5192,7 @@ QByteArray QUrl::encodedQueryItemValue(const QByteArray &key) const
*/
QStringList QUrl::allQueryItemValues(const QString &key) const
{
+ if (!d) return QStringList();
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
QByteArray encodedKey = toPercentEncoding(key, queryExcludeChars);
@@ -5172,6 +5230,7 @@ QStringList QUrl::allQueryItemValues(const QString &key) const
*/
QList<QByteArray> QUrl::allEncodedQueryItemValues(const QByteArray &key) const
{
+ if (!d) return QList<QByteArray>();
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
QList<QByteArray> values;
@@ -5199,6 +5258,7 @@ QList<QByteArray> QUrl::allEncodedQueryItemValues(const QByteArray &key) const
*/
void QUrl::removeQueryItem(const QString &key)
{
+ if (!d) return;
removeEncodedQueryItem(toPercentEncoding(key, queryExcludeChars));
}
@@ -5217,6 +5277,7 @@ void QUrl::removeQueryItem(const QString &key)
*/
void QUrl::removeEncodedQueryItem(const QByteArray &key)
{
+ if (!d) return;
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
@@ -5243,6 +5304,7 @@ void QUrl::removeEncodedQueryItem(const QByteArray &key)
*/
void QUrl::removeAllQueryItems(const QString &key)
{
+ if (!d) return;
removeAllEncodedQueryItems(toPercentEncoding(key, queryExcludeChars));
}
@@ -5261,6 +5323,7 @@ void QUrl::removeAllQueryItems(const QString &key)
*/
void QUrl::removeAllEncodedQueryItems(const QByteArray &key)
{
+ if (!d) return;
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
@@ -5284,6 +5347,7 @@ void QUrl::removeAllEncodedQueryItems(const QByteArray &key)
*/
QByteArray QUrl::encodedQuery() const
{
+ if (!d) return QByteArray();
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
return d->query;
@@ -5308,6 +5372,7 @@ QByteArray QUrl::encodedQuery() const
*/
void QUrl::setFragment(const QString &fragment)
{
+ if (!d) d = new QUrlPrivate;
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized);
@@ -5324,6 +5389,7 @@ void QUrl::setFragment(const QString &fragment)
*/
QString QUrl::fragment() const
{
+ if (!d) return QString();
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
if (d->fragment.isNull() && !d->encodedFragment.isNull()) {
@@ -5354,6 +5420,7 @@ QString QUrl::fragment() const
*/
void QUrl::setEncodedFragment(const QByteArray &fragment)
{
+ if (!d) d = new QUrlPrivate;
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized);
@@ -5375,6 +5442,7 @@ void QUrl::setEncodedFragment(const QByteArray &fragment)
*/
QByteArray QUrl::encodedFragment() const
{
+ if (!d) return QByteArray();
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
d->ensureEncodedParts();
@@ -5390,6 +5458,7 @@ QByteArray QUrl::encodedFragment() const
*/
bool QUrl::hasFragment() const
{
+ if (!d) return false;
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
return d->hasFragment;
@@ -5416,6 +5485,8 @@ bool QUrl::hasFragment() const
*/
QUrl QUrl::resolved(const QUrl &relative) const
{
+ if (!d) return relative;
+ if (!relative.d) return *this;
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
if (!QURL_HASFLAG(relative.d->stateFlags, QUrlPrivate::Parsed))
@@ -5432,6 +5503,7 @@ QUrl QUrl::resolved(const QUrl &relative) const
if (!relative.authority().isEmpty()) {
t = relative;
} else {
+ t.d = new QUrlPrivate;
if (relative.d->encodedPath.isEmpty()) {
t.d->encodedPath = d->encodedPath;
t.setEncodedQuery(relative.d->hasQuery ? relative.d->query : d->query);
@@ -5462,6 +5534,7 @@ QUrl QUrl::resolved(const QUrl &relative) const
*/
bool QUrl::isRelative() const
{
+ if (!d) return true;
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
return d->scheme.isEmpty();
@@ -5476,6 +5549,7 @@ bool QUrl::isRelative() const
*/
QString QUrl::toString(FormattingOptions options) const
{
+ if (!d) return QString();
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
QString url;
@@ -5527,6 +5601,7 @@ QString QUrl::toString(FormattingOptions options) const
*/
QByteArray QUrl::toEncoded(FormattingOptions options) const
{
+ if (!d) return QByteArray();
return d->toEncoded(options);
}
@@ -5777,7 +5852,9 @@ void QUrl::setIdnWhitelist(const QStringList &list)
*/
bool QUrl::operator <(const QUrl &url) const
{
+ if (!d) return url.d ? QByteArray() < url.d->normalized() : false;
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
+ if (!url.d) return d->normalized() < QByteArray();
if (!QURL_HASFLAG(url.d->stateFlags, QUrlPrivate::Parsed)) url.d->parse();
return d->normalized() < url.d->normalized();
}
@@ -5788,6 +5865,8 @@ bool QUrl::operator <(const QUrl &url) const
*/
bool QUrl::operator ==(const QUrl &url) const
{
+ if (!d) return url.isEmpty();
+ if (!url.d) return isEmpty();
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
if (!QURL_HASFLAG(url.d->stateFlags, QUrlPrivate::Parsed)) url.d->parse();
return d->normalized() == url.d->normalized();
@@ -5807,7 +5886,17 @@ bool QUrl::operator !=(const QUrl &url) const
*/
QUrl &QUrl::operator =(const QUrl &url)
{
- qAtomicAssign(d, url.d);
+ if (!d) {
+ if (url.d) {
+ url.d->ref.ref();
+ d = url.d;
+ }
+ } else {
+ if (url.d)
+ qAtomicAssign(d, url.d);
+ else
+ clear();
+ }
return *this;
}
@@ -5816,8 +5905,13 @@ QUrl &QUrl::operator =(const QUrl &url)
*/
QUrl &QUrl::operator =(const QString &url)
{
- QUrl tmp(url);
- qAtomicAssign(d, tmp.d);
+ if (url.isEmpty()) {
+ clear();
+ } else {
+ QUrl tmp(url);
+ if (!d) d = new QUrlPrivate;
+ qAtomicAssign(d, tmp.d);
+ }
return *this;
}
@@ -5826,14 +5920,19 @@ QUrl &QUrl::operator =(const QString &url)
Forces a detach.
*/
void QUrl::detach()
-{ qAtomicDetach(d); }
+{
+ if (!d)
+ d = new QUrlPrivate;
+ else
+ qAtomicDetach(d);
+}
/*!
\internal
*/
bool QUrl::isDetached() const
{
- return d->ref == 1;
+ return d && d->ref == 1;
}
@@ -5875,6 +5974,7 @@ QUrl QUrl::fromLocalFile(const QString &localFile)
*/
QString QUrl::toLocalFile() const
{
+ if (!d) return QString();
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
QString tmp;
@@ -5903,9 +6003,15 @@ QString QUrl::toLocalFile() const
*/
bool QUrl::isParentOf(const QUrl &childUrl) const
{
+ QString childPath = childUrl.path();
+
+ if (!d)
+ return ((childUrl.scheme().isEmpty())
+ && (childUrl.authority().isEmpty())
+ && childPath.length() > 0 && childPath.at(0) == QLatin1Char('/'));
+
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
- QString childPath = childUrl.path();
QString ourPath = path();
return ((childUrl.scheme().isEmpty() || d->scheme == childUrl.scheme())
@@ -6145,6 +6251,8 @@ QDebug operator<<(QDebug d, const QUrl &url)
*/
QString QUrl::errorString() const
{
+ if (!d)
+ return QLatin1String(QT_TRANSLATE_NOOP(QUrl, "Invalid URL \"\": ")); // XXX not a good message, but the one an empty URL produces
return d->createErrorString();
}
diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h
index bb04ad1..906979c 100644
--- a/src/corelib/io/qurl.h
+++ b/src/corelib/io/qurl.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qwindowspipewriter.cpp b/src/corelib/io/qwindowspipewriter.cpp
index 1a2a271..394323f 100644
--- a/src/corelib/io/qwindowspipewriter.cpp
+++ b/src/corelib/io/qwindowspipewriter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qwindowspipewriter_p.h b/src/corelib/io/qwindowspipewriter_p.h
index 28a3b16..893a165 100644
--- a/src/corelib/io/qwindowspipewriter_p.h
+++ b/src/corelib/io/qwindowspipewriter_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**