mirror of
https://github.com/ariya/phantomjs.git
synced 2024-09-11 04:46:09 +03:00
Format the code according to our coding style
This commit is contained in:
parent
c1e80bf4c2
commit
2ff3c5ae4a
@ -456,7 +456,7 @@ void CookieJar::save()
|
||||
purgeExpiredCookies();
|
||||
|
||||
#ifndef QT_NO_DEBUG_OUTPUT
|
||||
foreach (QNetworkCookie cookie, allCookies()) {
|
||||
foreach(QNetworkCookie cookie, allCookies()) {
|
||||
qDebug() << "CookieJar - Saved" << cookie.toRawForm();
|
||||
}
|
||||
#endif
|
||||
@ -485,7 +485,7 @@ void CookieJar::load()
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_OUTPUT
|
||||
foreach (QNetworkCookie cookie, allCookies()) {
|
||||
foreach(QNetworkCookie cookie, allCookies()) {
|
||||
qDebug() << "CookieJar - Loaded" << cookie.toRawForm();
|
||||
}
|
||||
#endif
|
||||
|
@ -49,7 +49,7 @@ Env::Env()
|
||||
: QObject(QCoreApplication::instance())
|
||||
{
|
||||
const QProcessEnvironment& env = QProcessEnvironment::systemEnvironment();
|
||||
foreach (const QString& key, env.keys()) {
|
||||
foreach(const QString & key, env.keys()) {
|
||||
m_map[key] = env.value(key);
|
||||
}
|
||||
}
|
||||
|
@ -354,7 +354,7 @@ bool FileSystem::_copyTree(const QString& source, const QString& destination) co
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (QFileInfo entry, sourceDir.entryInfoList(sourceDirFilter, QDir::DirsFirst)) {
|
||||
foreach(QFileInfo entry, sourceDir.entryInfoList(sourceDirFilter, QDir::DirsFirst)) {
|
||||
if (entry.isDir()) {
|
||||
if (!FileSystem::_copyTree(entry.absoluteFilePath(),
|
||||
destination + "/" + entry.fileName())) { //< directory: recursive call
|
||||
@ -393,7 +393,7 @@ bool FileSystem::_removeTree(const QString& path) const
|
||||
QDir::Filters dirFilter = QDir::NoDotAndDotDot | QDir::System | QDir::Hidden | QDir::AllDirs | QDir::Files;
|
||||
|
||||
if (dir.exists()) {
|
||||
foreach (QFileInfo info, dir.entryInfoList(dirFilter, QDir::DirsFirst)) {
|
||||
foreach(QFileInfo info, dir.entryInfoList(dirFilter, QDir::DirsFirst)) {
|
||||
if (info.isDir()) {
|
||||
if (!FileSystem::_removeTree(info.absoluteFilePath())) { //< directory: recursive call
|
||||
return false;
|
||||
@ -464,7 +464,7 @@ QObject* FileSystem::_open(const QString& path, const QVariantMap& opts) const
|
||||
QFile::OpenMode modeCode = QFile::NotOpen;
|
||||
|
||||
// Determine the OpenMode
|
||||
foreach (const QChar& c, modeVar.toString()) {
|
||||
foreach(const QChar & c, modeVar.toString()) {
|
||||
switch (c.toLatin1()) {
|
||||
case 'r': case 'R': {
|
||||
modeCode |= QFile::ReadOnly;
|
||||
|
@ -220,9 +220,9 @@ void NetworkAccessManager::prepareSslConfiguration(const Config* config)
|
||||
// That overload isn't available on QSslConfiguration.
|
||||
if (!config->sslCiphers().isEmpty()) {
|
||||
QList<QSslCipher> cipherList;
|
||||
foreach (const QString& cipherName,
|
||||
config->sslCiphers().split(QLatin1String(":"),
|
||||
QString::SkipEmptyParts)) {
|
||||
foreach(const QString & cipherName,
|
||||
config->sslCiphers().split(QLatin1String(":"),
|
||||
QString::SkipEmptyParts)) {
|
||||
QSslCipher cipher(cipherName);
|
||||
if (!cipher.isNull()) {
|
||||
cipherList << cipher;
|
||||
@ -313,7 +313,7 @@ void NetworkAccessManager::setCaptureContent(const QStringList& patterns)
|
||||
|
||||
void NetworkAccessManager::compileCaptureContentPatterns()
|
||||
{
|
||||
foreach (const QString& plainRegex, m_captureContentPatterns) {
|
||||
foreach(const QString & plainRegex, m_captureContentPatterns) {
|
||||
QRegExp regexp = QRegExp(plainRegex, Qt::CaseInsensitive);
|
||||
if (m_compiledCaptureContentPatterns.contains(regexp)) {
|
||||
qWarning() << "Attempt to add duplicate regular expression: " << plainRegex;
|
||||
@ -373,7 +373,7 @@ QNetworkReply* NetworkAccessManager::createRequest(Operation op, const QNetworkR
|
||||
m_idCounter++;
|
||||
|
||||
QVariantList headers;
|
||||
foreach (QByteArray headerName, req.rawHeaderList()) {
|
||||
foreach(QByteArray headerName, req.rawHeaderList()) {
|
||||
QVariantMap header;
|
||||
header["name"] = QString::fromUtf8(headerName);
|
||||
header["value"] = QString::fromUtf8(req.rawHeader(headerName));
|
||||
@ -426,7 +426,7 @@ QNetworkReply* NetworkAccessManager::createRequest(Operation op, const QNetworkR
|
||||
|
||||
bool NetworkAccessManager::shouldCaptureResponse(const QString& url)
|
||||
{
|
||||
foreach (QRegExp regexp, m_compiledCaptureContentPatterns) {
|
||||
foreach(QRegExp regexp, m_compiledCaptureContentPatterns) {
|
||||
if (regexp.indexIn(url) != -1) {
|
||||
return true;
|
||||
}
|
||||
@ -505,7 +505,7 @@ void NetworkAccessManager::handleFinished(QNetworkReply* reply, int requestId, i
|
||||
|
||||
void NetworkAccessManager::handleSslErrors(QNetworkReply* reply, const QList<QSslError>& errors)
|
||||
{
|
||||
foreach (QSslError e, errors) {
|
||||
foreach(QSslError e, errors) {
|
||||
qDebug() << "Network - SSL Error:" << e;
|
||||
}
|
||||
|
||||
@ -534,13 +534,13 @@ void NetworkAccessManager::handleNetworkError(QNetworkReply* reply, int requestI
|
||||
|
||||
QVariantList NetworkAccessManager::getHeadersFromReply(const QNetworkReply* reply)
|
||||
{
|
||||
QVariantList headers;
|
||||
foreach (QByteArray headerName, reply->rawHeaderList()) {
|
||||
QVariantMap header;
|
||||
header["name"] = QString::fromUtf8(headerName);
|
||||
header["value"] = QString::fromUtf8(reply->rawHeader(headerName));
|
||||
headers += header;
|
||||
}
|
||||
QVariantList headers;
|
||||
foreach(QByteArray headerName, reply->rawHeaderList()) {
|
||||
QVariantMap header;
|
||||
header["name"] = QString::fromUtf8(headerName);
|
||||
header["value"] = QString::fromUtf8(reply->rawHeader(headerName));
|
||||
headers += header;
|
||||
}
|
||||
|
||||
return headers;
|
||||
return headers;
|
||||
}
|
@ -122,7 +122,7 @@ void NetworkReplyProxy::applyMetaData()
|
||||
*/
|
||||
|
||||
QList<QByteArray> headers = m_reply->rawHeaderList();
|
||||
foreach (QByteArray header, headers) {
|
||||
foreach(QByteArray header, headers) {
|
||||
setRawHeader(header, m_reply->rawHeader(header));
|
||||
}
|
||||
|
||||
|
@ -522,7 +522,7 @@ void Phantom::doExit(int code)
|
||||
emit aboutToExit(code);
|
||||
m_terminated = true;
|
||||
m_returnValue = code;
|
||||
foreach (QPointer<WebPage> page, m_pages) {
|
||||
foreach(QPointer<WebPage> page, m_pages) {
|
||||
if (!page) {
|
||||
continue;
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ void REPL::offerCompletion(const char* buf, linenoiseCompletions* lc)
|
||||
QString()
|
||||
).toStringList();
|
||||
|
||||
foreach (QString c, completions) {
|
||||
foreach(QString c, completions) {
|
||||
if (lastIndexOfDot > -1) {
|
||||
// Preserve the "toInspect" portion of the string to complete
|
||||
linenoiseAddCompletion(lc, QString("%1.%2").arg(toInspect, c).toLocal8Bit().data());
|
||||
|
@ -1454,7 +1454,7 @@ void WebPage::sendEvent(const QString& type, const QVariant& arg1, const QVarian
|
||||
if (arg1.type() == QVariant::String) {
|
||||
// this is the case for e.g. sendEvent("...", 'A')
|
||||
// but also works with sendEvent("...", "ABCD")
|
||||
foreach (const QChar typeChar, arg1.toString()) {
|
||||
foreach(const QChar typeChar, arg1.toString()) {
|
||||
sendEvent("keydown", typeChar, QVariant(), QString(), modifierArg);
|
||||
sendEvent("keyup", typeChar, QVariant(), QString(), modifierArg);
|
||||
}
|
||||
@ -1546,7 +1546,7 @@ QStringList WebPage::pagesWindowName() const
|
||||
{
|
||||
QStringList pagesWindowName;
|
||||
|
||||
foreach (const WebPage* p, this->findChildren<WebPage*>()) {
|
||||
foreach(const WebPage * p, this->findChildren<WebPage*>()) {
|
||||
pagesWindowName << p->windowName();
|
||||
}
|
||||
|
||||
@ -1588,7 +1588,7 @@ QStringList WebPage::framesName() const
|
||||
{
|
||||
QStringList framesName;
|
||||
|
||||
foreach (const QWebFrame* f, m_currentFrame->childFrames()) {
|
||||
foreach(const QWebFrame * f, m_currentFrame->childFrames()) {
|
||||
framesName << f->frameName();
|
||||
}
|
||||
return framesName;
|
||||
|
@ -66,7 +66,7 @@ QVariantMap parse(const QByteArray& data)
|
||||
if (data.isEmpty()) {
|
||||
return ret;
|
||||
}
|
||||
foreach (const QByteArray& part, data.split('&')) {
|
||||
foreach(const QByteArray & part, data.split('&')) {
|
||||
const int eqPos = part.indexOf('=');
|
||||
if (eqPos == -1) {
|
||||
ret[unescape(part)] = "";
|
||||
@ -144,7 +144,7 @@ void WebServer::close()
|
||||
// make sure we wake up all pending responses, such that mg_stop()
|
||||
// can be called without deadlocking
|
||||
QMutexLocker lock(&m_mutex);
|
||||
foreach (WebServerResponse* response, m_pendingResponses) {
|
||||
foreach(WebServerResponse * response, m_pendingResponses) {
|
||||
response->close();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user