Merge "Merge remote-tracking branch 'origin/5.10' into dev" into refs/staging/dev
This commit is contained in:
commit
498ef7f9d7
6
.gitignore
vendored
6
.gitignore
vendored
@ -26,6 +26,9 @@
|
|||||||
/src/corelib/global/qconfig.cpp
|
/src/corelib/global/qconfig.cpp
|
||||||
/src/corelib/global/qconfig.h
|
/src/corelib/global/qconfig.h
|
||||||
/src/corelib/global/qconfig_p.h
|
/src/corelib/global/qconfig_p.h
|
||||||
|
/src/gui/vulkan/qvulkanfunctions.h
|
||||||
|
/src/gui/vulkan/qvulkanfunctions_p.cpp
|
||||||
|
/src/gui/vulkan/qvulkanfunctions_p.h
|
||||||
/bin/qt.conf
|
/bin/qt.conf
|
||||||
/bin/qmake
|
/bin/qmake
|
||||||
/bin/qvkgen
|
/bin/qvkgen
|
||||||
@ -50,7 +53,8 @@ qt*-config.pri
|
|||||||
/doc/qt*/*
|
/doc/qt*/*
|
||||||
|
|
||||||
/src/angle/src/QtANGLE/*.def
|
/src/angle/src/QtANGLE/*.def
|
||||||
/src/angle/src/QtANGLE/libANGLE
|
/src/angle/src/QtANGLE/libANGLE/
|
||||||
|
/src/angle/src/libGLESv2/libANGLE/
|
||||||
|
|
||||||
/src/corelib/global/qfloat16tables.cpp
|
/src/corelib/global/qfloat16tables.cpp
|
||||||
|
|
||||||
|
@ -925,6 +925,7 @@ foreach my $lib (@modules_to_sync) {
|
|||||||
#information used after the syncing
|
#information used after the syncing
|
||||||
my $pri_install_classes = "";
|
my $pri_install_classes = "";
|
||||||
my $pri_install_files = "";
|
my $pri_install_files = "";
|
||||||
|
my $pri_install_ifiles = "";
|
||||||
my $pri_install_pfiles = "";
|
my $pri_install_pfiles = "";
|
||||||
my $pri_install_ipfiles = "";
|
my $pri_install_ipfiles = "";
|
||||||
my $pri_install_qpafiles = "";
|
my $pri_install_qpafiles = "";
|
||||||
@ -1080,11 +1081,7 @@ foreach my $lib (@modules_to_sync) {
|
|||||||
|
|
||||||
my $pri_install_iheader = fixPaths($iheader, $dir);
|
my $pri_install_iheader = fixPaths($iheader, $dir);
|
||||||
my $injection = "";
|
my $injection = "";
|
||||||
if($public_header) {
|
if ($public_header) {
|
||||||
#put it into the master file
|
|
||||||
$master_contents{$public_header} = $requires if (!$shadow && shouldMasterInclude($iheader));
|
|
||||||
|
|
||||||
#deal with the install directives
|
|
||||||
foreach my $class (@classes) {
|
foreach my $class (@classes) {
|
||||||
# Strip namespaces:
|
# Strip namespaces:
|
||||||
$class =~ s/^.*:://;
|
$class =~ s/^.*:://;
|
||||||
@ -1096,8 +1093,17 @@ foreach my $lib (@modules_to_sync) {
|
|||||||
unless($pri_install_classes =~ $class_header);
|
unless($pri_install_classes =~ $class_header);
|
||||||
$injection .= ":$class";
|
$injection .= ":$class";
|
||||||
}
|
}
|
||||||
$pri_install_files.= "$pri_install_iheader ";;
|
|
||||||
$pri_clean_files .= "$pri_install_iheader".($requires ? ":".$requires : "")." " if ($clean_header);
|
if ($shadow) {
|
||||||
|
$pri_install_ifiles .= "$pri_install_iheader ";
|
||||||
|
} else {
|
||||||
|
# put it into the master file
|
||||||
|
$master_contents{$public_header} = $requires if (shouldMasterInclude($iheader));
|
||||||
|
|
||||||
|
# deal with the install directives
|
||||||
|
$pri_install_files .= "$pri_install_iheader ";
|
||||||
|
$pri_clean_files .= "$pri_install_iheader".($requires ? ":".$requires : "")." " if ($clean_header);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
elsif ($qpa_header) {
|
elsif ($qpa_header) {
|
||||||
$pri_install_qpafiles.= "$pri_install_iheader ";;
|
$pri_install_qpafiles.= "$pri_install_iheader ";;
|
||||||
@ -1247,6 +1253,7 @@ foreach my $lib (@modules_to_sync) {
|
|||||||
#handle the headers.pri for each module
|
#handle the headers.pri for each module
|
||||||
my $headers_pri_contents = "";
|
my $headers_pri_contents = "";
|
||||||
$headers_pri_contents .= "SYNCQT.HEADER_FILES = $pri_install_files\n";
|
$headers_pri_contents .= "SYNCQT.HEADER_FILES = $pri_install_files\n";
|
||||||
|
$headers_pri_contents .= "SYNCQT.INJECTED_HEADER_FILES = $pri_install_ifiles\n";
|
||||||
$headers_pri_contents .= "SYNCQT.HEADER_CLASSES = $pri_install_classes\n";
|
$headers_pri_contents .= "SYNCQT.HEADER_CLASSES = $pri_install_classes\n";
|
||||||
$headers_pri_contents .= "SYNCQT.PRIVATE_HEADER_FILES = $pri_install_pfiles\n";
|
$headers_pri_contents .= "SYNCQT.PRIVATE_HEADER_FILES = $pri_install_pfiles\n";
|
||||||
$headers_pri_contents .= "SYNCQT.INJECTED_PRIVATE_HEADER_FILES = $pri_install_ipfiles\n";
|
$headers_pri_contents .= "SYNCQT.INJECTED_PRIVATE_HEADER_FILES = $pri_install_ipfiles\n";
|
||||||
|
@ -106,7 +106,7 @@ void Server::sendFortune()
|
|||||||
QByteArray block;
|
QByteArray block;
|
||||||
QDataStream out(&block, QIODevice::WriteOnly);
|
QDataStream out(&block, QIODevice::WriteOnly);
|
||||||
out.setVersion(QDataStream::Qt_5_10);
|
out.setVersion(QDataStream::Qt_5_10);
|
||||||
const int fortuneIndex = QRandomGenerator::bounded(0, fortunes.size());
|
const int fortuneIndex = QRandomGenerator::global()->bounded(0, fortunes.size());
|
||||||
const QString &message = fortunes.at(fortuneIndex);
|
const QString &message = fortunes.at(fortuneIndex);
|
||||||
out << quint32(message.size());
|
out << quint32(message.size());
|
||||||
out << message;
|
out << message;
|
||||||
|
@ -72,7 +72,7 @@ void Game::newGame()
|
|||||||
mPlayer = Character();
|
mPlayer = Character();
|
||||||
mPlayer.setName(QStringLiteral("Hero"));
|
mPlayer.setName(QStringLiteral("Hero"));
|
||||||
mPlayer.setClassType(Character::Archer);
|
mPlayer.setClassType(Character::Archer);
|
||||||
mPlayer.setLevel(QRandomGenerator::bounded(15, 21));
|
mPlayer.setLevel(QRandomGenerator::global()->bounded(15, 21));
|
||||||
|
|
||||||
mLevels.clear();
|
mLevels.clear();
|
||||||
mLevels.reserve(2);
|
mLevels.reserve(2);
|
||||||
@ -81,10 +81,10 @@ void Game::newGame()
|
|||||||
QVector<Character> villageNpcs;
|
QVector<Character> villageNpcs;
|
||||||
villageNpcs.reserve(2);
|
villageNpcs.reserve(2);
|
||||||
villageNpcs.append(Character(QStringLiteral("Barry the Blacksmith"),
|
villageNpcs.append(Character(QStringLiteral("Barry the Blacksmith"),
|
||||||
QRandomGenerator::bounded(8, 11),
|
QRandomGenerator::global()->bounded(8, 11),
|
||||||
Character::Warrior));
|
Character::Warrior));
|
||||||
villageNpcs.append(Character(QStringLiteral("Terry the Trader"),
|
villageNpcs.append(Character(QStringLiteral("Terry the Trader"),
|
||||||
QRandomGenerator::bounded(6, 8),
|
QRandomGenerator::global()->bounded(6, 8),
|
||||||
Character::Warrior));
|
Character::Warrior));
|
||||||
village.setNpcs(villageNpcs);
|
village.setNpcs(villageNpcs);
|
||||||
mLevels.append(village);
|
mLevels.append(village);
|
||||||
@ -93,13 +93,13 @@ void Game::newGame()
|
|||||||
QVector<Character> dungeonNpcs;
|
QVector<Character> dungeonNpcs;
|
||||||
dungeonNpcs.reserve(3);
|
dungeonNpcs.reserve(3);
|
||||||
dungeonNpcs.append(Character(QStringLiteral("Eric the Evil"),
|
dungeonNpcs.append(Character(QStringLiteral("Eric the Evil"),
|
||||||
QRandomGenerator::bounded(18, 26),
|
QRandomGenerator::global()->bounded(18, 26),
|
||||||
Character::Mage));
|
Character::Mage));
|
||||||
dungeonNpcs.append(Character(QStringLiteral("Eric's Left Minion"),
|
dungeonNpcs.append(Character(QStringLiteral("Eric's Left Minion"),
|
||||||
QRandomGenerator::bounded(5, 7),
|
QRandomGenerator::global()->bounded(5, 7),
|
||||||
Character::Warrior));
|
Character::Warrior));
|
||||||
dungeonNpcs.append(Character(QStringLiteral("Eric's Right Minion"),
|
dungeonNpcs.append(Character(QStringLiteral("Eric's Right Minion"),
|
||||||
QRandomGenerator::bounded(4, 9),
|
QRandomGenerator::global()->bounded(4, 9),
|
||||||
Character::Warrior));
|
Character::Warrior));
|
||||||
dungeon.setNpcs(dungeonNpcs);
|
dungeon.setNpcs(dungeonNpcs);
|
||||||
mLevels.append(dungeon);
|
mLevels.append(dungeon);
|
||||||
|
@ -126,7 +126,6 @@ int main(int argc, char *argv[])
|
|||||||
//! [main start] //! [register meta-type for queued communications]
|
//! [main start] //! [register meta-type for queued communications]
|
||||||
qRegisterMetaType<Block>();
|
qRegisterMetaType<Block>();
|
||||||
//! [register meta-type for queued communications]
|
//! [register meta-type for queued communications]
|
||||||
qsrand(QTime::currentTime().elapsed());
|
|
||||||
|
|
||||||
Window window;
|
Window window;
|
||||||
window.show();
|
window.show();
|
||||||
|
@ -50,6 +50,8 @@
|
|||||||
|
|
||||||
#include "renderthread.h"
|
#include "renderthread.h"
|
||||||
|
|
||||||
|
#include <QRandomGenerator>
|
||||||
|
|
||||||
RenderThread::RenderThread(QObject *parent)
|
RenderThread::RenderThread(QObject *parent)
|
||||||
: QThread(parent)
|
: QThread(parent)
|
||||||
{
|
{
|
||||||
@ -82,9 +84,9 @@ void RenderThread::run()
|
|||||||
for (int s = size; s > 0; --s) {
|
for (int s = size; s > 0; --s) {
|
||||||
for (int c = 0; c < 400; ++c) {
|
for (int c = 0; c < 400; ++c) {
|
||||||
//![processing the image (start)]
|
//![processing the image (start)]
|
||||||
int x1 = qMax(0, (qrand() % m_image.width()) - s/2);
|
int x1 = qMax(0, QRandomGenerator::global()->bounded(m_image.width()) - s/2);
|
||||||
int x2 = qMin(x1 + s/2 + 1, m_image.width());
|
int x2 = qMin(x1 + s/2 + 1, m_image.width());
|
||||||
int y1 = qMax(0, (qrand() % m_image.height()) - s/2);
|
int y1 = qMax(0, QRandomGenerator::global()->bounded(m_image.height()) - s/2);
|
||||||
int y2 = qMin(y1 + s/2 + 1, m_image.height());
|
int y2 = qMin(y1 + s/2 + 1, m_image.height());
|
||||||
int n = 0;
|
int n = 0;
|
||||||
int red = 0;
|
int red = 0;
|
||||||
|
@ -70,10 +70,9 @@ class Producer : public QThread
|
|||||||
public:
|
public:
|
||||||
void run() override
|
void run() override
|
||||||
{
|
{
|
||||||
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
|
|
||||||
for (int i = 0; i < DataSize; ++i) {
|
for (int i = 0; i < DataSize; ++i) {
|
||||||
freeBytes.acquire();
|
freeBytes.acquire();
|
||||||
buffer[i % BufferSize] = "ACGT"[(int)qrand() % 4];
|
buffer[i % BufferSize] = "ACGT"[QRandomGenerator::global()->bounded(4)];
|
||||||
usedBytes.release();
|
usedBytes.release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,15 +76,13 @@ public:
|
|||||||
|
|
||||||
void run() override
|
void run() override
|
||||||
{
|
{
|
||||||
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
|
|
||||||
|
|
||||||
for (int i = 0; i < DataSize; ++i) {
|
for (int i = 0; i < DataSize; ++i) {
|
||||||
mutex.lock();
|
mutex.lock();
|
||||||
if (numUsedBytes == BufferSize)
|
if (numUsedBytes == BufferSize)
|
||||||
bufferNotFull.wait(&mutex);
|
bufferNotFull.wait(&mutex);
|
||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
|
|
||||||
buffer[i % BufferSize] = "ACGT"[(int)qrand() % 4];
|
buffer[i % BufferSize] = "ACGT"[QRandomGenerator::global()->bounded(4)];
|
||||||
|
|
||||||
mutex.lock();
|
mutex.lock();
|
||||||
++numUsedBytes;
|
++numUsedBytes;
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "randomlistmodel.h"
|
#include "randomlistmodel.h"
|
||||||
|
#include <QRandomGenerator>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
static const int bufferSize(500);
|
static const int bufferSize(500);
|
||||||
@ -101,6 +102,6 @@ void RandomListModel::cacheRows(int from, int to) const
|
|||||||
//![1]
|
//![1]
|
||||||
QString RandomListModel::fetchRow(int position) const
|
QString RandomListModel::fetchRow(int position) const
|
||||||
{
|
{
|
||||||
return QString::number(rand() % ++position);
|
return QString::number(QRandomGenerator::global()->bounded(++position));
|
||||||
}
|
}
|
||||||
//![1]
|
//![1]
|
||||||
|
@ -72,7 +72,7 @@ static QStringList colorPairs(int max)
|
|||||||
// randomize it
|
// randomize it
|
||||||
colors.clear();
|
colors.clear();
|
||||||
while (combinedColors.count()) {
|
while (combinedColors.count()) {
|
||||||
int i = qrand() % combinedColors.count();
|
int i = QRandomGenerator::global()->bounded(combinedColors.count());
|
||||||
colors << combinedColors[i];
|
colors << combinedColors[i];
|
||||||
combinedColors.removeAt(i);
|
combinedColors.removeAt(i);
|
||||||
if (colors.count() == max)
|
if (colors.count() == max)
|
||||||
|
@ -182,7 +182,7 @@ void Server::sendFortune()
|
|||||||
QDataStream out(&block, QIODevice::WriteOnly);
|
QDataStream out(&block, QIODevice::WriteOnly);
|
||||||
out.setVersion(QDataStream::Qt_5_10);
|
out.setVersion(QDataStream::Qt_5_10);
|
||||||
|
|
||||||
out << fortunes[QRandomGenerator::bounded(fortunes.size())];
|
out << fortunes[QRandomGenerator::global()->bounded(fortunes.size())];
|
||||||
//! [4] //! [7]
|
//! [4] //! [7]
|
||||||
|
|
||||||
QTcpSocket *clientConnection = tcpServer->nextPendingConnection();
|
QTcpSocket *clientConnection = tcpServer->nextPendingConnection();
|
||||||
|
@ -51,6 +51,8 @@
|
|||||||
#include "fortuneserver.h"
|
#include "fortuneserver.h"
|
||||||
#include "fortunethread.h"
|
#include "fortunethread.h"
|
||||||
|
|
||||||
|
#include <QRandomGenerator>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
//! [0]
|
//! [0]
|
||||||
@ -70,7 +72,7 @@ FortuneServer::FortuneServer(QObject *parent)
|
|||||||
//! [1]
|
//! [1]
|
||||||
void FortuneServer::incomingConnection(qintptr socketDescriptor)
|
void FortuneServer::incomingConnection(qintptr socketDescriptor)
|
||||||
{
|
{
|
||||||
QString fortune = fortunes.at(qrand() % fortunes.size());
|
QString fortune = fortunes.at(QRandomGenerator::global()->bounded(fortunes.size()));
|
||||||
FortuneThread *thread = new FortuneThread(socketDescriptor, fortune, this);
|
FortuneThread *thread = new FortuneThread(socketDescriptor, fortune, this);
|
||||||
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
||||||
thread->start();
|
thread->start();
|
||||||
|
@ -60,6 +60,5 @@ int main(int argc, char *argv[])
|
|||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
Dialog dialog;
|
Dialog dialog;
|
||||||
dialog.show();
|
dialog.show();
|
||||||
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,6 @@
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
|
|
||||||
|
|
||||||
Q_INIT_RESOURCE(icons);
|
Q_INIT_RESOURCE(icons);
|
||||||
|
|
||||||
|
@ -692,7 +692,7 @@ void TorrentClient::connectToPeers()
|
|||||||
|
|
||||||
// Start as many connections as we can
|
// Start as many connections as we can
|
||||||
while (!weighedPeers.isEmpty() && ConnectionManager::instance()->canAddConnection()
|
while (!weighedPeers.isEmpty() && ConnectionManager::instance()->canAddConnection()
|
||||||
&& (qrand() % (ConnectionManager::instance()->maxConnections() / 2))) {
|
&& (QRandomGenerator::global()->bounded(ConnectionManager::instance()->maxConnections() / 2))) {
|
||||||
PeerWireClient *client = new PeerWireClient(ConnectionManager::instance()->clientId(), this);
|
PeerWireClient *client = new PeerWireClient(ConnectionManager::instance()->clientId(), this);
|
||||||
RateController::instance()->addSocket(client);
|
RateController::instance()->addSocket(client);
|
||||||
ConnectionManager::instance()->addConnection(client);
|
ConnectionManager::instance()->addConnection(client);
|
||||||
@ -701,7 +701,7 @@ void TorrentClient::connectToPeers()
|
|||||||
d->connections << client;
|
d->connections << client;
|
||||||
|
|
||||||
// Pick a random peer from the list of weighed peers.
|
// Pick a random peer from the list of weighed peers.
|
||||||
TorrentPeer *peer = weighedPeers.takeAt(qrand() % weighedPeers.size());
|
TorrentPeer *peer = weighedPeers.takeAt(QRandomGenerator::global()->bounded(weighedPeers.size()));
|
||||||
weighedPeers.removeAll(peer);
|
weighedPeers.removeAll(peer);
|
||||||
peer->connectStart = QDateTime::currentSecsSinceEpoch();
|
peer->connectStart = QDateTime::currentSecsSinceEpoch();
|
||||||
peer->lastVisited = peer->connectStart;
|
peer->lastVisited = peer->connectStart;
|
||||||
@ -1114,7 +1114,7 @@ void TorrentClient::scheduleUploads()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((client->peerWireState() & PeerWireClient::ChokingPeer) == 0) {
|
if ((client->peerWireState() & PeerWireClient::ChokingPeer) == 0) {
|
||||||
if ((qrand() % 10) == 0)
|
if ((QRandomGenerator::global()->bounded(10)) == 0)
|
||||||
client->abort();
|
client->abort();
|
||||||
else
|
else
|
||||||
client->chokePeer();
|
client->chokePeer();
|
||||||
@ -1128,7 +1128,7 @@ void TorrentClient::scheduleUploads()
|
|||||||
// random peer to allow it to compete for a position among the
|
// random peer to allow it to compete for a position among the
|
||||||
// downloaders. (This is known as an "optimistic unchoke".)
|
// downloaders. (This is known as an "optimistic unchoke".)
|
||||||
if (!allClients.isEmpty()) {
|
if (!allClients.isEmpty()) {
|
||||||
PeerWireClient *client = allClients[qrand() % allClients.size()];
|
PeerWireClient *client = allClients[QRandomGenerator::global()->bounded(allClients.size())];
|
||||||
if (client->peerWireState() & PeerWireClient::ChokingPeer)
|
if (client->peerWireState() & PeerWireClient::ChokingPeer)
|
||||||
client->unchokePeer();
|
client->unchokePeer();
|
||||||
}
|
}
|
||||||
@ -1189,7 +1189,7 @@ void TorrentClient::schedulePieceForClient(PeerWireClient *client)
|
|||||||
piece = d->payloads.value(client);
|
piece = d->payloads.value(client);
|
||||||
if (!piece) {
|
if (!piece) {
|
||||||
QList<TorrentPiece *> values = d->pendingPieces.values();
|
QList<TorrentPiece *> values = d->pendingPieces.values();
|
||||||
piece = values.value(qrand() % values.size());
|
piece = values.value(QRandomGenerator::global()->bounded(values.size()));
|
||||||
piece->inProgress = true;
|
piece->inProgress = true;
|
||||||
d->payloads.insert(client, piece);
|
d->payloads.insert(client, piece);
|
||||||
}
|
}
|
||||||
@ -1246,14 +1246,14 @@ void TorrentClient::schedulePieceForClient(PeerWireClient *client)
|
|||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
if (!partialPieces.isEmpty())
|
if (!partialPieces.isEmpty())
|
||||||
piece = partialPieces.value(qrand() % partialPieces.size());
|
piece = partialPieces.value(QRandomGenerator::global()->bounded(partialPieces.size()));
|
||||||
|
|
||||||
if (!piece) {
|
if (!piece) {
|
||||||
// Pick a random piece 3 out of 4 times; otherwise, pick either
|
// Pick a random piece 3 out of 4 times; otherwise, pick either
|
||||||
// one of the most common or the least common pieces available,
|
// one of the most common or the least common pieces available,
|
||||||
// depending on the state we're in.
|
// depending on the state we're in.
|
||||||
int pieceIndex = 0;
|
int pieceIndex = 0;
|
||||||
if (d->state == WarmingUp || (qrand() & 4) == 0) {
|
if (d->state == WarmingUp || (QRandomGenerator::global()->generate() & 4) == 0) {
|
||||||
int *occurrences = new int[d->pieceCount];
|
int *occurrences = new int[d->pieceCount];
|
||||||
memset(occurrences, 0, d->pieceCount * sizeof(int));
|
memset(occurrences, 0, d->pieceCount * sizeof(int));
|
||||||
|
|
||||||
@ -1293,7 +1293,7 @@ void TorrentClient::schedulePieceForClient(PeerWireClient *client)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Select one piece randomly
|
// Select one piece randomly
|
||||||
pieceIndex = piecesReadyForDownload.at(qrand() % piecesReadyForDownload.size());
|
pieceIndex = piecesReadyForDownload.at(QRandomGenerator::global()->bounded(piecesReadyForDownload.size()));
|
||||||
delete [] occurrences;
|
delete [] occurrences;
|
||||||
} else {
|
} else {
|
||||||
// Make up a list of available piece indices, and pick
|
// Make up a list of available piece indices, and pick
|
||||||
@ -1304,7 +1304,7 @@ void TorrentClient::schedulePieceForClient(PeerWireClient *client)
|
|||||||
if (incompletePiecesAvailableToClient.testBit(i))
|
if (incompletePiecesAvailableToClient.testBit(i))
|
||||||
values << i;
|
values << i;
|
||||||
}
|
}
|
||||||
pieceIndex = values.at(qrand() % values.size());
|
pieceIndex = values.at(QRandomGenerator::global()->bounded(values.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a new TorrentPiece and fill in all initial
|
// Create a new TorrentPiece and fill in all initial
|
||||||
@ -1396,8 +1396,8 @@ int TorrentClient::requestBlocks(PeerWireClient *client, TorrentPiece *piece, in
|
|||||||
// speedup comes from an increased chance of receiving
|
// speedup comes from an increased chance of receiving
|
||||||
// different blocks from the different peers.
|
// different blocks from the different peers.
|
||||||
for (int i = 0; i < bits.size(); ++i) {
|
for (int i = 0; i < bits.size(); ++i) {
|
||||||
int a = qrand() % bits.size();
|
int a = QRandomGenerator::global()->bounded(bits.size());
|
||||||
int b = qrand() % bits.size();
|
int b = QRandomGenerator::global()->bounded(bits.size());
|
||||||
int tmp = bits[a];
|
int tmp = bits[a];
|
||||||
bits[a] = bits[b];
|
bits[a] = bits[b];
|
||||||
bits[b] = tmp;
|
bits[b] = tmp;
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
|
|
||||||
#include <QOpenGLContext>
|
#include <QOpenGLContext>
|
||||||
#include <QOpenGLFunctions>
|
#include <QOpenGLFunctions>
|
||||||
|
#include <QRandomGenerator>
|
||||||
#include <qmath.h>
|
#include <qmath.h>
|
||||||
|
|
||||||
Renderer::Renderer(const QSurfaceFormat &format, Renderer *share, QScreen *screen)
|
Renderer::Renderer(const QSurfaceFormat &format, Renderer *share, QScreen *screen)
|
||||||
@ -68,9 +69,9 @@ Renderer::Renderer(const QSurfaceFormat &format, Renderer *share, QScreen *scree
|
|||||||
m_context->create();
|
m_context->create();
|
||||||
|
|
||||||
m_backgroundColor = QColor::fromRgbF(0.1f, 0.1f, 0.2f, 1.0f);
|
m_backgroundColor = QColor::fromRgbF(0.1f, 0.1f, 0.2f, 1.0f);
|
||||||
m_backgroundColor.setRed(qrand() % 64);
|
m_backgroundColor.setRed(QRandomGenerator::global()->bounded(64));
|
||||||
m_backgroundColor.setGreen(qrand() % 128);
|
m_backgroundColor.setGreen(QRandomGenerator::global()->bounded(128));
|
||||||
m_backgroundColor.setBlue(qrand() % 256);
|
m_backgroundColor.setBlue(QRandomGenerator::global()->bounded(256));
|
||||||
}
|
}
|
||||||
|
|
||||||
HelloWindow::HelloWindow(const QSharedPointer<Renderer> &renderer, QScreen *screen)
|
HelloWindow::HelloWindow(const QSharedPointer<Renderer> &renderer, QScreen *screen)
|
||||||
|
@ -50,6 +50,8 @@
|
|||||||
|
|
||||||
#include "bubble.h"
|
#include "bubble.h"
|
||||||
|
|
||||||
|
#include <QRandomGenerator>
|
||||||
|
|
||||||
Bubble::Bubble(const QPointF &position, qreal radius, const QPointF &velocity)
|
Bubble::Bubble(const QPointF &position, qreal radius, const QPointF &velocity)
|
||||||
: position(position), vel(velocity), radius(radius)
|
: position(position), vel(velocity), radius(radius)
|
||||||
{
|
{
|
||||||
@ -80,10 +82,10 @@ void Bubble::drawBubble(QPainter *painter)
|
|||||||
|
|
||||||
QColor Bubble::randomColor()
|
QColor Bubble::randomColor()
|
||||||
{
|
{
|
||||||
int red = int(205 + 50.0*qrand()/(RAND_MAX+1.0));
|
int red = int(205 + QRandomGenerator::global()->bounded(50));
|
||||||
int green = int(205 + 50.0*qrand()/(RAND_MAX+1.0));
|
int green = int(205 + QRandomGenerator::global()->bounded(50));
|
||||||
int blue = int(205 + 50.0*qrand()/(RAND_MAX+1.0));
|
int blue = int(205 + QRandomGenerator::global()->bounded(50));
|
||||||
int alpha = int(91 + 100.0*qrand()/(RAND_MAX+1.0));
|
int alpha = int(91 + QRandomGenerator::global()->bounded(100));
|
||||||
|
|
||||||
return QColor(red, green, blue, alpha);
|
return QColor(red, green, blue, alpha);
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
#include "glwidget.h"
|
#include "glwidget.h"
|
||||||
|
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
#include <QRandomGenerator>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
@ -67,7 +68,6 @@ GLWidget::GLWidget(QWidget *parent)
|
|||||||
: QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
|
: QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
|
||||||
{
|
{
|
||||||
QTime midnight(0, 0, 0);
|
QTime midnight(0, 0, 0);
|
||||||
qsrand(midnight.secsTo(QTime::currentTime()));
|
|
||||||
|
|
||||||
logo = 0;
|
logo = 0;
|
||||||
xRot = 0;
|
xRot = 0;
|
||||||
@ -234,11 +234,11 @@ QSize GLWidget::sizeHint() const
|
|||||||
void GLWidget::createBubbles(int number)
|
void GLWidget::createBubbles(int number)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < number; ++i) {
|
for (int i = 0; i < number; ++i) {
|
||||||
QPointF position(width()*(0.1 + (0.8*qrand()/(RAND_MAX+1.0))),
|
QPointF position(width()*(0.1 + QRandomGenerator::global()->bounded(0.8)),
|
||||||
height()*(0.1 + (0.8*qrand()/(RAND_MAX+1.0))));
|
height()*(0.1 + QRandomGenerator::global()->bounded(0.8)));
|
||||||
qreal radius = qMin(width(), height())*(0.0125 + 0.0875*qrand()/(RAND_MAX+1.0));
|
qreal radius = qMin(width(), height())*(0.0125 + QRandomGenerator::global()->bounded(0.0875));
|
||||||
QPointF velocity(width()*0.0125*(-0.5 + qrand()/(RAND_MAX+1.0)),
|
QPointF velocity(width()*0.0125*(-0.5 + QRandomGenerator::global()->bounded(1.0)),
|
||||||
height()*0.0125*(-0.5 + qrand()/(RAND_MAX+1.0)));
|
height()*0.0125*(-0.5 + QRandomGenerator::global()->bounded(1.0)));
|
||||||
|
|
||||||
bubbles.append(new Bubble(position, radius, velocity));
|
bubbles.append(new Bubble(position, radius, velocity));
|
||||||
}
|
}
|
||||||
|
@ -109,10 +109,10 @@ void Bubble::drawBubble(QPainter *painter)
|
|||||||
|
|
||||||
QColor Bubble::randomColor()
|
QColor Bubble::randomColor()
|
||||||
{
|
{
|
||||||
int red = int(185 + 70.0*qrand()/(RAND_MAX+1.0));
|
int red = int(185 + QRandomGenerator::global()->bounded(70));
|
||||||
int green = int(185 + 70.0*qrand()/(RAND_MAX+1.0));
|
int green = int(185 + QRandomGenerator::global()->bounded(70));
|
||||||
int blue = int(205 + 50.0*qrand()/(RAND_MAX+1.0));
|
int blue = int(205 + QRandomGenerator::global()->bounded(50));
|
||||||
int alpha = int(91 + 100.0*qrand()/(RAND_MAX+1.0));
|
int alpha = int(91 + QRandomGenerator::global()->bounded(100));
|
||||||
|
|
||||||
return QColor(red, green, blue, alpha);
|
return QColor(red, green, blue, alpha);
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
#include <QPaintEngine>
|
#include <QPaintEngine>
|
||||||
#include <QOpenGLShaderProgram>
|
#include <QOpenGLShaderProgram>
|
||||||
#include <QOpenGLTexture>
|
#include <QOpenGLTexture>
|
||||||
|
#include <QRandomGenerator>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <qmath.h>
|
#include <qmath.h>
|
||||||
|
|
||||||
@ -420,11 +421,11 @@ void GLWidget::paintGL()
|
|||||||
void GLWidget::createBubbles(int number)
|
void GLWidget::createBubbles(int number)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < number; ++i) {
|
for (int i = 0; i < number; ++i) {
|
||||||
QPointF position(width()*(0.1 + (0.8*qrand()/(RAND_MAX+1.0))),
|
QPointF position(width()*(0.1 + QRandomGenerator::global()->bounded(0.8)),
|
||||||
height()*(0.1 + (0.8*qrand()/(RAND_MAX+1.0))));
|
height()*(0.1 + QRandomGenerator::global()->bounded(0.8)));
|
||||||
qreal radius = qMin(width(), height())*(0.0175 + 0.0875*qrand()/(RAND_MAX+1.0));
|
qreal radius = qMin(width(), height())*(0.0175 + QRandomGenerator::global()->bounded(0.0875));
|
||||||
QPointF velocity(width()*0.0175*(-0.5 + qrand()/(RAND_MAX+1.0)),
|
QPointF velocity(width()*0.0175*(-0.5 + QRandomGenerator::global()->bounded(1.0)),
|
||||||
height()*0.0175*(-0.5 + qrand()/(RAND_MAX+1.0)));
|
height()*0.0175*(-0.5 + QRandomGenerator::global()->bounded(1.0)));
|
||||||
|
|
||||||
m_bubbles.append(new Bubble(position, radius, velocity));
|
m_bubbles.append(new Bubble(position, radius, velocity));
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,7 @@
|
|||||||
#include <QSlider>
|
#include <QSlider>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
|
#include <QRandomGenerator>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
|
|
||||||
@ -155,7 +156,9 @@ void MainWindow::addNew()
|
|||||||
{
|
{
|
||||||
if (m_nextY == 4)
|
if (m_nextY == 4)
|
||||||
return;
|
return;
|
||||||
GLWidget *w = new GLWidget(this, false, qRgb(qrand() % 256, qrand() % 256, qrand() % 256));
|
GLWidget *w = new GLWidget(this, false, qRgb(QRandomGenerator::global()->bounded(256),
|
||||||
|
QRandomGenerator::global()->bounded(256),
|
||||||
|
QRandomGenerator::global()->bounded(256)));
|
||||||
m_glWidgets << w;
|
m_glWidgets << w;
|
||||||
connect(m_timer, &QTimer::timeout, w, QOverload<>::of(&QWidget::update));
|
connect(m_timer, &QTimer::timeout, w, QOverload<>::of(&QWidget::update));
|
||||||
m_layout->addWidget(w, m_nextY, m_nextX, 1, 1);
|
m_layout->addWidget(w, m_nextY, m_nextX, 1, 1);
|
||||||
|
@ -48,15 +48,10 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "imagescaling.h"
|
#include "imagescaling.h"
|
||||||
|
|
||||||
#include <qmath.h>
|
#include <qmath.h>
|
||||||
|
|
||||||
const int imageSize = 100;
|
#include <functional>
|
||||||
|
|
||||||
QImage scale(const QString &imageFileName)
|
|
||||||
{
|
|
||||||
QImage image(imageFileName);
|
|
||||||
return image.scaled(QSize(imageSize, imageSize), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
|
||||||
}
|
|
||||||
|
|
||||||
Images::Images(QWidget *parent)
|
Images::Images(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
@ -65,19 +60,19 @@ Images::Images(QWidget *parent)
|
|||||||
resize(800, 600);
|
resize(800, 600);
|
||||||
|
|
||||||
imageScaling = new QFutureWatcher<QImage>(this);
|
imageScaling = new QFutureWatcher<QImage>(this);
|
||||||
connect(imageScaling, SIGNAL(resultReadyAt(int)), SLOT(showImage(int)));
|
connect(imageScaling, &QFutureWatcher<QImage>::resultReadyAt, this, &Images::showImage);
|
||||||
connect(imageScaling, SIGNAL(finished()), SLOT(finished()));
|
connect(imageScaling, &QFutureWatcher<QImage>::finished, this, &Images::finished);
|
||||||
|
|
||||||
openButton = new QPushButton(tr("Open Images"));
|
openButton = new QPushButton(tr("Open Images"));
|
||||||
connect(openButton, SIGNAL(clicked()), SLOT(open()));
|
connect(openButton, &QPushButton::clicked, this, &Images::open);
|
||||||
|
|
||||||
cancelButton = new QPushButton(tr("Cancel"));
|
cancelButton = new QPushButton(tr("Cancel"));
|
||||||
cancelButton->setEnabled(false);
|
cancelButton->setEnabled(false);
|
||||||
connect(cancelButton, SIGNAL(clicked()), imageScaling, SLOT(cancel()));
|
connect(cancelButton, &QPushButton::clicked, imageScaling, &QFutureWatcher<QImage>::cancel);
|
||||||
|
|
||||||
pauseButton = new QPushButton(tr("Pause/Resume"));
|
pauseButton = new QPushButton(tr("Pause/Resume"));
|
||||||
pauseButton->setEnabled(false);
|
pauseButton->setEnabled(false);
|
||||||
connect(pauseButton, SIGNAL(clicked()), imageScaling, SLOT(togglePaused()));
|
connect(pauseButton, &QPushButton::clicked, imageScaling, &QFutureWatcher<QImage>::togglePaused);
|
||||||
|
|
||||||
QHBoxLayout *buttonLayout = new QHBoxLayout();
|
QHBoxLayout *buttonLayout = new QHBoxLayout();
|
||||||
buttonLayout->addWidget(openButton);
|
buttonLayout->addWidget(openButton);
|
||||||
@ -113,9 +108,11 @@ void Images::open()
|
|||||||
QStandardPaths::writableLocation(QStandardPaths::PicturesLocation),
|
QStandardPaths::writableLocation(QStandardPaths::PicturesLocation),
|
||||||
"*.jpg *.png");
|
"*.jpg *.png");
|
||||||
|
|
||||||
if (files.count() == 0)
|
if (files.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
const int imageSize = 100;
|
||||||
|
|
||||||
// Do a simple layout.
|
// Do a simple layout.
|
||||||
qDeleteAll(labels);
|
qDeleteAll(labels);
|
||||||
labels.clear();
|
labels.clear();
|
||||||
@ -130,6 +127,11 @@ void Images::open()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::function<QImage(const QString&)> scale = [imageSize](const QString &imageFileName) {
|
||||||
|
QImage image(imageFileName);
|
||||||
|
return image.scaled(QSize(imageSize, imageSize), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||||
|
};
|
||||||
|
|
||||||
// Use mapped to run the thread safe scale function on the files.
|
// Use mapped to run the thread safe scale function on the files.
|
||||||
imageScaling->setFuture(QtConcurrent::mapped(files, scale));
|
imageScaling->setFuture(QtConcurrent::mapped(files, scale));
|
||||||
|
|
||||||
|
@ -57,9 +57,9 @@ class Images : public QWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
Images(QWidget *parent = 0);
|
Images(QWidget *parent = nullptr);
|
||||||
~Images();
|
~Images();
|
||||||
public Q_SLOTS:
|
public slots:
|
||||||
void open();
|
void open();
|
||||||
void showImage(int num);
|
void showImage(int num);
|
||||||
void finished();
|
void finished();
|
||||||
|
@ -55,11 +55,7 @@
|
|||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#include <qtconcurrentmap.h>
|
#include <qtconcurrentmap.h>
|
||||||
|
|
||||||
QImage scale(const QImage &image)
|
#include <functional>
|
||||||
{
|
|
||||||
qDebug() << "Scaling image in thread" << QThread::currentThread();
|
|
||||||
return image.scaled(QSize(100, 100), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -72,6 +68,12 @@ int main(int argc, char *argv[])
|
|||||||
for (int i = 0; i < imageCount; ++i)
|
for (int i = 0; i < imageCount; ++i)
|
||||||
images.append(QImage(1600, 1200, QImage::Format_ARGB32_Premultiplied));
|
images.append(QImage(1600, 1200, QImage::Format_ARGB32_Premultiplied));
|
||||||
|
|
||||||
|
std::function<QImage(const QImage&)> scale = [](const QImage &image) -> QImage
|
||||||
|
{
|
||||||
|
qDebug() << "Scaling image in thread" << QThread::currentThread();
|
||||||
|
return image.scaled(QSize(100, 100), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||||
|
};
|
||||||
|
|
||||||
// Use QtConcurrentBlocking::mapped to apply the scale function to all the
|
// Use QtConcurrentBlocking::mapped to apply the scale function to all the
|
||||||
// images in the list.
|
// images in the list.
|
||||||
QList<QImage> thumbnails = QtConcurrent::blockingMapped(images, scale);
|
QList<QImage> thumbnails = QtConcurrent::blockingMapped(images, scale);
|
||||||
|
@ -51,24 +51,16 @@
|
|||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#include <QtConcurrent>
|
#include <QtConcurrent>
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
using namespace QtConcurrent;
|
using namespace QtConcurrent;
|
||||||
|
|
||||||
const int iterations = 20;
|
|
||||||
|
|
||||||
void spin(int &iteration)
|
|
||||||
{
|
|
||||||
const int work = 1000 * 1000 * 40;
|
|
||||||
volatile int v = 0;
|
|
||||||
for (int j = 0; j < work; ++j)
|
|
||||||
++v;
|
|
||||||
|
|
||||||
qDebug() << "iteration" << iteration << "in thread" << QThread::currentThreadId();
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
|
const int iterations = 20;
|
||||||
|
|
||||||
// Prepare the vector.
|
// Prepare the vector.
|
||||||
QVector<int> vector;
|
QVector<int> vector;
|
||||||
for (int i = 0; i < iterations; ++i)
|
for (int i = 0; i < iterations; ++i)
|
||||||
@ -80,10 +72,20 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
// Create a QFutureWatcher and connect signals and slots.
|
// Create a QFutureWatcher and connect signals and slots.
|
||||||
QFutureWatcher<void> futureWatcher;
|
QFutureWatcher<void> futureWatcher;
|
||||||
QObject::connect(&futureWatcher, SIGNAL(finished()), &dialog, SLOT(reset()));
|
QObject::connect(&futureWatcher, &QFutureWatcher<void>::finished, &dialog, &QProgressDialog::reset);
|
||||||
QObject::connect(&dialog, SIGNAL(canceled()), &futureWatcher, SLOT(cancel()));
|
QObject::connect(&dialog, &QProgressDialog::canceled, &futureWatcher, &QFutureWatcher<void>::cancel);
|
||||||
QObject::connect(&futureWatcher, SIGNAL(progressRangeChanged(int,int)), &dialog, SLOT(setRange(int,int)));
|
QObject::connect(&futureWatcher, &QFutureWatcher<void>::progressRangeChanged, &dialog, &QProgressDialog::setRange);
|
||||||
QObject::connect(&futureWatcher, SIGNAL(progressValueChanged(int)), &dialog, SLOT(setValue(int)));
|
QObject::connect(&futureWatcher, &QFutureWatcher<void>::progressValueChanged, &dialog, &QProgressDialog::setValue);
|
||||||
|
|
||||||
|
// Our function to compute
|
||||||
|
std::function<void(int&)> spin = [](int &iteration) {
|
||||||
|
const int work = 1000 * 1000 * 40;
|
||||||
|
volatile int v = 0;
|
||||||
|
for (int j = 0; j < work; ++j)
|
||||||
|
++v;
|
||||||
|
|
||||||
|
qDebug() << "iteration" << iteration << "in thread" << QThread::currentThreadId();
|
||||||
|
};
|
||||||
|
|
||||||
// Start the computation.
|
// Start the computation.
|
||||||
futureWatcher.setFuture(QtConcurrent::map(vector, spin));
|
futureWatcher.setFuture(QtConcurrent::map(vector, spin));
|
||||||
|
@ -65,15 +65,17 @@ using namespace QtConcurrent;
|
|||||||
/*
|
/*
|
||||||
Utility function that recursivily searches for files.
|
Utility function that recursivily searches for files.
|
||||||
*/
|
*/
|
||||||
QStringList findFiles(const QString &startDir, QStringList filters)
|
QStringList findFiles(const QString &startDir, const QStringList &filters)
|
||||||
{
|
{
|
||||||
QStringList names;
|
QStringList names;
|
||||||
QDir dir(startDir);
|
QDir dir(startDir);
|
||||||
|
|
||||||
foreach (QString file, dir.entryList(filters, QDir::Files))
|
const auto files = dir.entryList(filters, QDir::Files);
|
||||||
|
for (const QString &file : files)
|
||||||
names += startDir + '/' + file;
|
names += startDir + '/' + file;
|
||||||
|
|
||||||
foreach (QString subdir, dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot))
|
const auto subdirs = dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot);
|
||||||
|
for (const QString &subdir : subdirs)
|
||||||
names += findFiles(startDir + '/' + subdir, filters);
|
names += findFiles(startDir + '/' + subdir, filters);
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
@ -83,17 +85,18 @@ typedef QMap<QString, int> WordCount;
|
|||||||
/*
|
/*
|
||||||
Single threaded word counter function.
|
Single threaded word counter function.
|
||||||
*/
|
*/
|
||||||
WordCount singleThreadedWordCount(QStringList files)
|
WordCount singleThreadedWordCount(const QStringList &files)
|
||||||
{
|
{
|
||||||
WordCount wordCount;
|
WordCount wordCount;
|
||||||
foreach (QString file, files) {
|
for (const QString &file : files) {
|
||||||
QFile f(file);
|
QFile f(file);
|
||||||
f.open(QIODevice::ReadOnly);
|
f.open(QIODevice::ReadOnly);
|
||||||
QTextStream textStream(&f);
|
QTextStream textStream(&f);
|
||||||
while (textStream.atEnd() == false)
|
while (!textStream.atEnd()) {
|
||||||
foreach (const QString &word, textStream.readLine().split(' '))
|
const auto words = textStream.readLine().split(' ');
|
||||||
|
for (const QString &word : words)
|
||||||
wordCount[word] += 1;
|
wordCount[word] += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return wordCount;
|
return wordCount;
|
||||||
}
|
}
|
||||||
@ -109,9 +112,11 @@ WordCount countWords(const QString &file)
|
|||||||
QTextStream textStream(&f);
|
QTextStream textStream(&f);
|
||||||
WordCount wordCount;
|
WordCount wordCount;
|
||||||
|
|
||||||
while (textStream.atEnd() == false)
|
while (!textStream.atEnd()) {
|
||||||
foreach (const QString &word, textStream.readLine().split(' '))
|
const auto words = textStream.readLine().split(' ');
|
||||||
|
for (const QString &word : words)
|
||||||
wordCount[word] += 1;
|
wordCount[word] += 1;
|
||||||
|
}
|
||||||
|
|
||||||
return wordCount;
|
return wordCount;
|
||||||
}
|
}
|
||||||
@ -137,8 +142,6 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
qDebug() << "warmup";
|
qDebug() << "warmup";
|
||||||
{
|
{
|
||||||
QTime time;
|
|
||||||
time.start();
|
|
||||||
WordCount total = singleThreadedWordCount(files);
|
WordCount total = singleThreadedWordCount(files);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,6 @@ static const int MouseCount = 7;
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
|
|
||||||
//! [0]
|
//! [0]
|
||||||
|
|
||||||
//! [1]
|
//! [1]
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
|
|
||||||
#include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
#include <QRandomGenerator>
|
||||||
#include <QStyleOption>
|
#include <QStyleOption>
|
||||||
#include <qmath.h>
|
#include <qmath.h>
|
||||||
|
|
||||||
@ -70,9 +71,9 @@ static qreal normalizeAngle(qreal angle)
|
|||||||
//! [0]
|
//! [0]
|
||||||
Mouse::Mouse()
|
Mouse::Mouse()
|
||||||
: angle(0), speed(0), mouseEyeDirection(0),
|
: angle(0), speed(0), mouseEyeDirection(0),
|
||||||
color(qrand() % 256, qrand() % 256, qrand() % 256)
|
color(QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256))
|
||||||
{
|
{
|
||||||
setTransform(QTransform().rotate(qrand() % (360 * 16)), true);
|
setTransform(QTransform().rotate(QRandomGenerator::global()->bounded(360 * 16)), true);
|
||||||
startTimer(1000 / 33);
|
startTimer(1000 / 33);
|
||||||
}
|
}
|
||||||
//! [0]
|
//! [0]
|
||||||
@ -184,16 +185,16 @@ void Mouse::timerEvent(QTimerEvent *)
|
|||||||
|
|
||||||
// Add some random movement
|
// Add some random movement
|
||||||
//! [10]
|
//! [10]
|
||||||
if (dangerMice.size() > 1 && (qrand() % 10) == 0) {
|
if (dangerMice.size() > 1 && QRandomGenerator::global()->bounded(10) == 0) {
|
||||||
if (qrand() % 1)
|
if (QRandomGenerator::global()->bounded(1))
|
||||||
angle += (qrand() % 100) / 500.0;
|
angle += QRandomGenerator::global()->bounded(1 / 500.0);
|
||||||
else
|
else
|
||||||
angle -= (qrand() % 100) / 500.0;
|
angle -= QRandomGenerator::global()->bounded(1 / 500.0);
|
||||||
}
|
}
|
||||||
//! [10]
|
//! [10]
|
||||||
|
|
||||||
//! [11]
|
//! [11]
|
||||||
speed += (-50 + qrand() % 100) / 100.0;
|
speed += (-50 + QRandomGenerator::global()->bounded(100)) / 100.0;
|
||||||
|
|
||||||
qreal dx = ::sin(angle) * 10;
|
qreal dx = ::sin(angle) * 10;
|
||||||
mouseEyeDirection = (qAbs(dx / 5) < 1) ? 0 : dx / 5;
|
mouseEyeDirection = (qAbs(dx / 5) < 1) ? 0 : dx / 5;
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
|
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#include <QtCore/qmath.h>
|
#include <QtCore/qmath.h>
|
||||||
|
#include <QtCore/qrandom.h>
|
||||||
#include <QtCore/qstate.h>
|
#include <QtCore/qstate.h>
|
||||||
|
|
||||||
class Pixmap : public QObject, public QGraphicsPixmapItem
|
class Pixmap : public QObject, public QGraphicsPixmapItem
|
||||||
@ -202,8 +203,8 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
// Random
|
// Random
|
||||||
randomState->assignProperty(item, "pos",
|
randomState->assignProperty(item, "pos",
|
||||||
QPointF(-250 + qrand() % 500,
|
QPointF(-250 + QRandomGenerator::global()->bounded(500),
|
||||||
-250 + qrand() % 500));
|
-250 + QRandomGenerator::global()->bounded(500)));
|
||||||
|
|
||||||
// Tiled
|
// Tiled
|
||||||
tiledState->assignProperty(item, "pos",
|
tiledState->assignProperty(item, "pos",
|
||||||
|
@ -125,7 +125,7 @@ public:
|
|||||||
void onEntry(QEvent *) override
|
void onEntry(QEvent *) override
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
while ((n = (qrand() % m_stateCount + 1)) == m_lastIndex)
|
while ((n = QRandomGenerator::global()->bounded(m_stateCount) + 1) == m_lastIndex)
|
||||||
{ }
|
{ }
|
||||||
m_lastIndex = n;
|
m_lastIndex = n;
|
||||||
machine()->postEvent(new StateSwitchEvent(n));
|
machine()->postEvent(new StateSwitchEvent(n));
|
||||||
@ -323,8 +323,6 @@ int main(int argc, char **argv)
|
|||||||
window.resize(300, 300);
|
window.resize(300, 300);
|
||||||
window.show();
|
window.show();
|
||||||
|
|
||||||
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
|
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,13 +91,12 @@ public:
|
|||||||
: QEventTransition(this, QEvent::Timer)
|
: QEventTransition(this, QEvent::Timer)
|
||||||
{
|
{
|
||||||
setTargetState(target);
|
setTargetState(target);
|
||||||
qsrand((uint)QDateTime::currentSecsSinceEpoch());
|
|
||||||
startTimer(1000);
|
startTimer(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool eventTest(QEvent *e) override
|
bool eventTest(QEvent *e) override
|
||||||
{
|
{
|
||||||
return QEventTransition::eventTest(e) && ((qrand() % 50) == 0);
|
return QEventTransition::eventTest(e) && QRandomGenerator::global()->bounded(50) == 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
//! [4]
|
//! [4]
|
||||||
|
@ -57,8 +57,6 @@ int main(int argc, char *argv[])
|
|||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
Q_INIT_RESOURCE(subattaq);
|
Q_INIT_RESOURCE(subattaq);
|
||||||
|
|
||||||
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
|
|
||||||
|
|
||||||
MainWindow w;
|
MainWindow w;
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
|
@ -64,6 +64,7 @@
|
|||||||
#include <QtCore/QStateMachine>
|
#include <QtCore/QStateMachine>
|
||||||
#include <QtWidgets/QKeyEventTransition>
|
#include <QtWidgets/QKeyEventTransition>
|
||||||
#include <QtCore/QFinalState>
|
#include <QtCore/QFinalState>
|
||||||
|
#include <QtCore/QRandomGenerator>
|
||||||
|
|
||||||
PlayState::PlayState(GraphicsScene *scene, QState *parent)
|
PlayState::PlayState(GraphicsScene *scene, QState *parent)
|
||||||
: QState(parent),
|
: QState(parent),
|
||||||
@ -193,12 +194,12 @@ void LevelState::initializeLevel()
|
|||||||
for (int j = 0; j < subContent.second; ++j ) {
|
for (int j = 0; j < subContent.second; ++j ) {
|
||||||
SubMarine *sub = new SubMarine(submarineDesc.type, submarineDesc.name, submarineDesc.points);
|
SubMarine *sub = new SubMarine(submarineDesc.type, submarineDesc.name, submarineDesc.points);
|
||||||
scene->addItem(sub);
|
scene->addItem(sub);
|
||||||
int random = (qrand() % 15 + 1);
|
int random = QRandomGenerator::global()->bounded(15) + 1;
|
||||||
qreal x = random == 13 || random == 5 ? 0 : scene->width() - sub->size().width();
|
qreal x = random == 13 || random == 5 ? 0 : scene->width() - sub->size().width();
|
||||||
qreal y = scene->height() -(qrand() % 150 + 1) - sub->size().height();
|
qreal y = scene->height() -(QRandomGenerator::global()->bounded(150) + 1) - sub->size().height();
|
||||||
sub->setPos(x,y);
|
sub->setPos(x,y);
|
||||||
sub->setCurrentDirection(x == 0 ? SubMarine::Right : SubMarine::Left);
|
sub->setCurrentDirection(x == 0 ? SubMarine::Right : SubMarine::Left);
|
||||||
sub->setCurrentSpeed(qrand() % 3 + 1);
|
sub->setCurrentSpeed(QRandomGenerator::global()->bounded(3) + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,6 +69,7 @@
|
|||||||
|
|
||||||
//Qt
|
//Qt
|
||||||
#include <QtCore/QPropertyAnimation>
|
#include <QtCore/QPropertyAnimation>
|
||||||
|
#include <QtCore/QRandomGenerator>
|
||||||
#include <QtWidgets/QGraphicsScene>
|
#include <QtWidgets/QGraphicsScene>
|
||||||
|
|
||||||
//This state is describing when the boat is moving right
|
//This state is describing when the boat is moving right
|
||||||
@ -88,8 +89,8 @@ public:
|
|||||||
protected slots:
|
protected slots:
|
||||||
void onAnimationMovementValueChanged(const QVariant &)
|
void onAnimationMovementValueChanged(const QVariant &)
|
||||||
{
|
{
|
||||||
if (qrand() % 200 + 1 == 3)
|
if (QRandomGenerator::global()->bounded(200) + 1 == 3)
|
||||||
submarine->launchTorpedo(qrand() % 3 + 1);
|
submarine->launchTorpedo(QRandomGenerator::global()->bounded(3) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -80,8 +80,7 @@
|
|||||||
\snippet graphicsview/collidingmice/mouse.cpp 0
|
\snippet graphicsview/collidingmice/mouse.cpp 0
|
||||||
|
|
||||||
To calculate the various components of the mouse's color, we use
|
To calculate the various components of the mouse's color, we use
|
||||||
the global qrand() function which is a thread-safe version of the
|
\l QRandomGenerator.
|
||||||
standard C++ rand() function.
|
|
||||||
|
|
||||||
Then we call the \l {QGraphicsItem::setRotation()}{setRotation()} function
|
Then we call the \l {QGraphicsItem::setRotation()}{setRotation()} function
|
||||||
inherited from QGraphicsItem. Items live in their own local
|
inherited from QGraphicsItem. Items live in their own local
|
||||||
@ -178,12 +177,7 @@
|
|||||||
|
|
||||||
\snippet graphicsview/collidingmice/main.cpp 0
|
\snippet graphicsview/collidingmice/main.cpp 0
|
||||||
|
|
||||||
First, we create an application object and call the global
|
First, we create an application object and create the scene:
|
||||||
qsrand() function to specify the seed used to generate a new
|
|
||||||
random number sequence of pseudo random integers with the
|
|
||||||
previously mentioned qrand() function.
|
|
||||||
|
|
||||||
Then it is time to create the scene:
|
|
||||||
|
|
||||||
\snippet graphicsview/collidingmice/main.cpp 1
|
\snippet graphicsview/collidingmice/main.cpp 1
|
||||||
|
|
||||||
|
@ -257,7 +257,7 @@
|
|||||||
\snippet graphicsview/dragdroprobot/coloritem.cpp 0
|
\snippet graphicsview/dragdroprobot/coloritem.cpp 0
|
||||||
|
|
||||||
\c ColorItem's constructor assigns an opaque random color to its color
|
\c ColorItem's constructor assigns an opaque random color to its color
|
||||||
member by making use of qrand(). For improved usability, it assigns a
|
member by making use of \l QRandomGenerator. For improved usability, it assigns a
|
||||||
tooltip that provides a useful hint to the user, and it also sets a
|
tooltip that provides a useful hint to the user, and it also sets a
|
||||||
suitable cursor. This ensures that the cursor will chance to
|
suitable cursor. This ensures that the cursor will chance to
|
||||||
Qt::OpenHandCursor when the mouse pointer hovers over the item.
|
Qt::OpenHandCursor when the mouse pointer hovers over the item.
|
||||||
|
@ -424,9 +424,8 @@
|
|||||||
\section1 The main() Function
|
\section1 The main() Function
|
||||||
|
|
||||||
In contrast to the complexity of the rest of this example, the \c main()
|
In contrast to the complexity of the rest of this example, the \c main()
|
||||||
function is very simple: We create a QApplication instance, seed the
|
function is very simple: We create a QApplication instance, then create and
|
||||||
randomizer using qsrand(), and then create and show an instance of \c
|
show an instance of \c GraphWidget. Because all nodes in the grid are moved
|
||||||
GraphWidget. Because all nodes in the grid are moved initially, the \c
|
initially, the \c GraphWidget timer will start immediately after control
|
||||||
GraphWidget timer will start immediately after control has returned to the
|
has returned to the event loop.
|
||||||
event loop.
|
|
||||||
*/
|
*/
|
||||||
|
@ -122,10 +122,8 @@ void MainWindow::setupPuzzle()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qsrand(QCursor::pos().x() ^ QCursor::pos().y());
|
|
||||||
|
|
||||||
for (int i = 0; i < piecesList->count(); ++i) {
|
for (int i = 0; i < piecesList->count(); ++i) {
|
||||||
if (int(2.0*qrand()/(RAND_MAX+1.0)) == 1) {
|
if (QRandomGenerator::global()->bounded(2) == 1) {
|
||||||
QListWidgetItem *item = piecesList->takeItem(i);
|
QListWidgetItem *item = piecesList->takeItem(i);
|
||||||
piecesList->insertItem(0, item);
|
piecesList->insertItem(0, item);
|
||||||
}
|
}
|
||||||
|
@ -414,7 +414,7 @@ void QtBox::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWi
|
|||||||
|
|
||||||
CircleItem::CircleItem(int size, int x, int y) : ItemBase(size, x, y)
|
CircleItem::CircleItem(int size, int x, int y) : ItemBase(size, x, y)
|
||||||
{
|
{
|
||||||
m_color = QColor::fromHsv(rand() % 360, 255, 255);
|
m_color = QColor::fromHsv(QRandomGenerator::global()->bounded(360), 255, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CircleItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
void CircleItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "scene.h"
|
#include "scene.h"
|
||||||
|
#include <QtCore/QRandomGenerator>
|
||||||
#include <QtGui/qmatrix4x4.h>
|
#include <QtGui/qmatrix4x4.h>
|
||||||
#include <QtGui/qvector3d.h>
|
#include <QtGui/qvector3d.h>
|
||||||
#include <qmath.h>
|
#include <qmath.h>
|
||||||
@ -1072,13 +1073,16 @@ void Scene::newItem(ItemDialog::ItemType type)
|
|||||||
QSize size = sceneRect().size().toSize();
|
QSize size = sceneRect().size().toSize();
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ItemDialog::QtBoxItem:
|
case ItemDialog::QtBoxItem:
|
||||||
addItem(new QtBox(64, rand() % (size.width() - 64) + 32, rand() % (size.height() - 64) + 32));
|
addItem(new QtBox(64, QRandomGenerator::global()->bounded(size.width() - 64) + 32,
|
||||||
|
QRandomGenerator::global()->bounded(size.height() - 64) + 32));
|
||||||
break;
|
break;
|
||||||
case ItemDialog::CircleItem:
|
case ItemDialog::CircleItem:
|
||||||
addItem(new CircleItem(64, rand() % (size.width() - 64) + 32, rand() % (size.height() - 64) + 32));
|
addItem(new CircleItem(64, QRandomGenerator::global()->bounded(size.width() - 64) + 32,
|
||||||
|
QRandomGenerator::global()->bounded(size.height() - 64) + 32));
|
||||||
break;
|
break;
|
||||||
case ItemDialog::SquareItem:
|
case ItemDialog::SquareItem:
|
||||||
addItem(new SquareItem(64, rand() % (size.width() - 64) + 32, rand() % (size.height() - 64) + 32));
|
addItem(new SquareItem(64, QRandomGenerator::global()->bounded(size.width() - 64) + 32,
|
||||||
|
QRandomGenerator::global()->bounded(size.height() - 64) + 32));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -60,7 +60,6 @@ static const int MouseCount = 7;
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
qsrand(QTime(0, 0, 0).secsTo(QTime::currentTime()));
|
|
||||||
//! [0]
|
//! [0]
|
||||||
|
|
||||||
//! [1]
|
//! [1]
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
|
|
||||||
#include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
#include <QRandomGenerator>
|
||||||
#include <QStyleOption>
|
#include <QStyleOption>
|
||||||
#include <qmath.h>
|
#include <qmath.h>
|
||||||
|
|
||||||
@ -70,9 +71,9 @@ static qreal normalizeAngle(qreal angle)
|
|||||||
//! [0]
|
//! [0]
|
||||||
Mouse::Mouse()
|
Mouse::Mouse()
|
||||||
: angle(0), speed(0), mouseEyeDirection(0),
|
: angle(0), speed(0), mouseEyeDirection(0),
|
||||||
color(qrand() % 256, qrand() % 256, qrand() % 256)
|
color(QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256))
|
||||||
{
|
{
|
||||||
setRotation(qrand() % (360 * 16));
|
setRotation(QRandomGenerator::global()->bounded(360 * 16));
|
||||||
}
|
}
|
||||||
//! [0]
|
//! [0]
|
||||||
|
|
||||||
@ -185,16 +186,16 @@ void Mouse::advance(int step)
|
|||||||
|
|
||||||
// Add some random movement
|
// Add some random movement
|
||||||
//! [10]
|
//! [10]
|
||||||
if (dangerMice.size() > 1 && (qrand() % 10) == 0) {
|
if (dangerMice.size() > 1 && QRandomGenerator::global()->bounded(10) == 0) {
|
||||||
if (qrand() % 1)
|
if (QRandomGenerator::global()->bounded(1))
|
||||||
angle += (qrand() % 100) / 500.0;
|
angle += QRandomGenerator::global()->bounded(1 / 500.0);
|
||||||
else
|
else
|
||||||
angle -= (qrand() % 100) / 500.0;
|
angle -= QRandomGenerator::global()->bounded(1 / 500.0);
|
||||||
}
|
}
|
||||||
//! [10]
|
//! [10]
|
||||||
|
|
||||||
//! [11]
|
//! [11]
|
||||||
speed += (-50 + qrand() % 100) / 100.0;
|
speed += (-50 + QRandomGenerator::global()->bounded(100)) / 100.0;
|
||||||
|
|
||||||
qreal dx = ::sin(angle) * 10;
|
qreal dx = ::sin(angle) * 10;
|
||||||
mouseEyeDirection = (qAbs(dx / 5) < 1) ? 0 : dx / 5;
|
mouseEyeDirection = (qAbs(dx / 5) < 1) ? 0 : dx / 5;
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
|
|
||||||
//! [0]
|
//! [0]
|
||||||
ColorItem::ColorItem()
|
ColorItem::ColorItem()
|
||||||
: color(qrand() % 256, qrand() % 256, qrand() % 256)
|
: color(QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256))
|
||||||
{
|
{
|
||||||
setToolTip(QString("QColor(%1, %2, %3)\n%4")
|
setToolTip(QString("QColor(%1, %2, %3)\n%4")
|
||||||
.arg(color.red()).arg(color.green()).arg(color.blue())
|
.arg(color.red()).arg(color.green()).arg(color.blue())
|
||||||
@ -107,7 +107,7 @@ void ColorItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
|
|
||||||
//! [6]
|
//! [6]
|
||||||
static int n = 0;
|
static int n = 0;
|
||||||
if (n++ > 2 && (qrand() % 3) == 0) {
|
if (n++ > 2 && QRandomGenerator::global()->bounded(3) == 0) {
|
||||||
QImage image(":/images/head.png");
|
QImage image(":/images/head.png");
|
||||||
mime->setImageData(image);
|
mime->setImageData(image);
|
||||||
|
|
||||||
|
@ -73,7 +73,6 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
|
|
||||||
//! [0]
|
//! [0]
|
||||||
//! [1]
|
//! [1]
|
||||||
QGraphicsScene scene(-200, -200, 400, 400);
|
QGraphicsScene scene(-200, -200, 400, 400);
|
||||||
|
@ -55,6 +55,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
#include <QRandomGenerator>
|
||||||
|
|
||||||
//! [0]
|
//! [0]
|
||||||
GraphWidget::GraphWidget(QWidget *parent)
|
GraphWidget::GraphWidget(QWidget *parent)
|
||||||
@ -247,7 +248,7 @@ void GraphWidget::shuffle()
|
|||||||
{
|
{
|
||||||
foreach (QGraphicsItem *item, scene()->items()) {
|
foreach (QGraphicsItem *item, scene()->items()) {
|
||||||
if (qgraphicsitem_cast<Node *>(item))
|
if (qgraphicsitem_cast<Node *>(item))
|
||||||
item->setPos(-150 + qrand() % 300, -150 + qrand() % 300);
|
item->setPos(-150 + QRandomGenerator::global()->bounded(300), -150 + QRandomGenerator::global()->bounded(300));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,6 @@
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
|
|
||||||
|
|
||||||
GraphWidget *widget = new GraphWidget;
|
GraphWidget *widget = new GraphWidget;
|
||||||
|
|
||||||
|
@ -114,8 +114,6 @@ void MainWindow::setupPuzzle()
|
|||||||
(puzzleImage.height() - size) / 2, size, size).scaled(puzzleWidget->imageSize(),
|
(puzzleImage.height() - size) / 2, size, size).scaled(puzzleWidget->imageSize(),
|
||||||
puzzleWidget->imageSize(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
puzzleWidget->imageSize(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||||
|
|
||||||
qsrand(QCursor::pos().x() ^ QCursor::pos().y());
|
|
||||||
|
|
||||||
model->addPieces(puzzleImage);
|
model->addPieces(puzzleImage);
|
||||||
puzzleWidget->clear();
|
puzzleWidget->clear();
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
|
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
|
#include <QRandomGenerator>
|
||||||
|
|
||||||
PiecesModel::PiecesModel(int pieceSize, QObject *parent)
|
PiecesModel::PiecesModel(int pieceSize, QObject *parent)
|
||||||
: QAbstractListModel(parent), m_PieceSize(pieceSize)
|
: QAbstractListModel(parent), m_PieceSize(pieceSize)
|
||||||
@ -77,7 +78,7 @@ QVariant PiecesModel::data(const QModelIndex &index, int role) const
|
|||||||
void PiecesModel::addPiece(const QPixmap &pixmap, const QPoint &location)
|
void PiecesModel::addPiece(const QPixmap &pixmap, const QPoint &location)
|
||||||
{
|
{
|
||||||
int row;
|
int row;
|
||||||
if (int(2.0 * qrand() / (RAND_MAX + 1.0)) == 1)
|
if (QRandomGenerator::global()->bounded(2) == 1)
|
||||||
row = 0;
|
row = 0;
|
||||||
else
|
else
|
||||||
row = pixmaps.size();
|
row = pixmaps.size();
|
||||||
|
@ -50,6 +50,8 @@
|
|||||||
|
|
||||||
#include "toolbar.h"
|
#include "toolbar.h"
|
||||||
|
|
||||||
|
#include <QRandomGenerator>
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
@ -257,7 +259,7 @@ void ToolBar::randomize()
|
|||||||
QList<QAction *> randomized;
|
QList<QAction *> randomized;
|
||||||
QList<QAction *> actions = this->actions();
|
QList<QAction *> actions = this->actions();
|
||||||
while (!actions.isEmpty()) {
|
while (!actions.isEmpty()) {
|
||||||
QAction *action = actions.takeAt(rand() % actions.size());
|
QAction *action = actions.takeAt(QRandomGenerator::global()->bounded(actions.size()));
|
||||||
randomized.append(action);
|
randomized.append(action);
|
||||||
}
|
}
|
||||||
clear();
|
clear();
|
||||||
|
@ -248,11 +248,9 @@ void Window::movePlayer(Direction direction)
|
|||||||
|
|
||||||
void Window::setupMap()
|
void Window::setupMap()
|
||||||
{
|
{
|
||||||
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
|
|
||||||
|
|
||||||
for (int x = 0; x < WIDTH; ++x)
|
for (int x = 0; x < WIDTH; ++x)
|
||||||
for (int y = 0; y < HEIGHT; ++y) {
|
for (int y = 0; y < HEIGHT; ++y) {
|
||||||
if (x == 0 || x == WIDTH - 1 || y == 0 || y == HEIGHT - 1 || qrand() % 40 == 0)
|
if (x == 0 || x == WIDTH - 1 || y == 0 || y == HEIGHT - 1 || QRandomGenerator::global()->bounded(40) == 0)
|
||||||
map[x][y] = '#';
|
map[x][y] = '#';
|
||||||
else
|
else
|
||||||
map[x][y] = '.';
|
map[x][y] = '.';
|
||||||
|
@ -101,7 +101,7 @@ QRect BasicToolsPlugin::mouseMove(const QString &brush, QPainter &painter,
|
|||||||
thickness, thickness);
|
thickness, thickness);
|
||||||
}
|
}
|
||||||
} else if (brush == tr("Random Letters")) {
|
} else if (brush == tr("Random Letters")) {
|
||||||
QChar ch('A' + (qrand() % 26));
|
QChar ch(QRandomGenerator::global()->bounded('A', 'Z' + 1));
|
||||||
|
|
||||||
QFont biggerFont = painter.font();
|
QFont biggerFont = painter.font();
|
||||||
biggerFont.setBold(true);
|
biggerFont.setBold(true);
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
#include <QUndoStack>
|
#include <QUndoStack>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QRandomGenerator>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
#include "document.h"
|
#include "document.h"
|
||||||
@ -321,7 +322,7 @@ void MainWindow::newDocument()
|
|||||||
|
|
||||||
static QColor randomColor()
|
static QColor randomColor()
|
||||||
{
|
{
|
||||||
int r = (int) (3.0*(rand()/(RAND_MAX + 1.0)));
|
int r = QRandomGenerator::global()->bounded(3);
|
||||||
switch (r) {
|
switch (r) {
|
||||||
case 0:
|
case 0:
|
||||||
return Qt::red;
|
return Qt::red;
|
||||||
@ -337,10 +338,10 @@ static QRect randomRect(const QSize &s)
|
|||||||
{
|
{
|
||||||
QSize min = Shape::minSize;
|
QSize min = Shape::minSize;
|
||||||
|
|
||||||
int left = (int) ((0.0 + s.width() - min.width())*(rand()/(RAND_MAX + 1.0)));
|
int left = (int) ((0.0 + s.width() - min.width())*(QRandomGenerator::global()->bounded(1.0)));
|
||||||
int top = (int) ((0.0 + s.height() - min.height())*(rand()/(RAND_MAX + 1.0)));
|
int top = (int) ((0.0 + s.height() - min.height())*(QRandomGenerator::global()->bounded(1.0)));
|
||||||
int width = (int) ((0.0 + s.width() - left - min.width())*(rand()/(RAND_MAX + 1.0))) + min.width();
|
int width = (int) ((0.0 + s.width() - left - min.width())*(QRandomGenerator::global()->bounded(1.0))) + min.width();
|
||||||
int height = (int) ((0.0 + s.height() - top - min.height())*(rand()/(RAND_MAX + 1.0))) + min.height();
|
int height = (int) ((0.0 + s.height() - top - min.height())*(QRandomGenerator::global()->bounded(1.0))) + min.height();
|
||||||
|
|
||||||
return QRect(left, top, width, height);
|
return QRect(left, top, width, height);
|
||||||
}
|
}
|
||||||
|
@ -65,8 +65,7 @@ DiagramItem::DiagramItem(DiagramType diagramType, QGraphicsItem *item)
|
|||||||
setPolygon(trianglePolygon);
|
setPolygon(trianglePolygon);
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor color(static_cast<int>(qrand()) % 256,
|
QColor color(QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256));
|
||||||
static_cast<int>(qrand()) % 256, static_cast<int>(qrand()) % 256);
|
|
||||||
QBrush brush(color);
|
QBrush brush(color);
|
||||||
setBrush(brush);
|
setBrush(brush);
|
||||||
setFlag(QGraphicsItem::ItemIsSelectable);
|
setFlag(QGraphicsItem::ItemIsSelectable);
|
||||||
|
@ -59,6 +59,5 @@ int main(int argc, char *argv[])
|
|||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
TetrixWindow window;
|
TetrixWindow window;
|
||||||
window.show();
|
window.show();
|
||||||
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
//! [0]
|
//! [0]
|
||||||
void TetrixPiece::setRandomShape()
|
void TetrixPiece::setRandomShape()
|
||||||
{
|
{
|
||||||
setShape(TetrixShape(qrand() % 7 + 1));
|
setShape(TetrixShape(QRandomGenerator::global()->bounded(7) + 1));
|
||||||
}
|
}
|
||||||
//! [0]
|
//! [0]
|
||||||
|
|
||||||
|
@ -57,7 +57,6 @@ int main(int argc, char *argv[])
|
|||||||
Q_INIT_RESOURCE(tooltips);
|
Q_INIT_RESOURCE(tooltips);
|
||||||
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
|
|
||||||
SortingBox sortingBox;
|
SortingBox sortingBox;
|
||||||
sortingBox.show();
|
sortingBox.show();
|
||||||
return app.exec();
|
return app.exec();
|
||||||
|
@ -292,7 +292,7 @@ QPoint SortingBox::initialItemPosition(const QPainterPath &path)
|
|||||||
//! [24]
|
//! [24]
|
||||||
QPoint SortingBox::randomItemPosition()
|
QPoint SortingBox::randomItemPosition()
|
||||||
{
|
{
|
||||||
return QPoint(qrand() % (width() - 120), qrand() % (height() - 120));
|
return QPoint(QRandomGenerator::global()->bounded(width() - 120), QRandomGenerator::global()->bounded(height() - 120));
|
||||||
}
|
}
|
||||||
//! [24]
|
//! [24]
|
||||||
|
|
||||||
@ -306,6 +306,6 @@ QColor SortingBox::initialItemColor()
|
|||||||
//! [26]
|
//! [26]
|
||||||
QColor SortingBox::randomItemColor()
|
QColor SortingBox::randomItemColor()
|
||||||
{
|
{
|
||||||
return QColor::fromHsv(qrand() % 256, 255, 190);
|
return QColor::fromHsv(QRandomGenerator::global()->bounded(256), 255, 190);
|
||||||
}
|
}
|
||||||
//! [26]
|
//! [26]
|
||||||
|
@ -1,40 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2015 The Qt Company Ltd.
|
|
||||||
** Contact: http://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of the FOO module of the Qt Toolkit.
|
|
||||||
**
|
|
||||||
** $QT_BEGIN_LICENSE:BSD-OLD$
|
|
||||||
** You may use this file under the terms of the BSD license as follows:
|
|
||||||
**
|
|
||||||
** "Redistribution and use in source and binary forms, with or without
|
|
||||||
** modification, are permitted provided that the following conditions are
|
|
||||||
** met:
|
|
||||||
** * Redistributions of source code must retain the above copyright
|
|
||||||
** notice, this list of conditions and the following disclaimer.
|
|
||||||
** * Redistributions in binary form must reproduce the above copyright
|
|
||||||
** notice, this list of conditions and the following disclaimer in
|
|
||||||
** the documentation and/or other materials provided with the
|
|
||||||
** distribution.
|
|
||||||
** * Neither the name of The Qt Company Ltd nor the names of its
|
|
||||||
** contributors may be used to endorse or promote products derived
|
|
||||||
** from this software without specific prior written permission.
|
|
||||||
**
|
|
||||||
**
|
|
||||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
|
||||||
**
|
|
||||||
** $QT_END_LICENSE$
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2015 The Qt Company Ltd.
|
|
||||||
** Contact: http://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of the documentation of the Qt Toolkit.
|
|
||||||
**
|
|
||||||
** $QT_BEGIN_LICENSE:FDL-OLD$
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at http://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU Free Documentation License Usage
|
|
||||||
** 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. Please review the following information to ensure
|
|
||||||
** the GNU Free Documentation License version 1.3 requirements
|
|
||||||
** will be met: http://www.gnu.org/copyleft/fdl.html.
|
|
||||||
** $QT_END_LICENSE$
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
@ -32,7 +32,7 @@ qt_install_headers {
|
|||||||
class_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME
|
class_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME
|
||||||
INSTALLS += class_headers
|
INSTALLS += class_headers
|
||||||
|
|
||||||
targ_headers.files = $$SYNCQT.HEADER_FILES
|
targ_headers.files = $$SYNCQT.HEADER_FILES $$SYNCQT.INJECTED_HEADER_FILES
|
||||||
targ_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME
|
targ_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME
|
||||||
INSTALLS += targ_headers
|
INSTALLS += targ_headers
|
||||||
|
|
||||||
|
@ -136,9 +136,17 @@ lib_bundle {
|
|||||||
if(if(!debug_and_release|CONFIG(release, debug|release))) {
|
if(if(!debug_and_release|CONFIG(release, debug|release))) {
|
||||||
FRAMEWORK_HEADERS.version = Versions
|
FRAMEWORK_HEADERS.version = Versions
|
||||||
FRAMEWORK_HEADERS.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES
|
FRAMEWORK_HEADERS.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES
|
||||||
|
# Non-existing paths (yet, they will be generated) are used verbatim.
|
||||||
|
for (injected_header, SYNCQT.INJECTED_HEADER_FILES): \
|
||||||
|
FRAMEWORK_HEADERS.files += \
|
||||||
|
$$relative_path($$absolute_path($$injected_header, $$_PRO_FILE_PWD_), $$OUT_PWD)
|
||||||
|
|
||||||
FRAMEWORK_HEADERS.path = Headers
|
FRAMEWORK_HEADERS.path = Headers
|
||||||
FRAMEWORK_PRIVATE_HEADERS.version = Versions
|
FRAMEWORK_PRIVATE_HEADERS.version = Versions
|
||||||
FRAMEWORK_PRIVATE_HEADERS.files = $$SYNCQT.PRIVATE_HEADER_FILES $$SYNCQT.INJECTED_PRIVATE_HEADER_FILES
|
FRAMEWORK_PRIVATE_HEADERS.files = $$SYNCQT.PRIVATE_HEADER_FILES
|
||||||
|
for (injected_header, SYNCQT.INJECTED_PRIVATE_HEADER_FILES): \
|
||||||
|
FRAMEWORK_PRIVATE_HEADERS.files += \
|
||||||
|
$$relative_path($$absolute_path($$injected_header, $$_PRO_FILE_PWD_), $$OUT_PWD)
|
||||||
FRAMEWORK_PRIVATE_HEADERS.path = Headers/$$VERSION/$$MODULE_INCNAME/private
|
FRAMEWORK_PRIVATE_HEADERS.path = Headers/$$VERSION/$$MODULE_INCNAME/private
|
||||||
FRAMEWORK_QPA_HEADERS.version = Versions
|
FRAMEWORK_QPA_HEADERS.version = Versions
|
||||||
FRAMEWORK_QPA_HEADERS.files = $$SYNCQT.QPA_HEADER_FILES
|
FRAMEWORK_QPA_HEADERS.files = $$SYNCQT.QPA_HEADER_FILES
|
||||||
|
@ -40,10 +40,12 @@
|
|||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
booted_simulator=$($DIR/devices.pl "$1" "Booted" "NOT unavailable" | tail -n 1)
|
scheme=$1
|
||||||
|
shift
|
||||||
|
booted_simulator=$($DIR/devices.py --state booted $@ | tail -n 1)
|
||||||
echo "SIMULATOR_DEVICES = $booted_simulator"
|
echo "SIMULATOR_DEVICES = $booted_simulator"
|
||||||
|
|
||||||
xcodebuild test -scheme $2 -destination 'id=0' -destination-timeout 1 2>&1| sed -n 's/{ \(platform:.*\) }/\1/p' | while read destination; do
|
xcodebuild test -scheme $scheme -destination 'id=0' -destination-timeout 1 2>&1| sed -n 's/{ \(platform:.*\) }/\1/p' | while read destination; do
|
||||||
id=$(echo $destination | sed -n -E 's/.*id:([^ ,]+).*/\1/p')
|
id=$(echo $destination | sed -n -E 's/.*id:([^ ,]+).*/\1/p')
|
||||||
[[ $id == *"placeholder"* ]] && continue
|
[[ $id == *"placeholder"* ]] && continue
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/bin/python
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
##
|
##
|
||||||
@ -39,18 +39,44 @@
|
|||||||
##
|
##
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
$output = `xcrun simctl list devices --json 2>&1`;
|
from __future__ import print_function
|
||||||
$output =~ s/\n//g;
|
|
||||||
|
|
||||||
BLOCK:
|
import argparse
|
||||||
foreach $block ($output =~ /{.*?}/g) {
|
import json
|
||||||
foreach $filter (@ARGV) {
|
import subprocess
|
||||||
if ($filter =~ /^NOT\s(.*)/) {
|
from distutils.version import StrictVersion
|
||||||
$block =~ /$1/ && next BLOCK;
|
|
||||||
} else {
|
def is_suitable_runtime(runtimes, runtime_name, platform, min_version):
|
||||||
$block =~ /$filter/ || next BLOCK;
|
for runtime in runtimes:
|
||||||
}
|
identifier = runtime["identifier"]
|
||||||
}
|
if (runtime["name"] == runtime_name or identifier == runtime_name) \
|
||||||
$block =~ /udid[:|\s|\"]+(.*)\"/;
|
and "unavailable" not in runtime["availability"] \
|
||||||
print "$1\n";
|
and identifier.startswith("com.apple.CoreSimulator.SimRuntime.{}".format(platform)) \
|
||||||
}
|
and StrictVersion(runtime["version"]) >= min_version:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def simctl_runtimes():
|
||||||
|
return json.loads(subprocess.check_output(
|
||||||
|
["/usr/bin/xcrun", "simctl", "list", "runtimes", "--json"]))["runtimes"]
|
||||||
|
|
||||||
|
def simctl_devices():
|
||||||
|
return json.loads(subprocess.check_output(
|
||||||
|
["/usr/bin/xcrun", "simctl", "list", "devices", "--json"]))["devices"]
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument('--platform', choices=['iOS', 'tvOS', 'watchOS'], required=True)
|
||||||
|
parser.add_argument('--minimum-deployment-target', type=StrictVersion, default='0.0')
|
||||||
|
parser.add_argument('--state',
|
||||||
|
choices=['booted', 'shutdown', 'creating', 'booting', 'shutting-down'], action='append')
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
runtimes = simctl_runtimes()
|
||||||
|
device_dict = simctl_devices()
|
||||||
|
for runtime_name in device_dict:
|
||||||
|
if is_suitable_runtime(runtimes, runtime_name, args.platform, args.minimum_deployment_target):
|
||||||
|
for device in device_dict[runtime_name]:
|
||||||
|
if "unavailable" not in device["availability"] \
|
||||||
|
and (args.state is None or device["state"].lower() in args.state):
|
||||||
|
print(device["udid"])
|
@ -63,7 +63,7 @@ ifneq ($(filter check%,$(MAKECMDGOALS)),)
|
|||||||
ifeq ($(DEVICES),)
|
ifeq ($(DEVICES),)
|
||||||
$(info Enumerating test destinations (you may override this by setting DEVICES explicitly), please wait...)
|
$(info Enumerating test destinations (you may override this by setting DEVICES explicitly), please wait...)
|
||||||
DESTINATIONS_INCLUDE = /tmp/device_destinations.mk
|
DESTINATIONS_INCLUDE = /tmp/device_destinations.mk
|
||||||
$(shell $(MAKEFILE_DIR)device_destinations.sh '$(EXPORT_DEVICE_FILTER)' $(TARGET) > $(DESTINATIONS_INCLUDE))
|
$(shell $(MAKEFILE_DIR)device_destinations.sh $(TARGET) $(EXPORT_DEVICE_FILTER) > $(DESTINATIONS_INCLUDE))
|
||||||
include $(DESTINATIONS_INCLUDE)
|
include $(DESTINATIONS_INCLUDE)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@ -72,7 +72,7 @@ endif
|
|||||||
%-device: DEVICES = $(HARDWARE_DEVICES)
|
%-device: DEVICES = $(HARDWARE_DEVICES)
|
||||||
|
|
||||||
GENERIC_DEVICE_DESTINATION := $(EXPORT_GENERIC_DEVICE_DESTINATION)
|
GENERIC_DEVICE_DESTINATION := $(EXPORT_GENERIC_DEVICE_DESTINATION)
|
||||||
GENERIC_SIMULATOR_DESTINATION := "id=$(shell $(MAKEFILE_DIR)devices.pl '$(EXPORT_DEVICE_FILTER)' "NOT unavailable" | tail -n 1)"
|
GENERIC_SIMULATOR_DESTINATION := "id=$(shell $(MAKEFILE_DIR)devices.py $(EXPORT_DEVICE_FILTER) | tail -n 1)"
|
||||||
|
|
||||||
%-simulator: DESTINATION = $(if $(DESTINATION_ID),"id=$(DESTINATION_ID)",$(GENERIC_SIMULATOR_DESTINATION))
|
%-simulator: DESTINATION = $(if $(DESTINATION_ID),"id=$(DESTINATION_ID)",$(GENERIC_SIMULATOR_DESTINATION))
|
||||||
%-device: DESTINATION = $(if $(DESTINATION_ID),"id=$(DESTINATION_ID)",$(GENERIC_DEVICE_DESTINATION))
|
%-device: DESTINATION = $(if $(DESTINATION_ID),"id=$(DESTINATION_ID)",$(GENERIC_DEVICE_DESTINATION))
|
||||||
|
@ -40,15 +40,15 @@ CONFIG += no_default_goal_deps
|
|||||||
DEVICE_SDK = $${device.sdk}
|
DEVICE_SDK = $${device.sdk}
|
||||||
SIMULATOR_SDK = $${simulator.sdk}
|
SIMULATOR_SDK = $${simulator.sdk}
|
||||||
ios {
|
ios {
|
||||||
DEVICE_FILTER = "iPhone|iPad"
|
DEVICE_FILTER = --platform iOS --minimum-deployment-target $$QMAKE_IOS_DEPLOYMENT_TARGET
|
||||||
GENERIC_DEVICE_DESTINATION = "generic/platform=iOS"
|
GENERIC_DEVICE_DESTINATION = "generic/platform=iOS"
|
||||||
}
|
}
|
||||||
tvos {
|
tvos {
|
||||||
DEVICE_FILTER = "Apple TV"
|
DEVICE_FILTER = --platform tvOS --minimum-deployment-target $$QMAKE_TVOS_DEPLOYMENT_TARGET
|
||||||
GENERIC_DEVICE_DESTINATION = "generic/platform=tvOS"
|
GENERIC_DEVICE_DESTINATION = "generic/platform=tvOS"
|
||||||
}
|
}
|
||||||
watchos {
|
watchos {
|
||||||
DEVICE_FILTER = "Apple Watch"
|
DEVICE_FILTER = --platform watchOS --minimum-deployment-target $$QMAKE_WATCHOS_DEPLOYMENT_TARGET
|
||||||
GENERIC_DEVICE_DESTINATION = "generic/platform=watchOS"
|
GENERIC_DEVICE_DESTINATION = "generic/platform=watchOS"
|
||||||
}
|
}
|
||||||
QMAKE_EXTRA_VARIABLES += DEVICE_SDK SIMULATOR_SDK DEVICE_FILTER GENERIC_DEVICE_DESTINATION
|
QMAKE_EXTRA_VARIABLES += DEVICE_SDK SIMULATOR_SDK DEVICE_FILTER GENERIC_DEVICE_DESTINATION
|
||||||
|
@ -62,6 +62,7 @@
|
|||||||
useCustomWorkingDirectory = "NO"
|
useCustomWorkingDirectory = "NO"
|
||||||
buildConfiguration = "Debug"
|
buildConfiguration = "Debug"
|
||||||
ignoresPersistentStateOnLaunch = "NO"
|
ignoresPersistentStateOnLaunch = "NO"
|
||||||
|
disableMainThreadChecker = "YES"
|
||||||
debugDocumentVersioning = "NO"
|
debugDocumentVersioning = "NO"
|
||||||
allowLocationSimulation = "YES">
|
allowLocationSimulation = "YES">
|
||||||
<BuildableProductRunnable>
|
<BuildableProductRunnable>
|
||||||
|
43
src/3rdparty/freetype/BDF-LICENSE.txt
vendored
Normal file
43
src/3rdparty/freetype/BDF-LICENSE.txt
vendored
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
Copyright (C) 2001-2002 by Francesco Zappa Nardelli
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
*** Portions of the driver (that is, bdflib.c and bdf.h):
|
||||||
|
|
||||||
|
Copyright 2000 Computing Research Labs, New Mexico State University
|
||||||
|
Copyright 2001-2002, 2011 Francesco Zappa Nardelli
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
|
||||||
|
OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||||
|
THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
551
src/3rdparty/freetype/LICENSE.txt
vendored
Normal file
551
src/3rdparty/freetype/LICENSE.txt
vendored
Normal file
@ -0,0 +1,551 @@
|
|||||||
|
The FreeType 2 font engine is copyrighted work and cannot be used
|
||||||
|
legally without a software license. In order to make this project
|
||||||
|
usable to a vast majority of developers, we distribute it under two
|
||||||
|
mutually exclusive open-source licenses.
|
||||||
|
|
||||||
|
This means that *you* must choose *one* of the two licenses described
|
||||||
|
below, then obey all its terms and conditions when using FreeType 2 in
|
||||||
|
any of your projects or products.
|
||||||
|
|
||||||
|
- The FreeType License, found in the file `FTL.TXT', which is similar
|
||||||
|
to the original BSD license *with* an advertising clause that forces
|
||||||
|
you to explicitly cite the FreeType project in your product's
|
||||||
|
documentation. All details are in the license file. This license
|
||||||
|
is suited to products which don't use the GNU General Public
|
||||||
|
License.
|
||||||
|
|
||||||
|
Note that this license is compatible to the GNU General Public
|
||||||
|
License version 3, but not version 2.
|
||||||
|
|
||||||
|
- The GNU General Public License version 2, found in `GPLv2.TXT' (any
|
||||||
|
later version can be used also), for programs which already use the
|
||||||
|
GPL. Note that the FTL is incompatible with GPLv2 due to its
|
||||||
|
advertisement clause.
|
||||||
|
|
||||||
|
The contributed BDF and PCF drivers come with a license similar to that
|
||||||
|
of the X Window System. It is compatible to the above two licenses (see
|
||||||
|
file src/bdf/README and src/pcf/README).
|
||||||
|
|
||||||
|
The gzip module uses the zlib license (see src/gzip/zlib.h) which too is
|
||||||
|
compatible to the above two licenses.
|
||||||
|
|
||||||
|
The MD5 checksum support (only used for debugging in development builds)
|
||||||
|
is in the public domain.
|
||||||
|
|
||||||
|
|
||||||
|
--- FDL.TXT ---
|
||||||
|
|
||||||
|
The FreeType Project LICENSE
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
2006-Jan-27
|
||||||
|
|
||||||
|
Copyright 1996-2002, 2006 by
|
||||||
|
David Turner, Robert Wilhelm, and Werner Lemberg
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Introduction
|
||||||
|
============
|
||||||
|
|
||||||
|
The FreeType Project is distributed in several archive packages;
|
||||||
|
some of them may contain, in addition to the FreeType font engine,
|
||||||
|
various tools and contributions which rely on, or relate to, the
|
||||||
|
FreeType Project.
|
||||||
|
|
||||||
|
This license applies to all files found in such packages, and
|
||||||
|
which do not fall under their own explicit license. The license
|
||||||
|
affects thus the FreeType font engine, the test programs,
|
||||||
|
documentation and makefiles, at the very least.
|
||||||
|
|
||||||
|
This license was inspired by the BSD, Artistic, and IJG
|
||||||
|
(Independent JPEG Group) licenses, which all encourage inclusion
|
||||||
|
and use of free software in commercial and freeware products
|
||||||
|
alike. As a consequence, its main points are that:
|
||||||
|
|
||||||
|
o We don't promise that this software works. However, we will be
|
||||||
|
interested in any kind of bug reports. (`as is' distribution)
|
||||||
|
|
||||||
|
o You can use this software for whatever you want, in parts or
|
||||||
|
full form, without having to pay us. (`royalty-free' usage)
|
||||||
|
|
||||||
|
o You may not pretend that you wrote this software. If you use
|
||||||
|
it, or only parts of it, in a program, you must acknowledge
|
||||||
|
somewhere in your documentation that you have used the
|
||||||
|
FreeType code. (`credits')
|
||||||
|
|
||||||
|
We specifically permit and encourage the inclusion of this
|
||||||
|
software, with or without modifications, in commercial products.
|
||||||
|
We disclaim all warranties covering The FreeType Project and
|
||||||
|
assume no liability related to The FreeType Project.
|
||||||
|
|
||||||
|
|
||||||
|
Finally, many people asked us for a preferred form for a
|
||||||
|
credit/disclaimer to use in compliance with this license. We thus
|
||||||
|
encourage you to use the following text:
|
||||||
|
|
||||||
|
"""
|
||||||
|
Portions of this software are copyright © <year> The FreeType
|
||||||
|
Project (www.freetype.org). All rights reserved.
|
||||||
|
"""
|
||||||
|
|
||||||
|
Please replace <year> with the value from the FreeType version you
|
||||||
|
actually use.
|
||||||
|
|
||||||
|
|
||||||
|
Legal Terms
|
||||||
|
===========
|
||||||
|
|
||||||
|
0. Definitions
|
||||||
|
--------------
|
||||||
|
|
||||||
|
Throughout this license, the terms `package', `FreeType Project',
|
||||||
|
and `FreeType archive' refer to the set of files originally
|
||||||
|
distributed by the authors (David Turner, Robert Wilhelm, and
|
||||||
|
Werner Lemberg) as the `FreeType Project', be they named as alpha,
|
||||||
|
beta or final release.
|
||||||
|
|
||||||
|
`You' refers to the licensee, or person using the project, where
|
||||||
|
`using' is a generic term including compiling the project's source
|
||||||
|
code as well as linking it to form a `program' or `executable'.
|
||||||
|
This program is referred to as `a program using the FreeType
|
||||||
|
engine'.
|
||||||
|
|
||||||
|
This license applies to all files distributed in the original
|
||||||
|
FreeType Project, including all source code, binaries and
|
||||||
|
documentation, unless otherwise stated in the file in its
|
||||||
|
original, unmodified form as distributed in the original archive.
|
||||||
|
If you are unsure whether or not a particular file is covered by
|
||||||
|
this license, you must contact us to verify this.
|
||||||
|
|
||||||
|
The FreeType Project is copyright (C) 1996-2000 by David Turner,
|
||||||
|
Robert Wilhelm, and Werner Lemberg. All rights reserved except as
|
||||||
|
specified below.
|
||||||
|
|
||||||
|
1. No Warranty
|
||||||
|
--------------
|
||||||
|
|
||||||
|
THE FREETYPE PROJECT IS PROVIDED `AS IS' WITHOUT WARRANTY OF ANY
|
||||||
|
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS
|
||||||
|
BE LIABLE FOR ANY DAMAGES CAUSED BY THE USE OR THE INABILITY TO
|
||||||
|
USE, OF THE FREETYPE PROJECT.
|
||||||
|
|
||||||
|
2. Redistribution
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
This license grants a worldwide, royalty-free, perpetual and
|
||||||
|
irrevocable right and license to use, execute, perform, compile,
|
||||||
|
display, copy, create derivative works of, distribute and
|
||||||
|
sublicense the FreeType Project (in both source and object code
|
||||||
|
forms) and derivative works thereof for any purpose; and to
|
||||||
|
authorize others to exercise some or all of the rights granted
|
||||||
|
herein, subject to the following conditions:
|
||||||
|
|
||||||
|
o Redistribution of source code must retain this license file
|
||||||
|
(`FTL.TXT') unaltered; any additions, deletions or changes to
|
||||||
|
the original files must be clearly indicated in accompanying
|
||||||
|
documentation. The copyright notices of the unaltered,
|
||||||
|
original files must be preserved in all copies of source
|
||||||
|
files.
|
||||||
|
|
||||||
|
o Redistribution in binary form must provide a disclaimer that
|
||||||
|
states that the software is based in part of the work of the
|
||||||
|
FreeType Team, in the distribution documentation. We also
|
||||||
|
encourage you to put an URL to the FreeType web page in your
|
||||||
|
documentation, though this isn't mandatory.
|
||||||
|
|
||||||
|
These conditions apply to any software derived from or based on
|
||||||
|
the FreeType Project, not just the unmodified files. If you use
|
||||||
|
our work, you must acknowledge us. However, no fee need be paid
|
||||||
|
to us.
|
||||||
|
|
||||||
|
3. Advertising
|
||||||
|
--------------
|
||||||
|
|
||||||
|
Neither the FreeType authors and contributors nor you shall use
|
||||||
|
the name of the other for commercial, advertising, or promotional
|
||||||
|
purposes without specific prior written permission.
|
||||||
|
|
||||||
|
We suggest, but do not require, that you use one or more of the
|
||||||
|
following phrases to refer to this software in your documentation
|
||||||
|
or advertising materials: `FreeType Project', `FreeType Engine',
|
||||||
|
`FreeType library', or `FreeType Distribution'.
|
||||||
|
|
||||||
|
As you have not signed this license, you are not required to
|
||||||
|
accept it. However, as the FreeType Project is copyrighted
|
||||||
|
material, only this license, or another one contracted with the
|
||||||
|
authors, grants you the right to use, distribute, and modify it.
|
||||||
|
Therefore, by using, distributing, or modifying the FreeType
|
||||||
|
Project, you indicate that you understand and accept all the terms
|
||||||
|
of this license.
|
||||||
|
|
||||||
|
4. Contacts
|
||||||
|
-----------
|
||||||
|
|
||||||
|
There are two mailing lists related to FreeType:
|
||||||
|
|
||||||
|
o freetype@nongnu.org
|
||||||
|
|
||||||
|
Discusses general use and applications of FreeType, as well as
|
||||||
|
future and wanted additions to the library and distribution.
|
||||||
|
If you are looking for support, start in this list if you
|
||||||
|
haven't found anything to help you in the documentation.
|
||||||
|
|
||||||
|
o freetype-devel@nongnu.org
|
||||||
|
|
||||||
|
Discusses bugs, as well as engine internals, design issues,
|
||||||
|
specific licenses, porting, etc.
|
||||||
|
|
||||||
|
Our home page can be found at
|
||||||
|
|
||||||
|
http://www.freetype.org
|
||||||
|
|
||||||
|
--- end of FDL.TXT ---
|
||||||
|
|
||||||
|
--- GPLv2.TXT ---
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
|
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Library General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Library General
|
||||||
|
Public License instead of this License.
|
||||||
|
|
||||||
|
--- end of GPLv2.TXT ---
|
||||||
|
|
20
src/3rdparty/freetype/PCF-LICENSE.txt
vendored
Normal file
20
src/3rdparty/freetype/PCF-LICENSE.txt
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
Copyright (C) 2000 by Francesco Zappa Nardelli
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
20
src/3rdparty/freetype/ZLIB-LICENSE.txt
vendored
Normal file
20
src/3rdparty/freetype/ZLIB-LICENSE.txt
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
|
Jean-loup Gailly Mark Adler
|
||||||
|
jloup@gzip.org madler@alumni.caltech.edu
|
67
src/3rdparty/freetype/qt_attribution.json
vendored
67
src/3rdparty/freetype/qt_attribution.json
vendored
@ -1,13 +1,56 @@
|
|||||||
{
|
[
|
||||||
"Id": "freetype",
|
{
|
||||||
"Name": "Freetype 2",
|
"Id": "freetype",
|
||||||
"QDocModule": "qtgui",
|
"Name": "Freetype 2",
|
||||||
"QtUsage": "Optionally used in Qt GUI and platform plugins. Configure with -no-freetype, or -system-freetype to avoid.",
|
"QDocModule": "qtgui",
|
||||||
|
"QtUsage": "Optionally used in Qt GUI and platform plugins. Configure with -no-freetype, or -system-freetype to avoid.",
|
||||||
|
|
||||||
"Description": "FreeType is a freely available software library to render fonts.",
|
"Description": "FreeType is a freely available software library to render fonts.",
|
||||||
"Homepage": "http://www.freetype.org",
|
"Homepage": "http://www.freetype.org",
|
||||||
"License": "Freetype Project License or GNU General Public License v2.0 only",
|
"License": "Freetype Project License or GNU General Public License v2.0 only",
|
||||||
"LicenseId": "FTL or GPL-2.0",
|
"LicenseId": "FTL OR GPL-2.0",
|
||||||
"LicenseFile": "docs/LICENSE.TXT",
|
"LicenseFile": "LICENSE.TXT",
|
||||||
"Copyright": "Copyright 2006-2015 by David Turner, Robert Wilhelm, and Werner Lemberg."
|
"Copyright": "Copyright 2006-2015 by David Turner, Robert Wilhelm, and Werner Lemberg."
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"Id": "freetype-zlib",
|
||||||
|
"Name": "Freetype 2 - zlib",
|
||||||
|
"QDocModule": "qtgui",
|
||||||
|
"QtUsage": "Optionally used in Qt GUI and platform plugins. Configure with -no-freetype, or -system-freetype to avoid.",
|
||||||
|
|
||||||
|
"Description": "FreeType is a freely available software library to render fonts.",
|
||||||
|
"Homepage": "http://www.freetype.org",
|
||||||
|
"License": "zlib License",
|
||||||
|
"LicenseId": "Zlib",
|
||||||
|
"LicenseFile": "ZLIB-LICENSE.TXT",
|
||||||
|
"Copyright": "Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Id": "freetype-bdf",
|
||||||
|
"Name": "Freetype 2 - Bitmap Distribution Format (BDF) support",
|
||||||
|
"QDocModule": "qtgui",
|
||||||
|
"QtUsage": "Optionally used in Qt GUI and platform plugins. Configure with -no-freetype, or -system-freetype to avoid.",
|
||||||
|
|
||||||
|
"Description": "FreeType is a freely available software library to render fonts.",
|
||||||
|
"Homepage": "http://www.freetype.org",
|
||||||
|
"License": "MIT License",
|
||||||
|
"LicenseId": "MIT",
|
||||||
|
"LicenseFile": "BDF-LICENSE.TXT",
|
||||||
|
"Copyright": "Copyright (C) 2001-2002 by Francesco Zappa Nardelli
|
||||||
|
Copyright 2000 Computing Research Labs, New Mexico State University
|
||||||
|
Copyright 2001-2002, 2011 Francesco Zappa Nardelli"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Id": "freetype-pcf",
|
||||||
|
"Name": "Freetype 2 - Portable Compiled Format (PCF) support",
|
||||||
|
"QDocModule": "qtgui",
|
||||||
|
"QtUsage": "Optionally used in Qt GUI and platform plugins. Configure with -no-freetype, or -system-freetype to avoid.",
|
||||||
|
|
||||||
|
"Description": "FreeType is a freely available software library to render fonts.",
|
||||||
|
"Homepage": "http://www.freetype.org",
|
||||||
|
"License": "MIT License",
|
||||||
|
"LicenseId": "MIT",
|
||||||
|
"LicenseFile": "PCF-LICENSE.TXT",
|
||||||
|
"Copyright": "Copyright (C) 2000 by Francesco Zappa Nardelli"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
77
src/3rdparty/libpng/ANNOUNCE
vendored
77
src/3rdparty/libpng/ANNOUNCE
vendored
@ -1,4 +1,4 @@
|
|||||||
Libpng 1.6.32 - August 24, 2017
|
Libpng 1.6.34 - September 29, 2017
|
||||||
|
|
||||||
This is a public release of libpng, intended for use in production codes.
|
This is a public release of libpng, intended for use in production codes.
|
||||||
|
|
||||||
@ -7,79 +7,24 @@ Files available for download:
|
|||||||
Source files with LF line endings (for Unix/Linux) and with a
|
Source files with LF line endings (for Unix/Linux) and with a
|
||||||
"configure" script
|
"configure" script
|
||||||
|
|
||||||
libpng-1.6.32.tar.xz (LZMA-compressed, recommended)
|
libpng-1.6.34.tar.xz (LZMA-compressed, recommended)
|
||||||
libpng-1.6.32.tar.gz
|
libpng-1.6.34.tar.gz
|
||||||
|
|
||||||
Source files with CRLF line endings (for Windows), without the
|
Source files with CRLF line endings (for Windows), without the
|
||||||
"configure" script
|
"configure" script
|
||||||
|
|
||||||
lpng1632.7z (LZMA-compressed, recommended)
|
lpng1634.7z (LZMA-compressed, recommended)
|
||||||
lpng1632.zip
|
lpng1634.zip
|
||||||
|
|
||||||
Other information:
|
Other information:
|
||||||
|
|
||||||
libpng-1.6.32-README.txt
|
libpng-1.6.34-README.txt
|
||||||
libpng-1.6.32-LICENSE.txt
|
libpng-1.6.34-LICENSE.txt
|
||||||
libpng-1.6.32-*.asc (armored detached GPG signatures)
|
libpng-1.6.34-*.asc (armored detached GPG signatures)
|
||||||
|
|
||||||
Changes since the last public release (1.6.31):
|
Changes since the last public release (1.6.33):
|
||||||
Avoid possible NULL dereference in png_handle_eXIf when benign_errors
|
Removed contrib/pngsuite/i*.png; some of these were incorrect and caused
|
||||||
are allowed. Avoid leaking the input buffer "eXIf_buf".
|
test failures.
|
||||||
Eliminated png_ptr->num_exif member from pngstruct.h and added num_exif
|
|
||||||
to arguments for png_get_eXIf() and png_set_eXIf().
|
|
||||||
Added calls to png_handle_eXIf(() in pngread.c and png_write_eXIf() in
|
|
||||||
pngwrite.c, and made various other fixes to png_write_eXIf().
|
|
||||||
Changed name of png_get_eXIF and png_set_eXIf() to png_get_eXIf_1() and
|
|
||||||
png_set_eXIf_1(), respectively, to avoid breaking API compatibility
|
|
||||||
with libpng-1.6.31.
|
|
||||||
Updated contrib/libtests/pngunknown.c with eXIf chunk.
|
|
||||||
Initialized btoa[] in pngstest.c
|
|
||||||
Stop memory leak when returning from png_handle_eXIf() with an error
|
|
||||||
(Bug report from the OSS-fuzz project).
|
|
||||||
Replaced local eXIf_buf with info_ptr-eXIf_buf in png_handle_eXIf().
|
|
||||||
Update libpng.3 and libpng-manual.txt about eXIf functions.
|
|
||||||
Restored png_get_eXIf() and png_set_eXIf() to maintain API compatability.
|
|
||||||
Removed png_get_eXIf_1() and png_set_eXIf_1().
|
|
||||||
Check length of all chunks except IDAT against user limit to fix an
|
|
||||||
OSS-fuzz issue.
|
|
||||||
Check length of IDAT against maximum possible IDAT size, accounting
|
|
||||||
for height, rowbytes, interlacing and zlib/deflate overhead.
|
|
||||||
Restored png_get_eXIf_1() and png_set_eXIf_1(), because strlen(eXIf_buf)
|
|
||||||
does not work (the eXIf chunk data can contain zeroes).
|
|
||||||
Require cmake-2.8.8 in CMakeLists.txt. Revised symlink creation,
|
|
||||||
no longer using deprecated cmake LOCATION feature (Clifford Yapp).
|
|
||||||
Fixed five-byte error in the calculation of IDAT maximum possible size.
|
|
||||||
Moved chunk-length check into a png_check_chunk_length() private
|
|
||||||
function (Suggested by Max Stepin).
|
|
||||||
Moved bad pngs from tests to contrib/libtests/crashers
|
|
||||||
Moved testing of bad pngs into a separate tests/pngtest-badpngs script
|
|
||||||
Added the --xfail (expected FAIL) option to pngtest.c. It writes XFAIL
|
|
||||||
in the output but PASS for the libpng test.
|
|
||||||
Require cmake-3.0.2 in CMakeLists.txt (Clifford Yapp).
|
|
||||||
Fix "const" declaration info_ptr argument to png_get_eXIf_1() and the
|
|
||||||
num_exif argument to png_get_eXIf_1() (Github Issue 171).
|
|
||||||
Added "eXIf" to "chunks_to_ignore[]" in png_set_keep_unknown_chunks().
|
|
||||||
Added huge_IDAT.png and empty_ancillary_chunks.png to testpngs/crashers.
|
|
||||||
Make pngtest --strict, --relax, --xfail options imply -m (multiple).
|
|
||||||
Removed unused chunk_name parameter from png_check_chunk_length().
|
|
||||||
Relocated setting free_me for eXIf data, to stop an OSS-fuzz leak.
|
|
||||||
Initialize profile_header[] in png_handle_iCCP() to fix OSS-fuzz issue.
|
|
||||||
Initialize png_ptr->row_buf[0] to 255 in png_read_row() to fix OSS-fuzz UMR.
|
|
||||||
Attempt to fix a UMR in png_set_text_2() to fix OSS-fuzz issue.
|
|
||||||
Increase minimum zlib stream from 9 to 14 in png_handle_iCCP(), to account
|
|
||||||
for the minimum 'deflate' stream, and relocate the test to a point
|
|
||||||
after the keyword has been read.
|
|
||||||
Check that the eXIf chunk has at least 2 bytes and begins with "II" or "MM".
|
|
||||||
Added a set of "huge_xxxx_chunk.png" files to contrib/testpngs/crashers,
|
|
||||||
one for each known chunk type, with length = 2GB-1.
|
|
||||||
Check for 0 return from png_get_rowbytes() and added some (size_t) typecasts
|
|
||||||
in contrib/pngminus/*.c to stop some Coverity issues (162705, 162706,
|
|
||||||
and 162707).
|
|
||||||
Renamed chunks in contrib/testpngs/crashers to avoid having files whose
|
|
||||||
names differ only in case; this causes problems with some platforms
|
|
||||||
(github issue #172).
|
|
||||||
Added contrib/oss-fuzz directory which contains files used by the oss-fuzz
|
|
||||||
project (https://github.com/google/oss-fuzz/tree/master/projects/libpng).
|
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
|
51
src/3rdparty/libpng/CHANGES
vendored
51
src/3rdparty/libpng/CHANGES
vendored
@ -833,7 +833,7 @@ Version 1.0.7beta11 [May 7, 2000]
|
|||||||
Removed the new PNG_CREATED_READ_STRUCT and PNG_CREATED_WRITE_STRUCT modes
|
Removed the new PNG_CREATED_READ_STRUCT and PNG_CREATED_WRITE_STRUCT modes
|
||||||
which are no longer used.
|
which are no longer used.
|
||||||
Eliminated the three new members of png_text when PNG_LEGACY_SUPPORTED is
|
Eliminated the three new members of png_text when PNG_LEGACY_SUPPORTED is
|
||||||
defined or when neither PNG_READ_iTXt_SUPPORTED nor PNG_WRITE_iTXT_SUPPORTED
|
defined or when neither PNG_READ_iTXt_SUPPORTED nor PNG_WRITE_iTXt_SUPPORTED
|
||||||
is defined.
|
is defined.
|
||||||
Made PNG_NO_READ|WRITE_iTXt the default setting, to avoid memory
|
Made PNG_NO_READ|WRITE_iTXt the default setting, to avoid memory
|
||||||
overrun when old applications fill the info_ptr->text structure directly.
|
overrun when old applications fill the info_ptr->text structure directly.
|
||||||
@ -5939,7 +5939,7 @@ Version 1.6.32beta06 [August 2, 2017]
|
|||||||
|
|
||||||
Version 1.6.32beta07 [August 3, 2017]
|
Version 1.6.32beta07 [August 3, 2017]
|
||||||
Check length of all chunks except IDAT against user limit to fix an
|
Check length of all chunks except IDAT against user limit to fix an
|
||||||
OSS-fuzz issue.
|
OSS-fuzz issue (Fixes CVE-2017-12652).
|
||||||
|
|
||||||
Version 1.6.32beta08 [August 3, 2017]
|
Version 1.6.32beta08 [August 3, 2017]
|
||||||
Check length of IDAT against maximum possible IDAT size, accounting
|
Check length of IDAT against maximum possible IDAT size, accounting
|
||||||
@ -5994,6 +5994,53 @@ Version 1.6.32rc02 [August 22, 2017]
|
|||||||
Version 1.6.32 [August 24, 2017]
|
Version 1.6.32 [August 24, 2017]
|
||||||
No changes.
|
No changes.
|
||||||
|
|
||||||
|
Version 1.6.33beta01 [August 28, 2017]
|
||||||
|
Added PNGMINUS_UNUSED macro to contrib/pngminus/p*.c and added missing
|
||||||
|
parenthesis in contrib/pngminus/pnm2png.c (bug report by Christian Hesse).
|
||||||
|
Fixed off-by-one error in png_do_check_palette_indexes() (Bug report
|
||||||
|
by Mick P., Source Forge Issue #269).
|
||||||
|
|
||||||
|
Version 1.6.33beta02 [September 3, 2017]
|
||||||
|
Initialize png_handler.row_ptr in contrib/oss-fuzz/libpng_read_fuzzer.cc
|
||||||
|
to fix shortlived oss-fuzz issue 3234.
|
||||||
|
Compute a larger limit on IDAT because some applications write a deflate
|
||||||
|
buffer for each row (Bug report by Andrew Church).
|
||||||
|
Use current date (DATE) instead of release-date (RDATE) in last
|
||||||
|
changed date of contrib/oss-fuzz files.
|
||||||
|
Enabled ARM support in CMakeLists.txt (Bernd Kuhls).
|
||||||
|
|
||||||
|
Version 1.6.33beta03 [September 14, 2017]
|
||||||
|
Fixed incorrect typecast of some arguments to png_malloc() and
|
||||||
|
png_calloc() that were png_uint_32 instead of png_alloc_size_t
|
||||||
|
(Bug report by "irwir" in Github libpng issue #175).
|
||||||
|
Use pnglibconf.h.prebuilt when building for ANDROID with cmake (Github
|
||||||
|
issue 162, by rcdailey).
|
||||||
|
|
||||||
|
Version 1.6.33rc01 [September 20, 2017]
|
||||||
|
Initialize memory allocated by png_inflate to zero, using memset, to
|
||||||
|
stop an oss-fuzz "use of uninitialized value" detection in png_set_text_2()
|
||||||
|
due to truncated iTXt or zTXt chunk.
|
||||||
|
Initialize memory allocated by png_read_buffer to zero, using memset, to
|
||||||
|
stop an oss-fuzz "use of uninitialized value" detection in
|
||||||
|
png_icc_check_tag_table() due to truncated iCCP chunk.
|
||||||
|
Removed a redundant test (suggested by "irwir" in Github issue #180).
|
||||||
|
|
||||||
|
Version 1.6.33rc02 [September 23, 2017]
|
||||||
|
Added an interlaced version of each file in contrib/pngsuite.
|
||||||
|
Relocate new memset() call in pngrutil.c.
|
||||||
|
Removed more redundant tests (suggested by "irwir" in Github issue #180).
|
||||||
|
Add support for loading images with associated alpha in the Simplified
|
||||||
|
API (Samuel Williams).
|
||||||
|
|
||||||
|
Version 1.6.33 [September 28, 2017]
|
||||||
|
Revert contrib/oss-fuzz/libpng_read_fuzzer.cc to libpng-1.6.32 state.
|
||||||
|
Initialize png_handler.row_ptr in contrib/oss-fuzz/libpng_read_fuzzer.cc
|
||||||
|
Add end_info structure and png_read_end() to the libpng fuzzer.
|
||||||
|
|
||||||
|
Version 1.6.34 [September 29, 2017]
|
||||||
|
Removed contrib/pngsuite/i*.png; some of these were incorrect and caused
|
||||||
|
test failures.
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||||
|
4
src/3rdparty/libpng/LICENSE
vendored
4
src/3rdparty/libpng/LICENSE
vendored
@ -10,7 +10,7 @@ this sentence.
|
|||||||
|
|
||||||
This code is released under the libpng license.
|
This code is released under the libpng license.
|
||||||
|
|
||||||
libpng versions 1.0.7, July 1, 2000 through 1.6.32, August 24, 2017 are
|
libpng versions 1.0.7, July 1, 2000 through 1.6.34, September 29, 2017 are
|
||||||
Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
|
Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
|
||||||
derived from libpng-1.0.6, and are distributed according to the same
|
derived from libpng-1.0.6, and are distributed according to the same
|
||||||
disclaimer and license as libpng-1.0.6 with the following individuals
|
disclaimer and license as libpng-1.0.6 with the following individuals
|
||||||
@ -130,4 +130,4 @@ any encryption software. See the EAR, paragraphs 734.3(b)(3) and
|
|||||||
|
|
||||||
Glenn Randers-Pehrson
|
Glenn Randers-Pehrson
|
||||||
glennrp at users.sourceforge.net
|
glennrp at users.sourceforge.net
|
||||||
April 1, 2017
|
September 29, 2017
|
||||||
|
2
src/3rdparty/libpng/README
vendored
2
src/3rdparty/libpng/README
vendored
@ -1,4 +1,4 @@
|
|||||||
README for libpng version 1.6.32 - August 24, 2017 (shared library 16.0)
|
README for libpng version 1.6.34 - September 29, 2017 (shared library 16.0)
|
||||||
See the note about version numbers near the top of png.h
|
See the note about version numbers near the top of png.h
|
||||||
|
|
||||||
See INSTALL for instructions on how to install libpng.
|
See INSTALL for instructions on how to install libpng.
|
||||||
|
21
src/3rdparty/libpng/libpng-manual.txt
vendored
21
src/3rdparty/libpng/libpng-manual.txt
vendored
@ -1,6 +1,6 @@
|
|||||||
libpng-manual.txt - A description on how to use and modify libpng
|
libpng-manual.txt - A description on how to use and modify libpng
|
||||||
|
|
||||||
libpng version 1.6.32 - August 24, 2017
|
libpng version 1.6.34 - September 29, 2017
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
<glennrp at users.sourceforge.net>
|
<glennrp at users.sourceforge.net>
|
||||||
Copyright (c) 1998-2017 Glenn Randers-Pehrson
|
Copyright (c) 1998-2017 Glenn Randers-Pehrson
|
||||||
@ -11,7 +11,7 @@ libpng-manual.txt - A description on how to use and modify libpng
|
|||||||
|
|
||||||
Based on:
|
Based on:
|
||||||
|
|
||||||
libpng versions 0.97, January 1998, through 1.6.32 - August 24, 2017
|
libpng versions 0.97, January 1998, through 1.6.34 - September 29, 2017
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
Copyright (c) 1998-2017 Glenn Randers-Pehrson
|
Copyright (c) 1998-2017 Glenn Randers-Pehrson
|
||||||
|
|
||||||
@ -986,8 +986,17 @@ premultiplication.
|
|||||||
|
|
||||||
png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB);
|
png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB);
|
||||||
|
|
||||||
This is the default libpng handling of the alpha channel - it is not
|
Choices for the alpha_mode are
|
||||||
pre-multiplied into the color components. In addition the call states
|
|
||||||
|
PNG_ALPHA_PNG 0 /* according to the PNG standard */
|
||||||
|
PNG_ALPHA_STANDARD 1 /* according to Porter/Duff */
|
||||||
|
PNG_ALPHA_ASSOCIATED 1 /* as above; this is the normal practice */
|
||||||
|
PNG_ALPHA_PREMULTIPLIED 1 /* as above */
|
||||||
|
PNG_ALPHA_OPTIMIZED 2 /* 'PNG' for opaque pixels, else 'STANDARD' */
|
||||||
|
PNG_ALPHA_BROKEN 3 /* the alpha channel is gamma encoded */
|
||||||
|
|
||||||
|
PNG_ALPHA_PNG is the default libpng handling of the alpha channel. It is not
|
||||||
|
pre-multiplied into the color components. In addition the call states
|
||||||
that the output is for a sRGB system and causes all PNG files without gAMA
|
that the output is for a sRGB system and causes all PNG files without gAMA
|
||||||
chunks to be assumed to be encoded using sRGB.
|
chunks to be assumed to be encoded using sRGB.
|
||||||
|
|
||||||
@ -1002,7 +1011,7 @@ early Mac systems behaved.
|
|||||||
This is the classic Jim Blinn approach and will work in academic
|
This is the classic Jim Blinn approach and will work in academic
|
||||||
environments where everything is done by the book. It has the shortcoming
|
environments where everything is done by the book. It has the shortcoming
|
||||||
of assuming that input PNG data with no gamma information is linear - this
|
of assuming that input PNG data with no gamma information is linear - this
|
||||||
is unlikely to be correct unless the PNG files where generated locally.
|
is unlikely to be correct unless the PNG files were generated locally.
|
||||||
Most of the time the output precision will be so low as to show
|
Most of the time the output precision will be so low as to show
|
||||||
significant banding in dark areas of the image.
|
significant banding in dark areas of the image.
|
||||||
|
|
||||||
@ -5405,7 +5414,7 @@ Since the PNG Development group is an ad-hoc body, we can't make
|
|||||||
an official declaration.
|
an official declaration.
|
||||||
|
|
||||||
This is your unofficial assurance that libpng from version 0.71 and
|
This is your unofficial assurance that libpng from version 0.71 and
|
||||||
upward through 1.6.32 are Y2K compliant. It is my belief that earlier
|
upward through 1.6.34 are Y2K compliant. It is my belief that earlier
|
||||||
versions were also Y2K compliant.
|
versions were also Y2K compliant.
|
||||||
|
|
||||||
Libpng only has two year fields. One is a 2-byte unsigned integer
|
Libpng only has two year fields. One is a 2-byte unsigned integer
|
||||||
|
34
src/3rdparty/libpng/png.c
vendored
34
src/3rdparty/libpng/png.c
vendored
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* png.c - location for general purpose libpng functions
|
/* png.c - location for general purpose libpng functions
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.32 [August 24, 2017]
|
* Last changed in libpng 1.6.33 [September 28, 2017]
|
||||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
@ -14,7 +14,7 @@
|
|||||||
#include "pngpriv.h"
|
#include "pngpriv.h"
|
||||||
|
|
||||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||||
typedef png_libpng_version_1_6_32 Your_png_h_is_not_version_1_6_32;
|
typedef png_libpng_version_1_6_34 Your_png_h_is_not_version_1_6_34;
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
/* The version tests may need to be added to, but the problem warning has
|
/* The version tests may need to be added to, but the problem warning has
|
||||||
@ -816,14 +816,14 @@ png_get_copyright(png_const_structrp png_ptr)
|
|||||||
#else
|
#else
|
||||||
# ifdef __STDC__
|
# ifdef __STDC__
|
||||||
return PNG_STRING_NEWLINE \
|
return PNG_STRING_NEWLINE \
|
||||||
"libpng version 1.6.32 - August 24, 2017" PNG_STRING_NEWLINE \
|
"libpng version 1.6.34 - September 29, 2017" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson" \
|
"Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson" \
|
||||||
PNG_STRING_NEWLINE \
|
PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
||||||
PNG_STRING_NEWLINE;
|
PNG_STRING_NEWLINE;
|
||||||
# else
|
# else
|
||||||
return "libpng version 1.6.32 - August 24, 2017\
|
return "libpng version 1.6.34 - September 29, 2017\
|
||||||
Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson\
|
Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson\
|
||||||
Copyright (c) 1996-1997 Andreas Dilger\
|
Copyright (c) 1996-1997 Andreas Dilger\
|
||||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
||||||
@ -1913,12 +1913,12 @@ png_colorspace_set_sRGB(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
|||||||
*/
|
*/
|
||||||
if (intent < 0 || intent >= PNG_sRGB_INTENT_LAST)
|
if (intent < 0 || intent >= PNG_sRGB_INTENT_LAST)
|
||||||
return png_icc_profile_error(png_ptr, colorspace, "sRGB",
|
return png_icc_profile_error(png_ptr, colorspace, "sRGB",
|
||||||
(unsigned)intent, "invalid sRGB rendering intent");
|
(png_alloc_size_t)intent, "invalid sRGB rendering intent");
|
||||||
|
|
||||||
if ((colorspace->flags & PNG_COLORSPACE_HAVE_INTENT) != 0 &&
|
if ((colorspace->flags & PNG_COLORSPACE_HAVE_INTENT) != 0 &&
|
||||||
colorspace->rendering_intent != intent)
|
colorspace->rendering_intent != intent)
|
||||||
return png_icc_profile_error(png_ptr, colorspace, "sRGB",
|
return png_icc_profile_error(png_ptr, colorspace, "sRGB",
|
||||||
(unsigned)intent, "inconsistent rendering intents");
|
(png_alloc_size_t)intent, "inconsistent rendering intents");
|
||||||
|
|
||||||
if ((colorspace->flags & PNG_COLORSPACE_FROM_sRGB) != 0)
|
if ((colorspace->flags & PNG_COLORSPACE_FROM_sRGB) != 0)
|
||||||
{
|
{
|
||||||
@ -1979,7 +1979,6 @@ icc_check_length(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
|||||||
if (profile_length < 132)
|
if (profile_length < 132)
|
||||||
return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
|
return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
|
||||||
"too short");
|
"too short");
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2224,15 +2223,6 @@ png_icc_check_tag_table(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
|||||||
* being in range. All defined tag types have an 8 byte header - a 4 byte
|
* being in range. All defined tag types have an 8 byte header - a 4 byte
|
||||||
* type signature then 0.
|
* type signature then 0.
|
||||||
*/
|
*/
|
||||||
if ((tag_start & 3) != 0)
|
|
||||||
{
|
|
||||||
/* CNHP730S.icc shipped with Microsoft Windows 64 violates this, it is
|
|
||||||
* only a warning here because libpng does not care about the
|
|
||||||
* alignment.
|
|
||||||
*/
|
|
||||||
(void)png_icc_profile_error(png_ptr, NULL, name, tag_id,
|
|
||||||
"ICC profile tag start not a multiple of 4");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This is a hard error; potentially it can cause read outside the
|
/* This is a hard error; potentially it can cause read outside the
|
||||||
* profile.
|
* profile.
|
||||||
@ -2240,6 +2230,16 @@ png_icc_check_tag_table(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
|||||||
if (tag_start > profile_length || tag_length > profile_length - tag_start)
|
if (tag_start > profile_length || tag_length > profile_length - tag_start)
|
||||||
return png_icc_profile_error(png_ptr, colorspace, name, tag_id,
|
return png_icc_profile_error(png_ptr, colorspace, name, tag_id,
|
||||||
"ICC profile tag outside profile");
|
"ICC profile tag outside profile");
|
||||||
|
|
||||||
|
if ((tag_start & 3) != 0)
|
||||||
|
{
|
||||||
|
/* CNHP730S.icc shipped with Microsoft Windows 64 violates this; it is
|
||||||
|
* only a warning here because libpng does not care about the
|
||||||
|
* alignment.
|
||||||
|
*/
|
||||||
|
(void)png_icc_profile_error(png_ptr, NULL, name, tag_id,
|
||||||
|
"ICC profile tag start not a multiple of 4");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1; /* success, maybe with warnings */
|
return 1; /* success, maybe with warnings */
|
||||||
@ -3761,7 +3761,7 @@ png_log16bit(png_uint_32 x)
|
|||||||
* of getting this accuracy in practice.
|
* of getting this accuracy in practice.
|
||||||
*
|
*
|
||||||
* To deal with this the following exp() function works out the exponent of the
|
* To deal with this the following exp() function works out the exponent of the
|
||||||
* frational part of the logarithm by using an accurate 32-bit value from the
|
* fractional part of the logarithm by using an accurate 32-bit value from the
|
||||||
* top four fractional bits then multiplying in the remaining bits.
|
* top four fractional bits then multiplying in the remaining bits.
|
||||||
*/
|
*/
|
||||||
static const png_uint_32
|
static const png_uint_32
|
||||||
|
28
src/3rdparty/libpng/png.h
vendored
28
src/3rdparty/libpng/png.h
vendored
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* png.h - header file for PNG reference library
|
/* png.h - header file for PNG reference library
|
||||||
*
|
*
|
||||||
* libpng version 1.6.32, August 24, 2017
|
* libpng version 1.6.34, September 29, 2017
|
||||||
*
|
*
|
||||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
@ -12,7 +12,7 @@
|
|||||||
* Authors and maintainers:
|
* Authors and maintainers:
|
||||||
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
||||||
* libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
|
* libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
|
||||||
* libpng versions 0.97, January 1998, through 1.6.32, August 24, 2017:
|
* libpng versions 0.97, January 1998, through 1.6.34, September 29, 2017:
|
||||||
* Glenn Randers-Pehrson.
|
* Glenn Randers-Pehrson.
|
||||||
* See also "Contributing Authors", below.
|
* See also "Contributing Authors", below.
|
||||||
*/
|
*/
|
||||||
@ -25,7 +25,7 @@
|
|||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
*
|
*
|
||||||
* libpng versions 1.0.7, July 1, 2000 through 1.6.32, August 24, 2017 are
|
* libpng versions 1.0.7, July 1, 2000 through 1.6.34, September 29, 2017 are
|
||||||
* Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
|
* Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
|
||||||
* derived from libpng-1.0.6, and are distributed according to the same
|
* derived from libpng-1.0.6, and are distributed according to the same
|
||||||
* disclaimer and license as libpng-1.0.6 with the following individuals
|
* disclaimer and license as libpng-1.0.6 with the following individuals
|
||||||
@ -209,11 +209,11 @@
|
|||||||
* ...
|
* ...
|
||||||
* 1.0.19 10 10019 10.so.0.19[.0]
|
* 1.0.19 10 10019 10.so.0.19[.0]
|
||||||
* ...
|
* ...
|
||||||
* 1.2.57 13 10257 12.so.0.57[.0]
|
* 1.2.59 13 10257 12.so.0.59[.0]
|
||||||
* ...
|
* ...
|
||||||
* 1.5.28 15 10527 15.so.15.28[.0]
|
* 1.5.30 15 10527 15.so.15.30[.0]
|
||||||
* ...
|
* ...
|
||||||
* 1.6.32 16 10632 16.so.16.32[.0]
|
* 1.6.34 16 10633 16.so.16.34[.0]
|
||||||
*
|
*
|
||||||
* Henceforth the source version will match the shared-library major
|
* Henceforth the source version will match the shared-library major
|
||||||
* and minor numbers; the shared-library major version number will be
|
* and minor numbers; the shared-library major version number will be
|
||||||
@ -241,13 +241,13 @@
|
|||||||
* Y2K compliance in libpng:
|
* Y2K compliance in libpng:
|
||||||
* =========================
|
* =========================
|
||||||
*
|
*
|
||||||
* August 24, 2017
|
* September 29, 2017
|
||||||
*
|
*
|
||||||
* Since the PNG Development group is an ad-hoc body, we can't make
|
* Since the PNG Development group is an ad-hoc body, we can't make
|
||||||
* an official declaration.
|
* an official declaration.
|
||||||
*
|
*
|
||||||
* This is your unofficial assurance that libpng from version 0.71 and
|
* This is your unofficial assurance that libpng from version 0.71 and
|
||||||
* upward through 1.6.32 are Y2K compliant. It is my belief that
|
* upward through 1.6.34 are Y2K compliant. It is my belief that
|
||||||
* earlier versions were also Y2K compliant.
|
* earlier versions were also Y2K compliant.
|
||||||
*
|
*
|
||||||
* Libpng only has two year fields. One is a 2-byte unsigned integer
|
* Libpng only has two year fields. One is a 2-byte unsigned integer
|
||||||
@ -309,8 +309,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Version information for png.h - this should match the version in png.c */
|
/* Version information for png.h - this should match the version in png.c */
|
||||||
#define PNG_LIBPNG_VER_STRING "1.6.32"
|
#define PNG_LIBPNG_VER_STRING "1.6.34"
|
||||||
#define PNG_HEADER_VERSION_STRING " libpng version 1.6.32 - August 24, 2017\n"
|
#define PNG_HEADER_VERSION_STRING " libpng version 1.6.34 - September 29, 2017\n"
|
||||||
|
|
||||||
#define PNG_LIBPNG_VER_SONUM 16
|
#define PNG_LIBPNG_VER_SONUM 16
|
||||||
#define PNG_LIBPNG_VER_DLLNUM 16
|
#define PNG_LIBPNG_VER_DLLNUM 16
|
||||||
@ -318,7 +318,7 @@
|
|||||||
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
||||||
#define PNG_LIBPNG_VER_MAJOR 1
|
#define PNG_LIBPNG_VER_MAJOR 1
|
||||||
#define PNG_LIBPNG_VER_MINOR 6
|
#define PNG_LIBPNG_VER_MINOR 6
|
||||||
#define PNG_LIBPNG_VER_RELEASE 32
|
#define PNG_LIBPNG_VER_RELEASE 34
|
||||||
|
|
||||||
/* This should match the numeric part of the final component of
|
/* This should match the numeric part of the final component of
|
||||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
||||||
@ -349,7 +349,7 @@
|
|||||||
* version 1.0.0 was mis-numbered 100 instead of 10000). From
|
* version 1.0.0 was mis-numbered 100 instead of 10000). From
|
||||||
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
|
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
|
||||||
*/
|
*/
|
||||||
#define PNG_LIBPNG_VER 10632 /* 1.6.32 */
|
#define PNG_LIBPNG_VER 10634 /* 1.6.34 */
|
||||||
|
|
||||||
/* Library configuration: these options cannot be changed after
|
/* Library configuration: these options cannot be changed after
|
||||||
* the library has been built.
|
* the library has been built.
|
||||||
@ -459,7 +459,7 @@ extern "C" {
|
|||||||
/* This triggers a compiler error in png.c, if png.c and png.h
|
/* This triggers a compiler error in png.c, if png.c and png.h
|
||||||
* do not agree upon the version number.
|
* do not agree upon the version number.
|
||||||
*/
|
*/
|
||||||
typedef char* png_libpng_version_1_6_32;
|
typedef char* png_libpng_version_1_6_34;
|
||||||
|
|
||||||
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
||||||
*
|
*
|
||||||
@ -2819,6 +2819,8 @@ typedef struct
|
|||||||
# define PNG_FORMAT_FLAG_AFIRST 0x20U /* alpha channel comes first */
|
# define PNG_FORMAT_FLAG_AFIRST 0x20U /* alpha channel comes first */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define PNG_FORMAT_FLAG_ASSOCIATED_ALPHA 0x40U /* alpha channel is associated */
|
||||||
|
|
||||||
/* Commonly used formats have predefined macros.
|
/* Commonly used formats have predefined macros.
|
||||||
*
|
*
|
||||||
* First the single byte (sRGB) formats:
|
* First the single byte (sRGB) formats:
|
||||||
|
2
src/3rdparty/libpng/pngconf.h
vendored
2
src/3rdparty/libpng/pngconf.h
vendored
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngconf.h - machine configurable file for libpng
|
/* pngconf.h - machine configurable file for libpng
|
||||||
*
|
*
|
||||||
* libpng version 1.6.32, August 24, 2017
|
* libpng version 1.6.34, September 29, 2017
|
||||||
*
|
*
|
||||||
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
|
4
src/3rdparty/libpng/pnglibconf.h
vendored
4
src/3rdparty/libpng/pnglibconf.h
vendored
@ -1,8 +1,8 @@
|
|||||||
/* libpng 1.6.32 STANDARD API DEFINITION */
|
/* libpng 1.6.34 STANDARD API DEFINITION */
|
||||||
|
|
||||||
/* pnglibconf.h - library build configuration */
|
/* pnglibconf.h - library build configuration */
|
||||||
|
|
||||||
/* Libpng version 1.6.32 - August 24, 2017 */
|
/* Libpng version 1.6.34 - September 29, 2017 */
|
||||||
|
|
||||||
/* Copyright (c) 1998-2017 Glenn Randers-Pehrson */
|
/* Copyright (c) 1998-2017 Glenn Randers-Pehrson */
|
||||||
|
|
||||||
|
14
src/3rdparty/libpng/pngread.c
vendored
14
src/3rdparty/libpng/pngread.c
vendored
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngread.c - read a PNG file
|
/* pngread.c - read a PNG file
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.32 [August 24, 2017]
|
* Last changed in libpng 1.6.33 [September 28, 2017]
|
||||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
@ -3759,7 +3759,13 @@ png_image_read_direct(png_voidp argument)
|
|||||||
mode = PNG_ALPHA_PNG;
|
mode = PNG_ALPHA_PNG;
|
||||||
output_gamma = PNG_DEFAULT_sRGB;
|
output_gamma = PNG_DEFAULT_sRGB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((change & PNG_FORMAT_FLAG_ASSOCIATED_ALPHA) != 0)
|
||||||
|
{
|
||||||
|
mode = PNG_ALPHA_OPTIMIZED;
|
||||||
|
change &= ~PNG_FORMAT_FLAG_ASSOCIATED_ALPHA;
|
||||||
|
}
|
||||||
|
|
||||||
/* If 'do_local_background' is set check for the presence of gamma
|
/* If 'do_local_background' is set check for the presence of gamma
|
||||||
* correction; this is part of the work-round for the libpng bug
|
* correction; this is part of the work-round for the libpng bug
|
||||||
* described above.
|
* described above.
|
||||||
@ -3985,6 +3991,10 @@ png_image_read_direct(png_voidp argument)
|
|||||||
else if (do_local_compose != 0) /* internal error */
|
else if (do_local_compose != 0) /* internal error */
|
||||||
png_error(png_ptr, "png_image_read: alpha channel lost");
|
png_error(png_ptr, "png_image_read: alpha channel lost");
|
||||||
|
|
||||||
|
if ((format & PNG_FORMAT_FLAG_ASSOCIATED_ALPHA) != 0) {
|
||||||
|
info_format |= PNG_FORMAT_FLAG_ASSOCIATED_ALPHA;
|
||||||
|
}
|
||||||
|
|
||||||
if (info_ptr->bit_depth == 16)
|
if (info_ptr->bit_depth == 16)
|
||||||
info_format |= PNG_FORMAT_FLAG_LINEAR;
|
info_format |= PNG_FORMAT_FLAG_LINEAR;
|
||||||
|
|
||||||
|
22
src/3rdparty/libpng/pngrtran.c
vendored
22
src/3rdparty/libpng/pngrtran.c
vendored
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.31 [July 27, 2017]
|
* Last changed in libpng 1.6.33 [September 28, 2017]
|
||||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
@ -430,7 +430,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
png_ptr->quantize_index = (png_bytep)png_malloc(png_ptr,
|
png_ptr->quantize_index = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte))));
|
(png_alloc_size_t)((png_uint_32)num_palette * (sizeof (png_byte))));
|
||||||
for (i = 0; i < num_palette; i++)
|
for (i = 0; i < num_palette; i++)
|
||||||
png_ptr->quantize_index[i] = (png_byte)i;
|
png_ptr->quantize_index[i] = (png_byte)i;
|
||||||
}
|
}
|
||||||
@ -447,7 +447,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
|||||||
|
|
||||||
/* Initialize an array to sort colors */
|
/* Initialize an array to sort colors */
|
||||||
png_ptr->quantize_sort = (png_bytep)png_malloc(png_ptr,
|
png_ptr->quantize_sort = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte))));
|
(png_alloc_size_t)((png_uint_32)num_palette * (sizeof (png_byte))));
|
||||||
|
|
||||||
/* Initialize the quantize_sort array */
|
/* Initialize the quantize_sort array */
|
||||||
for (i = 0; i < num_palette; i++)
|
for (i = 0; i < num_palette; i++)
|
||||||
@ -581,9 +581,11 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
|||||||
|
|
||||||
/* Initialize palette index arrays */
|
/* Initialize palette index arrays */
|
||||||
png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr,
|
png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte))));
|
(png_alloc_size_t)((png_uint_32)num_palette *
|
||||||
|
(sizeof (png_byte))));
|
||||||
png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr,
|
png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte))));
|
(png_alloc_size_t)((png_uint_32)num_palette *
|
||||||
|
(sizeof (png_byte))));
|
||||||
|
|
||||||
/* Initialize the sort array */
|
/* Initialize the sort array */
|
||||||
for (i = 0; i < num_palette; i++)
|
for (i = 0; i < num_palette; i++)
|
||||||
@ -592,7 +594,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
|||||||
png_ptr->palette_to_index[i] = (png_byte)i;
|
png_ptr->palette_to_index[i] = (png_byte)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
hash = (png_dsortpp)png_calloc(png_ptr, (png_uint_32)(769 *
|
hash = (png_dsortpp)png_calloc(png_ptr, (png_alloc_size_t)(769 *
|
||||||
(sizeof (png_dsortp))));
|
(sizeof (png_dsortp))));
|
||||||
|
|
||||||
num_new_palette = num_palette;
|
num_new_palette = num_palette;
|
||||||
@ -623,7 +625,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
|||||||
{
|
{
|
||||||
|
|
||||||
t = (png_dsortp)png_malloc_warn(png_ptr,
|
t = (png_dsortp)png_malloc_warn(png_ptr,
|
||||||
(png_uint_32)(sizeof (png_dsort)));
|
(png_alloc_size_t)(sizeof (png_dsort)));
|
||||||
|
|
||||||
if (t == NULL)
|
if (t == NULL)
|
||||||
break;
|
break;
|
||||||
@ -748,9 +750,9 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
|||||||
png_size_t num_entries = ((png_size_t)1 << total_bits);
|
png_size_t num_entries = ((png_size_t)1 << total_bits);
|
||||||
|
|
||||||
png_ptr->palette_lookup = (png_bytep)png_calloc(png_ptr,
|
png_ptr->palette_lookup = (png_bytep)png_calloc(png_ptr,
|
||||||
(png_uint_32)(num_entries * (sizeof (png_byte))));
|
(png_alloc_size_t)(num_entries * (sizeof (png_byte))));
|
||||||
|
|
||||||
distance = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_entries *
|
distance = (png_bytep)png_malloc(png_ptr, (png_alloc_size_t)(num_entries *
|
||||||
(sizeof (png_byte))));
|
(sizeof (png_byte))));
|
||||||
|
|
||||||
memset(distance, 0xff, num_entries * (sizeof (png_byte)));
|
memset(distance, 0xff, num_entries * (sizeof (png_byte)));
|
||||||
@ -3322,7 +3324,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
|||||||
== png_ptr->trans_color.gray)
|
== png_ptr->trans_color.gray)
|
||||||
{
|
{
|
||||||
unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
|
unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
|
||||||
tmp |=
|
tmp |=
|
||||||
(unsigned int)(png_ptr->background.gray << shift);
|
(unsigned int)(png_ptr->background.gray << shift);
|
||||||
*sp = (png_byte)(tmp & 0xff);
|
*sp = (png_byte)(tmp & 0xff);
|
||||||
}
|
}
|
||||||
|
47
src/3rdparty/libpng/pngrutil.c
vendored
47
src/3rdparty/libpng/pngrutil.c
vendored
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngrutil.c - utilities to read a PNG file
|
/* pngrutil.c - utilities to read a PNG file
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.32 [August 24, 2017]
|
* Last changed in libpng 1.6.33 [September 28, 2017]
|
||||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
@ -314,6 +314,7 @@ png_read_buffer(png_structrp png_ptr, png_alloc_size_t new_size, int warn)
|
|||||||
|
|
||||||
if (buffer != NULL)
|
if (buffer != NULL)
|
||||||
{
|
{
|
||||||
|
memset(buffer, 0, new_size); /* just in case */
|
||||||
png_ptr->read_buffer = buffer;
|
png_ptr->read_buffer = buffer;
|
||||||
png_ptr->read_buffer_size = new_size;
|
png_ptr->read_buffer_size = new_size;
|
||||||
}
|
}
|
||||||
@ -673,6 +674,8 @@ png_decompress_chunk(png_structrp png_ptr,
|
|||||||
|
|
||||||
if (text != NULL)
|
if (text != NULL)
|
||||||
{
|
{
|
||||||
|
memset(text, 0, buffer_size);
|
||||||
|
|
||||||
ret = png_inflate(png_ptr, png_ptr->chunk_name, 1/*finish*/,
|
ret = png_inflate(png_ptr, png_ptr->chunk_name, 1/*finish*/,
|
||||||
png_ptr->read_buffer + prefix_size, &lzsize,
|
png_ptr->read_buffer + prefix_size, &lzsize,
|
||||||
text + prefix_size, newlength);
|
text + prefix_size, newlength);
|
||||||
@ -736,9 +739,7 @@ png_decompress_chunk(png_structrp png_ptr,
|
|||||||
{
|
{
|
||||||
/* inflateReset failed, store the error message */
|
/* inflateReset failed, store the error message */
|
||||||
png_zstream_error(png_ptr, ret);
|
png_zstream_error(png_ptr, ret);
|
||||||
|
ret = PNG_UNEXPECTED_ZLIB_RETURN;
|
||||||
if (ret == Z_STREAM_END)
|
|
||||||
ret = PNG_UNEXPECTED_ZLIB_RETURN;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1476,7 +1477,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|||||||
/* Now read the tag table; a variable size buffer is
|
/* Now read the tag table; a variable size buffer is
|
||||||
* needed at this point, allocate one for the whole
|
* needed at this point, allocate one for the whole
|
||||||
* profile. The header check has already validated
|
* profile. The header check has already validated
|
||||||
* that none of these stuff will overflow.
|
* that none of this stuff will overflow.
|
||||||
*/
|
*/
|
||||||
const png_uint_32 tag_count = png_get_uint_32(
|
const png_uint_32 tag_count = png_get_uint_32(
|
||||||
profile_header+128);
|
profile_header+128);
|
||||||
@ -1583,19 +1584,11 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (errmsg == NULL)
|
||||||
else if (size > 0)
|
|
||||||
errmsg = "truncated";
|
|
||||||
|
|
||||||
#ifndef __COVERITY__
|
|
||||||
else
|
|
||||||
errmsg = png_ptr->zstream.msg;
|
errmsg = png_ptr->zstream.msg;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* else png_icc_check_tag_table output an error */
|
/* else png_icc_check_tag_table output an error */
|
||||||
}
|
}
|
||||||
|
|
||||||
else /* profile truncated */
|
else /* profile truncated */
|
||||||
errmsg = png_ptr->zstream.msg;
|
errmsg = png_ptr->zstream.msg;
|
||||||
}
|
}
|
||||||
@ -3144,28 +3137,28 @@ png_check_chunk_length(png_const_structrp png_ptr, const png_uint_32 length)
|
|||||||
{
|
{
|
||||||
png_alloc_size_t limit = PNG_UINT_31_MAX;
|
png_alloc_size_t limit = PNG_UINT_31_MAX;
|
||||||
|
|
||||||
if (png_ptr->chunk_name != png_IDAT)
|
|
||||||
{
|
|
||||||
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||||
if (png_ptr->user_chunk_malloc_max > 0 &&
|
if (png_ptr->user_chunk_malloc_max > 0 &&
|
||||||
png_ptr->user_chunk_malloc_max < limit)
|
png_ptr->user_chunk_malloc_max < limit)
|
||||||
limit = png_ptr->user_chunk_malloc_max;
|
limit = png_ptr->user_chunk_malloc_max;
|
||||||
# elif PNG_USER_CHUNK_MALLOC_MAX > 0
|
# elif PNG_USER_CHUNK_MALLOC_MAX > 0
|
||||||
if (PNG_USER_CHUNK_MALLOC_MAX < limit)
|
if (PNG_USER_CHUNK_MALLOC_MAX < limit)
|
||||||
limit = PNG_USER_CHUNK_MALLOC_MAX;
|
limit = PNG_USER_CHUNK_MALLOC_MAX;
|
||||||
# endif
|
# endif
|
||||||
}
|
if (png_ptr->chunk_name == png_IDAT)
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
png_alloc_size_t idat_limit = PNG_UINT_31_MAX;
|
||||||
size_t row_factor =
|
size_t row_factor =
|
||||||
(png_ptr->width * png_ptr->channels * (png_ptr->bit_depth > 8? 2: 1)
|
(png_ptr->width * png_ptr->channels * (png_ptr->bit_depth > 8? 2: 1)
|
||||||
+ 1 + (png_ptr->interlaced? 6: 0));
|
+ 1 + (png_ptr->interlaced? 6: 0));
|
||||||
if (png_ptr->height > PNG_UINT_32_MAX/row_factor)
|
if (png_ptr->height > PNG_UINT_32_MAX/row_factor)
|
||||||
limit=PNG_UINT_31_MAX;
|
idat_limit=PNG_UINT_31_MAX;
|
||||||
else
|
else
|
||||||
limit = png_ptr->height * row_factor;
|
idat_limit = png_ptr->height * row_factor;
|
||||||
limit += 6 + 5*(limit/32566+1); /* zlib+deflate overhead */
|
row_factor = row_factor > 32566? 32566 : row_factor;
|
||||||
limit=limit < PNG_UINT_31_MAX? limit : PNG_UINT_31_MAX;
|
idat_limit += 6 + 5*(idat_limit/row_factor+1); /* zlib+deflate overhead */
|
||||||
|
idat_limit=idat_limit < PNG_UINT_31_MAX? idat_limit : PNG_UINT_31_MAX;
|
||||||
|
limit = limit < idat_limit? idat_limit : limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (length > limit)
|
if (length > limit)
|
||||||
|
6
src/3rdparty/libpng/pngtrans.c
vendored
6
src/3rdparty/libpng/pngtrans.c
vendored
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.30 [June 28, 2017]
|
* Last changed in libpng 1.6.33 [September 28, 2017]
|
||||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
@ -609,7 +609,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
|||||||
return; /* The filler channel has gone already */
|
return; /* The filler channel has gone already */
|
||||||
|
|
||||||
/* Fix the rowbytes value. */
|
/* Fix the rowbytes value. */
|
||||||
row_info->rowbytes = (unsigned int)(dp-row);
|
row_info->rowbytes = (png_size_t)(dp-row);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -708,7 +708,7 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
|
|||||||
* forms produced on either GCC or MSVC.
|
* forms produced on either GCC or MSVC.
|
||||||
*/
|
*/
|
||||||
int padding = PNG_PADBITS(row_info->pixel_depth, row_info->width);
|
int padding = PNG_PADBITS(row_info->pixel_depth, row_info->width);
|
||||||
png_bytep rp = png_ptr->row_buf + row_info->rowbytes;
|
png_bytep rp = png_ptr->row_buf + row_info->rowbytes - 1;
|
||||||
|
|
||||||
switch (row_info->bit_depth)
|
switch (row_info->bit_depth)
|
||||||
{
|
{
|
||||||
|
2
src/3rdparty/libpng/pngwrite.c
vendored
2
src/3rdparty/libpng/pngwrite.c
vendored
@ -1940,7 +1940,7 @@ png_image_write_main(png_voidp argument)
|
|||||||
int colormap = (format & PNG_FORMAT_FLAG_COLORMAP);
|
int colormap = (format & PNG_FORMAT_FLAG_COLORMAP);
|
||||||
int linear = !colormap && (format & PNG_FORMAT_FLAG_LINEAR); /* input */
|
int linear = !colormap && (format & PNG_FORMAT_FLAG_LINEAR); /* input */
|
||||||
int alpha = !colormap && (format & PNG_FORMAT_FLAG_ALPHA);
|
int alpha = !colormap && (format & PNG_FORMAT_FLAG_ALPHA);
|
||||||
int write_16bit = linear && !colormap && (display->convert_to_8bit == 0);
|
int write_16bit = linear && (display->convert_to_8bit == 0);
|
||||||
|
|
||||||
# ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
# ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
||||||
/* Make sure we error out on any bad situation */
|
/* Make sure we error out on any bad situation */
|
||||||
|
2
src/3rdparty/libpng/qt_attribution.json
vendored
2
src/3rdparty/libpng/qt_attribution.json
vendored
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
"Description": "libpng is the official PNG reference library.",
|
"Description": "libpng is the official PNG reference library.",
|
||||||
"Homepage": "http://www.libpng.org/pub/png/libpng.html",
|
"Homepage": "http://www.libpng.org/pub/png/libpng.html",
|
||||||
"Version": "1.6.32",
|
"Version": "1.6.34",
|
||||||
"License": "libpng License",
|
"License": "libpng License",
|
||||||
"LicenseId": "Libpng",
|
"LicenseId": "Libpng",
|
||||||
"LicenseFile": "LICENSE",
|
"LicenseFile": "LICENSE",
|
||||||
|
@ -1376,12 +1376,12 @@
|
|||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
#if QT_HAS_CPP_ATTRIBUTE(fallthrough)
|
#if QT_HAS_CPP_ATTRIBUTE(clang::fallthrough)
|
||||||
# define Q_FALLTHROUGH() [[fallthrough]]
|
|
||||||
#elif QT_HAS_CPP_ATTRIBUTE(clang::fallthrough)
|
|
||||||
# define Q_FALLTHROUGH() [[clang::fallthrough]]
|
# define Q_FALLTHROUGH() [[clang::fallthrough]]
|
||||||
#elif QT_HAS_CPP_ATTRIBUTE(gnu::fallthrough)
|
#elif QT_HAS_CPP_ATTRIBUTE(gnu::fallthrough)
|
||||||
# define Q_FALLTHROUGH() [[gnu::fallthrough]]
|
# define Q_FALLTHROUGH() [[gnu::fallthrough]]
|
||||||
|
#elif QT_HAS_CPP_ATTRIBUTE(fallthrough)
|
||||||
|
# define Q_FALLTHROUGH() [[fallthrough]]
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifndef Q_FALLTHROUGH
|
#ifndef Q_FALLTHROUGH
|
||||||
|
@ -124,7 +124,7 @@ inline qfloat16::qfloat16(float f) Q_DECL_NOTHROW
|
|||||||
__m128i packhalf = _mm_cvtps_ph(packsingle, 0);
|
__m128i packhalf = _mm_cvtps_ph(packsingle, 0);
|
||||||
b16 = _mm_extract_epi16(packhalf, 0);
|
b16 = _mm_extract_epi16(packhalf, 0);
|
||||||
#elif defined (__ARM_FP16_FORMAT_IEEE)
|
#elif defined (__ARM_FP16_FORMAT_IEEE)
|
||||||
__fp16 f16 = f;
|
__fp16 f16 = __fp16(f);
|
||||||
memcpy(&b16, &f16, sizeof(quint16));
|
memcpy(&b16, &f16, sizeof(quint16));
|
||||||
#else
|
#else
|
||||||
quint32 u;
|
quint32 u;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -42,6 +42,7 @@
|
|||||||
|
|
||||||
#include <QtCore/qglobal.h>
|
#include <QtCore/qglobal.h>
|
||||||
#include <algorithm> // for std::generate
|
#include <algorithm> // for std::generate
|
||||||
|
#include <random> // for std::mt19937
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
@ -51,19 +52,43 @@ class QRandomGenerator
|
|||||||
template <typename UInt> using IfValidUInt =
|
template <typename UInt> using IfValidUInt =
|
||||||
typename std::enable_if<std::is_unsigned<UInt>::value && sizeof(UInt) >= sizeof(uint), bool>::type;
|
typename std::enable_if<std::is_unsigned<UInt>::value && sizeof(UInt) >= sizeof(uint), bool>::type;
|
||||||
public:
|
public:
|
||||||
static QRandomGenerator system() { return {}; }
|
QRandomGenerator(quint32 seedValue = 1)
|
||||||
static QRandomGenerator global() { return {}; }
|
: QRandomGenerator(&seedValue, 1)
|
||||||
QRandomGenerator() = default;
|
{}
|
||||||
|
template <qssize_t N> QRandomGenerator(const quint32 (&seedBuffer)[N])
|
||||||
|
: QRandomGenerator(seedBuffer, seedBuffer + N)
|
||||||
|
{}
|
||||||
|
QRandomGenerator(const quint32 *seedBuffer, qssize_t len)
|
||||||
|
: QRandomGenerator(seedBuffer, seedBuffer + len)
|
||||||
|
{}
|
||||||
|
Q_CORE_EXPORT QRandomGenerator(std::seed_seq &sseq) Q_DECL_NOTHROW;
|
||||||
|
Q_CORE_EXPORT QRandomGenerator(const quint32 *begin, const quint32 *end);
|
||||||
|
|
||||||
// ### REMOVE BEFORE 5.10
|
// copy constructor & assignment operator (move unnecessary)
|
||||||
QRandomGenerator *operator->() { return this; }
|
Q_CORE_EXPORT QRandomGenerator(const QRandomGenerator &other);
|
||||||
static quint32 get32() { return generate(); }
|
Q_CORE_EXPORT QRandomGenerator &operator=(const QRandomGenerator &other);
|
||||||
static quint64 get64() { return generate64(); }
|
|
||||||
static qreal getReal() { return generateDouble(); }
|
|
||||||
|
|
||||||
static Q_CORE_EXPORT quint32 generate();
|
friend Q_CORE_EXPORT bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2);
|
||||||
static Q_CORE_EXPORT quint64 generate64();
|
friend bool operator!=(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
|
||||||
static double generateDouble()
|
{
|
||||||
|
return !(rng1 == rng2);
|
||||||
|
}
|
||||||
|
|
||||||
|
quint32 generate()
|
||||||
|
{
|
||||||
|
quint32 ret;
|
||||||
|
fillRange(&ret, 1);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
quint64 generate64()
|
||||||
|
{
|
||||||
|
quint32 buf[2];
|
||||||
|
fillRange(buf);
|
||||||
|
return buf[0] | (quint64(buf[1]) << 32);
|
||||||
|
}
|
||||||
|
|
||||||
|
double generateDouble()
|
||||||
{
|
{
|
||||||
// IEEE 754 double precision has:
|
// IEEE 754 double precision has:
|
||||||
// 1 bit sign
|
// 1 bit sign
|
||||||
@ -77,87 +102,161 @@ public:
|
|||||||
return double(x) / double(limit);
|
return double(x) / double(limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
static qreal bounded(qreal sup)
|
double bounded(double highest)
|
||||||
{
|
{
|
||||||
return generateDouble() * sup;
|
return generateDouble() * highest;
|
||||||
}
|
}
|
||||||
|
|
||||||
static quint32 bounded(quint32 sup)
|
quint32 bounded(quint32 highest)
|
||||||
{
|
{
|
||||||
quint64 value = generate();
|
quint64 value = generate();
|
||||||
value *= sup;
|
value *= highest;
|
||||||
value /= (max)() + quint64(1);
|
value /= (max)() + quint64(1);
|
||||||
return quint32(value);
|
return quint32(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bounded(int sup)
|
int bounded(int highest)
|
||||||
{
|
{
|
||||||
return int(bounded(quint32(sup)));
|
return int(bounded(quint32(highest)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static quint32 bounded(quint32 min, quint32 sup)
|
quint32 bounded(quint32 lowest, quint32 highest)
|
||||||
{
|
{
|
||||||
return bounded(sup - min) + min;
|
return bounded(highest - lowest) + lowest;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bounded(int min, int sup)
|
int bounded(int lowest, int highest)
|
||||||
{
|
{
|
||||||
return bounded(sup - min) + min;
|
return bounded(highest - lowest) + lowest;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename UInt, IfValidUInt<UInt> = true>
|
template <typename UInt, IfValidUInt<UInt> = true>
|
||||||
static void fillRange(UInt *buffer, qssize_t count)
|
void fillRange(UInt *buffer, qssize_t count)
|
||||||
{
|
{
|
||||||
fillRange_helper(buffer, buffer + count);
|
_fillRange(buffer, buffer + count);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename UInt, size_t N, IfValidUInt<UInt> = true>
|
template <typename UInt, size_t N, IfValidUInt<UInt> = true>
|
||||||
static void fillRange(UInt (&buffer)[N])
|
void fillRange(UInt (&buffer)[N])
|
||||||
{
|
{
|
||||||
fillRange_helper(buffer, buffer + N);
|
_fillRange(buffer, buffer + N);
|
||||||
}
|
}
|
||||||
|
|
||||||
// API like std::seed_seq
|
// API like std::seed_seq
|
||||||
template <typename ForwardIterator>
|
template <typename ForwardIterator>
|
||||||
void generate(ForwardIterator begin, ForwardIterator end)
|
void generate(ForwardIterator begin, ForwardIterator end)
|
||||||
{
|
{
|
||||||
auto generator = static_cast<quint32 (*)()>(&QRandomGenerator::generate);
|
std::generate(begin, end, [this]() { return generate(); });
|
||||||
std::generate(begin, end, generator);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void generate(quint32 *begin, quint32 *end)
|
void generate(quint32 *begin, quint32 *end)
|
||||||
{
|
{
|
||||||
fillRange_helper(begin, end);
|
_fillRange(begin, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
// API like std::random_device
|
// API like std:: random engines
|
||||||
typedef quint32 result_type;
|
typedef quint32 result_type;
|
||||||
result_type operator()() { return generate(); }
|
result_type operator()() { return generate(); }
|
||||||
double entropy() const Q_DECL_NOTHROW { return 0.0; }
|
void seed(quint32 s = 1) { *this = { s }; }
|
||||||
|
void seed(std::seed_seq &sseq) Q_DECL_NOTHROW { *this = { sseq }; }
|
||||||
|
Q_CORE_EXPORT void discard(unsigned long long z);
|
||||||
static Q_DECL_CONSTEXPR result_type min() { return (std::numeric_limits<result_type>::min)(); }
|
static Q_DECL_CONSTEXPR result_type min() { return (std::numeric_limits<result_type>::min)(); }
|
||||||
static Q_DECL_CONSTEXPR result_type max() { return (std::numeric_limits<result_type>::max)(); }
|
static Q_DECL_CONSTEXPR result_type max() { return (std::numeric_limits<result_type>::max)(); }
|
||||||
|
|
||||||
|
static inline Q_DECL_CONST_FUNCTION QRandomGenerator *system();
|
||||||
|
static inline Q_DECL_CONST_FUNCTION QRandomGenerator *global();
|
||||||
|
static inline QRandomGenerator securelySeeded();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
enum System {};
|
||||||
|
QRandomGenerator(System);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Q_CORE_EXPORT void fillRange_helper(void *buffer, void *bufferEnd);
|
Q_CORE_EXPORT void _fillRange(void *buffer, void *bufferEnd);
|
||||||
|
|
||||||
|
friend class QRandomGenerator64;
|
||||||
|
struct SystemGenerator;
|
||||||
|
struct SystemAndGlobalGenerators;
|
||||||
|
typedef std::mt19937 RandomEngine;
|
||||||
|
|
||||||
|
union Storage {
|
||||||
|
uint dummy;
|
||||||
|
#ifdef Q_COMPILER_UNRESTRICTED_UNIONS
|
||||||
|
RandomEngine twister;
|
||||||
|
RandomEngine &engine() { return twister; }
|
||||||
|
const RandomEngine &engine() const { return twister; }
|
||||||
|
#else
|
||||||
|
std::aligned_storage<sizeof(RandomEngine), Q_ALIGNOF(RandomEngine)>::type buffer;
|
||||||
|
RandomEngine &engine() { return reinterpret_cast<RandomEngine &>(buffer); }
|
||||||
|
const RandomEngine &engine() const { return reinterpret_cast<const RandomEngine &>(buffer); }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Q_STATIC_ASSERT_X(std::is_trivially_destructible<RandomEngine>::value,
|
||||||
|
"std::mersenne_twister not trivially destructible as expected");
|
||||||
|
Q_DECL_CONSTEXPR Storage();
|
||||||
|
};
|
||||||
|
uint type;
|
||||||
|
Storage storage;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QRandomGenerator64
|
class QRandomGenerator64 : public QRandomGenerator
|
||||||
{
|
{
|
||||||
|
QRandomGenerator64(System);
|
||||||
public:
|
public:
|
||||||
static QRandomGenerator64 system() { return {}; }
|
// unshadow generate() overloads, since we'll override.
|
||||||
static QRandomGenerator64 global() { return {}; }
|
using QRandomGenerator::generate;
|
||||||
QRandomGenerator64() = default;
|
quint64 generate() { return generate64(); }
|
||||||
|
|
||||||
static quint64 generate() { return QRandomGenerator::generate64(); }
|
|
||||||
|
|
||||||
// API like std::random_device
|
|
||||||
typedef quint64 result_type;
|
typedef quint64 result_type;
|
||||||
result_type operator()() { return QRandomGenerator::generate64(); }
|
result_type operator()() { return generate64(); }
|
||||||
double entropy() const Q_DECL_NOTHROW { return 0.0; }
|
|
||||||
|
#ifndef Q_QDOC
|
||||||
|
QRandomGenerator64(quint32 seedValue = 1)
|
||||||
|
: QRandomGenerator(seedValue)
|
||||||
|
{}
|
||||||
|
template <qssize_t N> QRandomGenerator64(const quint32 (&seedBuffer)[N])
|
||||||
|
: QRandomGenerator(seedBuffer)
|
||||||
|
{}
|
||||||
|
QRandomGenerator64(const quint32 *seedBuffer, qssize_t len)
|
||||||
|
: QRandomGenerator(seedBuffer, len)
|
||||||
|
{}
|
||||||
|
QRandomGenerator64(std::seed_seq &sseq) Q_DECL_NOTHROW
|
||||||
|
: QRandomGenerator(sseq)
|
||||||
|
{}
|
||||||
|
QRandomGenerator64(const quint32 *begin, const quint32 *end)
|
||||||
|
: QRandomGenerator(begin, end)
|
||||||
|
{}
|
||||||
|
QRandomGenerator64(const QRandomGenerator &other) : QRandomGenerator(other) {}
|
||||||
|
|
||||||
|
void discard(unsigned long long z)
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(z * 2 > z, "QRandomGenerator64::discard",
|
||||||
|
"Overflow. Are you sure you want to skip over 9 quintillion samples?");
|
||||||
|
QRandomGenerator::discard(z * 2);
|
||||||
|
}
|
||||||
|
|
||||||
static Q_DECL_CONSTEXPR result_type min() { return (std::numeric_limits<result_type>::min)(); }
|
static Q_DECL_CONSTEXPR result_type min() { return (std::numeric_limits<result_type>::min)(); }
|
||||||
static Q_DECL_CONSTEXPR result_type max() { return (std::numeric_limits<result_type>::max)(); }
|
static Q_DECL_CONSTEXPR result_type max() { return (std::numeric_limits<result_type>::max)(); }
|
||||||
|
static Q_DECL_CONST_FUNCTION Q_CORE_EXPORT QRandomGenerator64 *system();
|
||||||
|
static Q_DECL_CONST_FUNCTION Q_CORE_EXPORT QRandomGenerator64 *global();
|
||||||
|
static Q_CORE_EXPORT QRandomGenerator64 securelySeeded();
|
||||||
|
#endif // Q_QDOC
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline QRandomGenerator *QRandomGenerator::system()
|
||||||
|
{
|
||||||
|
return QRandomGenerator64::system();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QRandomGenerator *QRandomGenerator::global()
|
||||||
|
{
|
||||||
|
return QRandomGenerator64::global();
|
||||||
|
}
|
||||||
|
|
||||||
|
QRandomGenerator QRandomGenerator::securelySeeded()
|
||||||
|
{
|
||||||
|
return QRandomGenerator64::securelySeeded();
|
||||||
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
@ -52,11 +52,12 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include "qglobal_p.h"
|
#include "qglobal_p.h"
|
||||||
|
#include <private/qsimd_p.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
enum QRandomGeneratorControl {
|
enum QRandomGeneratorControl {
|
||||||
SkipMemfill = 1,
|
UseSystemRNG = 1,
|
||||||
SkipSystemRNG = 2,
|
SkipSystemRNG = 2,
|
||||||
SkipHWRNG = 4,
|
SkipHWRNG = 4,
|
||||||
SetRandomData = 8,
|
SetRandomData = 8,
|
||||||
@ -65,6 +66,11 @@ enum QRandomGeneratorControl {
|
|||||||
RandomDataMask = 0xfffffff0
|
RandomDataMask = 0xfffffff0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum RNGType {
|
||||||
|
SystemRNG = 0,
|
||||||
|
MersenneTwister = 1
|
||||||
|
};
|
||||||
|
|
||||||
#if defined(QT_BUILD_INTERNAL) && defined(QT_BUILD_CORE_LIB)
|
#if defined(QT_BUILD_INTERNAL) && defined(QT_BUILD_CORE_LIB)
|
||||||
Q_CORE_EXPORT QBasicAtomicInteger<uint> qt_randomdevice_control = Q_BASIC_ATOMIC_INITIALIZER(0U);
|
Q_CORE_EXPORT QBasicAtomicInteger<uint> qt_randomdevice_control = Q_BASIC_ATOMIC_INITIALIZER(0U);
|
||||||
#elif defined(QT_BUILD_INTERNAL)
|
#elif defined(QT_BUILD_INTERNAL)
|
||||||
@ -73,6 +79,16 @@ extern Q_CORE_EXPORT QBasicAtomicInteger<uint> qt_randomdevice_control;
|
|||||||
enum { qt_randomdevice_control = 0 };
|
enum { qt_randomdevice_control = 0 };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
inline bool qt_has_hwrng()
|
||||||
|
{
|
||||||
|
#if defined(Q_PROCESSOR_X86) && QT_COMPILER_SUPPORTS_HERE(RDRND)
|
||||||
|
return qCpuHasFeature(RDRND);
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#endif // QRANDOM_P_H
|
#endif // QRANDOM_P_H
|
||||||
|
@ -146,7 +146,7 @@ QFileSelectorPrivate::QFileSelectorPrivate()
|
|||||||
Selectors normally available are
|
Selectors normally available are
|
||||||
\list
|
\list
|
||||||
\li platform, any of the following strings which match the platform the application is running
|
\li platform, any of the following strings which match the platform the application is running
|
||||||
on (list not exhaustive): android, ios, osx, darwin, mac, linux, wince, unix, windows.
|
on (list not exhaustive): android, ios, osx, darwin, mac, macos, linux, qnx, unix, windows.
|
||||||
On Linux, if it can be determined, the name of the distribution too, like debian,
|
On Linux, if it can be determined, the name of the distribution too, like debian,
|
||||||
fedora or opensuse.
|
fedora or opensuse.
|
||||||
\li locale, same as QLocale().name().
|
\li locale, same as QLocale().name().
|
||||||
@ -373,8 +373,8 @@ QStringList QFileSelectorPrivate::platformSelectors()
|
|||||||
# endif
|
# endif
|
||||||
#elif defined(Q_OS_UNIX)
|
#elif defined(Q_OS_UNIX)
|
||||||
ret << QStringLiteral("unix");
|
ret << QStringLiteral("unix");
|
||||||
# if !defined(Q_OS_ANDROID)
|
# if !defined(Q_OS_ANDROID) && !defined(Q_OS_QNX)
|
||||||
// we don't want "linux" for Android
|
// we don't want "linux" for Android or two instances of "qnx" for QNX
|
||||||
ret << QSysInfo::kernelType();
|
ret << QSysInfo::kernelType();
|
||||||
# ifdef Q_OS_MAC
|
# ifdef Q_OS_MAC
|
||||||
ret << QStringLiteral("mac"); // compatibility, since kernelType() is "darwin"
|
ret << QStringLiteral("mac"); // compatibility, since kernelType() is "darwin"
|
||||||
|
@ -308,7 +308,7 @@ void QWindowsRemovableDriveListener::addPath(const QString &p)
|
|||||||
notify.dbch_size = sizeof(notify);
|
notify.dbch_size = sizeof(notify);
|
||||||
notify.dbch_devicetype = DBT_DEVTYP_HANDLE;
|
notify.dbch_devicetype = DBT_DEVTYP_HANDLE;
|
||||||
notify.dbch_handle = volumeHandle;
|
notify.dbch_handle = volumeHandle;
|
||||||
QEventDispatcherWin32 *winEventDispatcher = static_cast<QEventDispatcherWin32 *>(QCoreApplication::eventDispatcher());
|
QEventDispatcherWin32 *winEventDispatcher = static_cast<QEventDispatcherWin32 *>(QAbstractEventDispatcher::instance());
|
||||||
re.devNotify = RegisterDeviceNotification(winEventDispatcher->internalHwnd(),
|
re.devNotify = RegisterDeviceNotification(winEventDispatcher->internalHwnd(),
|
||||||
¬ify, DEVICE_NOTIFY_WINDOW_HANDLE);
|
¬ify, DEVICE_NOTIFY_WINDOW_HANDLE);
|
||||||
// Empirically found: The notifications also work when the handle is immediately
|
// Empirically found: The notifications also work when the handle is immediately
|
||||||
@ -336,7 +336,7 @@ QWindowsFileSystemWatcherEngine::QWindowsFileSystemWatcherEngine(QObject *parent
|
|||||||
: QFileSystemWatcherEngine(parent)
|
: QFileSystemWatcherEngine(parent)
|
||||||
{
|
{
|
||||||
#ifndef Q_OS_WINRT
|
#ifndef Q_OS_WINRT
|
||||||
if (QAbstractEventDispatcher *eventDispatcher = QCoreApplication::eventDispatcher()) {
|
if (QAbstractEventDispatcher *eventDispatcher = QAbstractEventDispatcher::instance()) {
|
||||||
m_driveListener = new QWindowsRemovableDriveListener(this);
|
m_driveListener = new QWindowsRemovableDriveListener(this);
|
||||||
eventDispatcher->installNativeEventFilter(m_driveListener);
|
eventDispatcher->installNativeEventFilter(m_driveListener);
|
||||||
parent->setProperty("_q_driveListener",
|
parent->setProperty("_q_driveListener",
|
||||||
|
@ -775,6 +775,7 @@ bool QIODevice::open(OpenMode mode)
|
|||||||
d->writeBuffers.clear();
|
d->writeBuffers.clear();
|
||||||
d->setReadChannelCount(isReadable() ? 1 : 0);
|
d->setReadChannelCount(isReadable() ? 1 : 0);
|
||||||
d->setWriteChannelCount(isWritable() ? 1 : 0);
|
d->setWriteChannelCount(isWritable() ? 1 : 0);
|
||||||
|
d->errorString.clear();
|
||||||
#if defined QIODEVICE_DEBUG
|
#if defined QIODEVICE_DEBUG
|
||||||
printf("%p QIODevice::open(0x%x)\n", this, quint32(mode));
|
printf("%p QIODevice::open(0x%x)\n", this, quint32(mode));
|
||||||
#endif
|
#endif
|
||||||
@ -801,7 +802,6 @@ void QIODevice::close()
|
|||||||
emit aboutToClose();
|
emit aboutToClose();
|
||||||
#endif
|
#endif
|
||||||
d->openMode = NotOpen;
|
d->openMode = NotOpen;
|
||||||
d->errorString.clear();
|
|
||||||
d->pos = 0;
|
d->pos = 0;
|
||||||
d->transactionStarted = false;
|
d->transactionStarted = false;
|
||||||
d->transactionPos = 0;
|
d->transactionPos = 0;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2016 The Qt Company Ltd.
|
||||||
** Copyright (C) 2016 Intel Corporation.
|
** Copyright (C) 2017 Intel Corporation.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the QtCore module of the Qt Toolkit.
|
** This file is part of the QtCore module of the Qt Toolkit.
|
||||||
@ -48,6 +48,7 @@
|
|||||||
#include <qdir.h>
|
#include <qdir.h>
|
||||||
#include <qelapsedtimer.h>
|
#include <qelapsedtimer.h>
|
||||||
#include <qfileinfo.h>
|
#include <qfileinfo.h>
|
||||||
|
#include <qrandom.h>
|
||||||
#include <qregexp.h>
|
#include <qregexp.h>
|
||||||
#include <qwineventnotifier.h>
|
#include <qwineventnotifier.h>
|
||||||
#include <private/qsystemlibrary_p.h>
|
#include <private/qsystemlibrary_p.h>
|
||||||
@ -99,10 +100,8 @@ static void qt_create_pipe(Q_PIPE *pipe, bool isInputPipe)
|
|||||||
wchar_t pipeName[256];
|
wchar_t pipeName[256];
|
||||||
unsigned int attempts = 1000;
|
unsigned int attempts = 1000;
|
||||||
forever {
|
forever {
|
||||||
// ### The user must make sure to call qsrand() to make the pipe names less predictable.
|
|
||||||
// ### Replace the call to qrand() with a secure version, once we have it in Qt.
|
|
||||||
_snwprintf(pipeName, sizeof(pipeName) / sizeof(pipeName[0]),
|
_snwprintf(pipeName, sizeof(pipeName) / sizeof(pipeName[0]),
|
||||||
L"\\\\.\\pipe\\qt-%X", qrand());
|
L"\\\\.\\pipe\\qt-%X", QRandomGenerator::global()->generate());
|
||||||
|
|
||||||
DWORD dwOpenMode = FILE_FLAG_OVERLAPPED;
|
DWORD dwOpenMode = FILE_FLAG_OVERLAPPED;
|
||||||
DWORD dwOutputBufferSize = 0;
|
DWORD dwOutputBufferSize = 0;
|
||||||
|
@ -544,6 +544,38 @@ void QStorageInfoPrivate::initRootPath()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef Q_OS_LINUX
|
||||||
|
// udev encodes the labels with ID_LABEL_FS_ENC which is done with
|
||||||
|
// blkid_encode_string(). Within this function some 1-byte utf-8
|
||||||
|
// characters not considered safe (e.g. '\' or ' ') are encoded as hex
|
||||||
|
static QString decodeFsEncString(const QString &str)
|
||||||
|
{
|
||||||
|
QString decoded;
|
||||||
|
decoded.reserve(str.size());
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
while (i < str.size()) {
|
||||||
|
if (i <= str.size() - 4) { // we need at least four characters \xAB
|
||||||
|
if (str.at(i) == QLatin1Char('\\') &&
|
||||||
|
str.at(i+1) == QLatin1Char('x')) {
|
||||||
|
bool bOk;
|
||||||
|
const int code = str.midRef(i+2, 2).toInt(&bOk, 16);
|
||||||
|
// only decode characters between 0x20 and 0x7f but not
|
||||||
|
// the backslash to prevent collisions
|
||||||
|
if (bOk && code >= 0x20 && code < 0x80 && code != '\\') {
|
||||||
|
decoded += QChar(code);
|
||||||
|
i += 4;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
decoded += str.at(i);
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
return decoded;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static inline QString retrieveLabel(const QByteArray &device)
|
static inline QString retrieveLabel(const QByteArray &device)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
@ -557,7 +589,7 @@ static inline QString retrieveLabel(const QByteArray &device)
|
|||||||
it.next();
|
it.next();
|
||||||
QFileInfo fileInfo(it.fileInfo());
|
QFileInfo fileInfo(it.fileInfo());
|
||||||
if (fileInfo.isSymLink() && fileInfo.symLinkTarget() == devicePath)
|
if (fileInfo.isSymLink() && fileInfo.symLinkTarget() == devicePath)
|
||||||
return fileInfo.fileName();
|
return decodeFsEncString(fileInfo.fileName());
|
||||||
}
|
}
|
||||||
#elif defined Q_OS_HAIKU
|
#elif defined Q_OS_HAIKU
|
||||||
fs_info fsInfo;
|
fs_info fsInfo;
|
||||||
|
@ -165,7 +165,7 @@ QFileSystemEntry::NativePath QTemporaryFileName::generateNext()
|
|||||||
|
|
||||||
Char *rIter = placeholderEnd;
|
Char *rIter = placeholderEnd;
|
||||||
while (rIter != placeholderStart) {
|
while (rIter != placeholderStart) {
|
||||||
quint32 rnd = QRandomGenerator::generate();
|
quint32 rnd = QRandomGenerator::global()->generate();
|
||||||
auto applyOne = [&]() {
|
auto applyOne = [&]() {
|
||||||
quint32 v = rnd & ((1 << BitsPerCharacter) - 1);
|
quint32 v = rnd & ((1 << BitsPerCharacter) - 1);
|
||||||
rnd >>= BitsPerCharacter;
|
rnd >>= BitsPerCharacter;
|
||||||
|
@ -1037,6 +1037,7 @@ inline void QUrlPrivate::setAuthority(const QString &auth, int from, int end, QU
|
|||||||
{
|
{
|
||||||
sectionIsPresent &= ~Authority;
|
sectionIsPresent &= ~Authority;
|
||||||
sectionIsPresent |= Host;
|
sectionIsPresent |= Host;
|
||||||
|
port = -1;
|
||||||
|
|
||||||
// we never actually _loop_
|
// we never actually _loop_
|
||||||
while (from != end) {
|
while (from != end) {
|
||||||
@ -1061,10 +1062,8 @@ inline void QUrlPrivate::setAuthority(const QString &auth, int from, int end, QU
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (colonIndex == end - 1) {
|
if (uint(colonIndex) < uint(end) - 1) {
|
||||||
// found a colon but no digits after it
|
// found a colon with digits after it
|
||||||
port = -1;
|
|
||||||
} else if (uint(colonIndex) < uint(end)) {
|
|
||||||
unsigned long x = 0;
|
unsigned long x = 0;
|
||||||
for (int i = colonIndex + 1; i < end; ++i) {
|
for (int i = colonIndex + 1; i < end; ++i) {
|
||||||
ushort c = auth.at(i).unicode();
|
ushort c = auth.at(i).unicode();
|
||||||
@ -1083,8 +1082,6 @@ inline void QUrlPrivate::setAuthority(const QString &auth, int from, int end, QU
|
|||||||
if (mode == QUrl::StrictMode)
|
if (mode == QUrl::StrictMode)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
port = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setHost(auth, from, qMin<uint>(end, colonIndex), mode);
|
setHost(auth, from, qMin<uint>(end, colonIndex), mode);
|
||||||
@ -1644,8 +1641,7 @@ inline QUrlPrivate::ErrorCode QUrlPrivate::validityError(QString *source, int *p
|
|||||||
if (path.isEmpty())
|
if (path.isEmpty())
|
||||||
return NoError;
|
return NoError;
|
||||||
if (path.at(0) == QLatin1Char('/')) {
|
if (path.at(0) == QLatin1Char('/')) {
|
||||||
if (sectionIsPresent & QUrlPrivate::Authority || port != -1 ||
|
if (hasAuthority() || path.length() == 1 || path.at(1) != QLatin1Char('/'))
|
||||||
path.length() == 1 || path.at(1) != QLatin1Char('/'))
|
|
||||||
return NoError;
|
return NoError;
|
||||||
if (source) {
|
if (source) {
|
||||||
*source = path;
|
*source = path;
|
||||||
@ -2474,6 +2470,8 @@ void QUrl::setPort(int port)
|
|||||||
}
|
}
|
||||||
|
|
||||||
d->port = port;
|
d->port = port;
|
||||||
|
if (port != -1)
|
||||||
|
d->sectionIsPresent |= QUrlPrivate::Host;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
|
||||||
|
#include <QtCore/QCoreApplication>
|
||||||
#include <QtCore/QThread>
|
#include <QtCore/QThread>
|
||||||
#include <QtCore/QAbstractEventDispatcher>
|
#include <QtCore/QAbstractEventDispatcher>
|
||||||
#include <QtCore/QElapsedTimer>
|
#include <QtCore/QElapsedTimer>
|
||||||
|
@ -199,8 +199,11 @@ void QWinEventNotifier::setEnabled(bool enable)
|
|||||||
d->enabled = enable;
|
d->enabled = enable;
|
||||||
|
|
||||||
QAbstractEventDispatcher *eventDispatcher = d->threadData->eventDispatcher.load();
|
QAbstractEventDispatcher *eventDispatcher = d->threadData->eventDispatcher.load();
|
||||||
if (!eventDispatcher) // perhaps application is shutting down
|
if (!eventDispatcher) { // perhaps application is shutting down
|
||||||
|
if (!enable && d->waitHandle != nullptr)
|
||||||
|
d->unregisterWaitObject();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (Q_UNLIKELY(thread() != QThread::currentThread())) {
|
if (Q_UNLIKELY(thread() != QThread::currentThread())) {
|
||||||
qWarning("QWinEventNotifier: Event notifiers cannot be enabled or disabled from another thread");
|
qWarning("QWinEventNotifier: Event notifiers cannot be enabled or disabled from another thread");
|
||||||
return;
|
return;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user