summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-07-01 17:24:01 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-07-01 17:24:01 (GMT)
commit745ecfd8925716d962c97a4415881377faf6bdd5 (patch)
treec4f78b3bd143af52372064cd3ba5c0ae440813c5 /src/corelib/plugin
parentbda164303570629e44185e8baa52908ced6da301 (diff)
parent8968c79c575755cdb52d5e615ed19e4529047464 (diff)
downloadQt-745ecfd8925716d962c97a4415881377faf6bdd5.zip
Qt-745ecfd8925716d962c97a4415881377faf6bdd5.tar.gz
Qt-745ecfd8925716d962c97a4415881377faf6bdd5.tar.bz2
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Conflicts: bin/syncqt src/gui/text/qtextlayout.cpp tools/assistant/tools/assistant/helpviewer_qwv.cpp tools/assistant/tools/assistant/helpviewer_qwv.h tools/configure/configureapp.cpp
Diffstat (limited to 'src/corelib/plugin')
-rw-r--r--src/corelib/plugin/qplugin.qdoc36
-rw-r--r--src/corelib/plugin/quuid.cpp58
2 files changed, 46 insertions, 48 deletions
diff --git a/src/corelib/plugin/qplugin.qdoc b/src/corelib/plugin/qplugin.qdoc
index f06d92f..b02cfbf 100644
--- a/src/corelib/plugin/qplugin.qdoc
+++ b/src/corelib/plugin/qplugin.qdoc
@@ -6,35 +6,21 @@
**
** This file is part of the documentation of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in a
+** written agreement between you and Nokia.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp
index 8541c7d..9332bbc 100644
--- a/src/corelib/plugin/quuid.cpp
+++ b/src/corelib/plugin/quuid.cpp
@@ -546,13 +546,13 @@ bool QUuid::operator>(const QUuid &other) const
\fn QUuid QUuid::createUuid()
On any platform other than Windows, this function returns a new
- UUID with variant QUuid::DCE and version QUuid::Random. The random
- numbers used to construct the UUID are obtained from the local
- pseudo-random generator, qrand(), which is usually not a cryptographic
- quality random number generator. Therefore, a UUID generated by
- this function can't be guaranteed to be unique. If the pseudo-random
- number generator for the calling thread has not yet been seeded, this
- function will seed the pseudo-random number generator by calling qsrand().
+ UUID with variant QUuid::DCE and version QUuid::Random. If
+ the /dev/urandom device exists, then the numbers used to construct
+ the UUID will be of cryptographic quality, which will make the UUID
+ unique. Otherwise, the numbers of the UUID will be obtained from
+ the local pseudo-random number generator (qrand(), which is seeded
+ by qsrand()) which is usually not of cryptograhic quality, which
+ means that the UUID can't be guaranteed to be unique.
On a Windows platform, a GUID is generated, which almost certainly
\e{will} be unique, on this or any other system, networked or not.
@@ -577,6 +577,7 @@ QUuid QUuid::createUuid()
QT_BEGIN_INCLUDE_NAMESPACE
#include "qdatetime.h"
+#include "qfile.h"
#include "stdlib.h" // For srand/rand
QT_END_INCLUDE_NAMESPACE
@@ -584,24 +585,35 @@ extern void qsrand(); // in qglobal.cpp
QUuid QUuid::createUuid()
{
- static const int intbits = sizeof(int)*8;
- static int randbits = 0;
- if (!randbits) {
- int max = RAND_MAX;
- do { ++randbits; } while ((max=max>>1));
- }
-
- // reseed, but only if not already seeded
- qsrand();
-
QUuid result;
uint *data = &(result.data1);
- int chunks = 16 / sizeof(uint);
- while (chunks--) {
- uint randNumber = 0;
- for (int filled = 0; filled < intbits; filled += randbits)
- randNumber |= qrand()<<filled;
- *(data+chunks) = randNumber;
+
+#ifdef Q_OS_UNIX
+ QFile devUrandom;
+ devUrandom.setFileName(QLatin1String("/dev/urandom"));
+ if (devUrandom.open(QIODevice::ReadOnly)) {
+ qint64 numToRead = 4 * sizeof(uint);
+ devUrandom.read((char *) data, numToRead); // should read 128-bits of data
+ } else
+#endif
+ {
+ static const int intbits = sizeof(int)*8;
+ static int randbits = 0;
+ if (!randbits) {
+ int max = RAND_MAX;
+ do { ++randbits; } while ((max=max>>1));
+ }
+
+ // reseed, but only if not already seeded
+ qsrand();
+
+ int chunks = 16 / sizeof(uint);
+ while (chunks--) {
+ uint randNumber = 0;
+ for (int filled = 0; filled < intbits; filled += randbits)
+ randNumber |= qrand()<<filled;
+ *(data+chunks) = randNumber;
+ }
}
result.data4[0] = (result.data4[0] & 0x3F) | 0x80; // UV_DCE