diff options
28 files changed, 331 insertions, 155 deletions
diff --git a/examples/network/blockingfortuneclient/blockingclient.cpp b/examples/network/blockingfortuneclient/blockingclient.cpp index b731f7a..a3d7c23 100644 --- a/examples/network/blockingfortuneclient/blockingclient.cpp +++ b/examples/network/blockingfortuneclient/blockingclient.cpp @@ -50,7 +50,22 @@ BlockingClient::BlockingClient(QWidget *parent) hostLabel = new QLabel(tr("&Server name:")); portLabel = new QLabel(tr("S&erver port:")); - hostLineEdit = new QLineEdit("Localhost"); + // find out which IP to connect to + QString ipAddress; + QList<QHostAddress> ipAddressesList = QNetworkInterface::allAddresses(); + // use the first non-localhost IPv4 address + for (int i = 0; i < ipAddressesList.size(); ++i) { + if (ipAddressesList.at(i) != QHostAddress::LocalHost && + ipAddressesList.at(i).toIPv4Address()) { + ipAddress = ipAddressesList.at(i).toString(); + break; + } + } + // if we did not find one, use IPv4 localhost + if (ipAddress.isEmpty()) + ipAddress = QHostAddress(QHostAddress::LocalHost).toString(); + + hostLineEdit = new QLineEdit(ipAddress); portLineEdit = new QLineEdit; portLineEdit->setValidator(new QIntValidator(1, 65535, this)); diff --git a/examples/network/fortuneclient/client.cpp b/examples/network/fortuneclient/client.cpp index ca5d40e..e043f78 100644 --- a/examples/network/fortuneclient/client.cpp +++ b/examples/network/fortuneclient/client.cpp @@ -62,8 +62,10 @@ Client::Client(QWidget *parent) // use the first non-localhost IPv4 address for (int i = 0; i < ipAddressesList.size(); ++i) { if (ipAddressesList.at(i) != QHostAddress::LocalHost && - ipAddressesList.at(i).toIPv4Address()) + ipAddressesList.at(i).toIPv4Address()) { ipAddress = ipAddressesList.at(i).toString(); + break; + } } // if we did not find one, use IPv4 localhost if (ipAddress.isEmpty()) diff --git a/examples/network/fortuneserver/server.cpp b/examples/network/fortuneserver/server.cpp index 52b7d61..06f6eeb 100644 --- a/examples/network/fortuneserver/server.cpp +++ b/examples/network/fortuneserver/server.cpp @@ -68,8 +68,10 @@ Server::Server(QWidget *parent) // use the first non-localhost IPv4 address for (int i = 0; i < ipAddressesList.size(); ++i) { if (ipAddressesList.at(i) != QHostAddress::LocalHost && - ipAddressesList.at(i).toIPv4Address()) + ipAddressesList.at(i).toIPv4Address()) { ipAddress = ipAddressesList.at(i).toString(); + break; + } } // if we did not find one, use IPv4 localhost if (ipAddress.isEmpty()) diff --git a/examples/network/threadedfortuneserver/dialog.cpp b/examples/network/threadedfortuneserver/dialog.cpp index b1ea395..d0d3fc0 100644 --- a/examples/network/threadedfortuneserver/dialog.cpp +++ b/examples/network/threadedfortuneserver/dialog.cpp @@ -67,8 +67,10 @@ Dialog::Dialog(QWidget *parent) // use the first non-localhost IPv4 address for (int i = 0; i < ipAddressesList.size(); ++i) { if (ipAddressesList.at(i) != QHostAddress::LocalHost && - ipAddressesList.at(i).toIPv4Address()) + ipAddressesList.at(i).toIPv4Address()) { ipAddress = ipAddressesList.at(i).toString(); + break; + } } // if we did not find one, use IPv4 localhost if (ipAddress.isEmpty()) diff --git a/src/corelib/xml/make-parser.sh b/src/corelib/xml/make-parser.sh index 9866555..35289d2 100755 --- a/src/corelib/xml/make-parser.sh +++ b/src/corelib/xml/make-parser.sh @@ -42,7 +42,7 @@ me=$(dirname $0) mkdir -p $me/out -(cd $me/out && ../../../../util/qlalr/qlalr --troll --no-debug --no-lines ../qxmlstream.g) +(cd $me/out && ../../../../util/qlalr/qlalr --qt --no-debug --no-lines ../qxmlstream.g) for f in $me/out/*.h; do n=$(basename $f) diff --git a/src/corelib/xml/qxmlstream.g b/src/corelib/xml/qxmlstream.g index 6c0c0cf..22ba33d 100644 --- a/src/corelib/xml/qxmlstream.g +++ b/src/corelib/xml/qxmlstream.g @@ -158,6 +158,7 @@ public: if (tos + extraCapacity + 1 > cap) { cap = qMax(tos + extraCapacity + 1, cap << 1 ); data = reinterpret_cast<T *>(qRealloc(data, cap * sizeof(T))); + Q_CHECK_PTR(data); } } diff --git a/src/corelib/xml/qxmlstream_p.h b/src/corelib/xml/qxmlstream_p.h index eee3a13..253f8bd 100644 --- a/src/corelib/xml/qxmlstream_p.h +++ b/src/corelib/xml/qxmlstream_p.h @@ -1,4 +1,3 @@ -// This file was generated by qlalr - DO NOT EDIT! /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). @@ -51,6 +50,7 @@ // We mean it. // +// This file was generated by qlalr - DO NOT EDIT! #ifndef QXMLSTREAM_P_H #define QXMLSTREAM_P_H @@ -132,13 +132,13 @@ public: }; static const char *const spell []; - static const qint16 lhs []; - static const qint16 rhs []; - static const qint16 goto_default []; - static const qint16 action_default []; - static const qint16 action_index []; - static const qint16 action_info []; - static const qint16 action_check []; + static const short lhs []; + static const short rhs []; + static const short goto_default []; + static const short action_default []; + static const short action_index []; + static const short action_info []; + static const short action_check []; static inline int nt_action (int state, int nt) { @@ -169,7 +169,7 @@ const char *const QXmlStreamReader_Table::spell [] = { "EMPTY", "ANY", "PCDATA", 0, 0, 0, 0, "CDATA", "ID", "IDREF", "IDREFS", "ENTITIES", "NMTOKEN", "NMTOKENS", "<?xml", "version", 0}; -const qint16 QXmlStreamReader_Table::lhs [] = { +const short QXmlStreamReader_Table::lhs [] = { 57, 57, 59, 59, 59, 59, 59, 59, 59, 59, 67, 68, 64, 72, 72, 72, 75, 66, 66, 66, 66, 79, 78, 80, 80, 80, 80, 80, 80, 81, @@ -198,7 +198,7 @@ const qint16 QXmlStreamReader_Table::lhs [] = { 58, 58, 58, 58, 58, 58, 58, 58, 74, 69, 69, 77, 111, 102, 102, 102, 102, 102, 140}; -const qint16 QXmlStreamReader_Table:: rhs[] = { +const short QXmlStreamReader_Table::rhs [] = { 2, 1, 4, 2, 2, 2, 2, 2, 2, 0, 1, 1, 9, 2, 4, 0, 4, 4, 6, 6, 4, 1, 3, 1, 1, 1, 2, 2, 2, 1, @@ -227,7 +227,7 @@ const qint16 QXmlStreamReader_Table:: rhs[] = { 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2}; -const qint16 QXmlStreamReader_Table::action_default [] = { +const short QXmlStreamReader_Table::action_default [] = { 10, 258, 0, 2, 1, 0, 124, 116, 118, 119, 126, 128, 122, 11, 113, 107, 0, 108, 127, 110, 114, 112, 120, 123, 125, 106, 109, 111, 117, 115, @@ -272,7 +272,7 @@ const qint16 QXmlStreamReader_Table::action_default [] = { 260, 0, 230, 0, 0, 13, 269, 9, 5, 8, 4, 0, 7, 258, 6, 0, 3}; -const qint16 QXmlStreamReader_Table::goto_default [] = { +const short QXmlStreamReader_Table::goto_default [] = { 2, 4, 3, 49, 388, 43, 37, 52, 47, 41, 249, 53, 127, 84, 393, 81, 85, 126, 42, 46, 169, 130, 131, 146, 145, 149, 138, 136, 140, 147, @@ -283,7 +283,7 @@ const qint16 QXmlStreamReader_Table::goto_default [] = { 264, 252, 251, 250, 339, 326, 325, 329, 398, 399, 50, 51, 59, 0}; -const qint16 QXmlStreamReader_Table::action_index [] = { +const short QXmlStreamReader_Table::action_index [] = { -21, -57, 33, 119, 960, 70, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, 105, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, @@ -372,7 +372,7 @@ const qint16 QXmlStreamReader_Table::action_index [] = { 28, 15, 82, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, 3, -84, 98, -84}; -const qint16 QXmlStreamReader_Table::action_info [] = { +const short QXmlStreamReader_Table::action_info [] = { 65, 332, 65, 405, 392, 385, 377, 65, 414, 410, 415, 55, 397, 374, 373, 217, 206, 408, 65, 65, 207, 211, 216, 1, 55, 199, 182, 192, 70, 70, @@ -506,7 +506,7 @@ const qint16 QXmlStreamReader_Table::action_info [] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -const qint16 QXmlStreamReader_Table::action_check [] = { +const short QXmlStreamReader_Table::action_check [] = { 26, 18, 26, 14, 4, 4, 4, 26, 24, 14, 4, 26, 4, 4, 4, 4, 22, 55, 26, 26, 42, 4, 4, 44, 26, 22, 19, 12, 2, 2, diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 748658d..2d27668 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -934,7 +934,8 @@ QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p) rootNode(QString(QLatin1Char('/'))) { static const bool threads = q_dbus_threads_init_default(); - static const int debugging = ::isDebugging = qgetenv("QDBUS_DEBUG").toInt(); + static const int debugging = qgetenv("QDBUS_DEBUG").toInt(); + ::isDebugging = debugging; Q_UNUSED(threads) Q_UNUSED(debugging) diff --git a/src/dbus/qdbusinterface.cpp b/src/dbus/qdbusinterface.cpp index 74b2a44..d0a693f 100644 --- a/src/dbus/qdbusinterface.cpp +++ b/src/dbus/qdbusinterface.cpp @@ -157,7 +157,9 @@ QDBusInterfacePrivate::QDBusInterfacePrivate(const QString &serv, const QString if (!metaObject) { // creation failed, somehow - isValid = false; + // most common causes are that the service doesn't exist or doesn't support introspection + // those are not fatal errors, so we continue working + if (!lastError.isValid()) lastError = QDBusError(QDBusError::InternalError, QLatin1String("Unknown error")); } @@ -232,7 +234,7 @@ QDBusInterface::~QDBusInterface() */ const QMetaObject *QDBusInterface::metaObject() const { - return d_func()->isValid ? d_func()->metaObject : &QDBusAbstractInterface::staticMetaObject; + return d_func()->metaObject ? d_func()->metaObject : &QDBusAbstractInterface::staticMetaObject; } /*! diff --git a/src/dbus/qdbusxmlgenerator.cpp b/src/dbus/qdbusxmlgenerator.cpp index 9870584..380b949 100644 --- a/src/dbus/qdbusxmlgenerator.cpp +++ b/src/dbus/qdbusxmlgenerator.cpp @@ -203,7 +203,7 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method const char *typeName = QVariant::typeToName( QVariant::Type(types.at(j)) ); xml += QString::fromLatin1(" <annotation name=\"com.trolltech.QtDBus.QtTypeName.%1%2\" value=\"%3\"/>\n") .arg(isOutput ? QLatin1String("Out") : QLatin1String("In")) - .arg(isOutput ? j - inputCount : j - 1) + .arg(isOutput && !isSignal ? j - inputCount : j - 1) .arg(typeNameToXml(typeName)); } } diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 8dd7a00..2dbd512 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -194,11 +194,20 @@ void QHttpNetworkConnectionPrivate::prepareRequest(HttpMessagePair &messagePair) // some websites mandate an accept-language header and fail // if it is not sent. This is a problem with the website and - // not with us, but we work around this by setting a - // universal one always. + // not with us, but we work around this by setting + // one always. value = request.headerField("accept-language"); - if (value.isEmpty()) - request.setHeaderField("accept-language", "en,*"); + if (value.isEmpty()) { + QString systemLocale = QLocale::system().name().replace(QChar::fromAscii('_'),QChar::fromAscii('-')); + QString acceptLanguage; + if (systemLocale == QLatin1String("C")) + acceptLanguage = QString::fromAscii("en,*"); + else if (systemLocale.startsWith(QLatin1String("en-"))) + acceptLanguage = QString::fromAscii("%1,*").arg(systemLocale); + else + acceptLanguage = QString::fromAscii("%1,en,*").arg(systemLocale); + request.setHeaderField("Accept-Language", acceptLanguage.toAscii()); + } // set the User Agent value = request.headerField("user-agent"); diff --git a/src/network/access/qhttpnetworkheader.cpp b/src/network/access/qhttpnetworkheader.cpp index 68ed3e5..e9866ca 100644 --- a/src/network/access/qhttpnetworkheader.cpp +++ b/src/network/access/qhttpnetworkheader.cpp @@ -92,11 +92,10 @@ QByteArray QHttpNetworkHeaderPrivate::headerField(const QByteArray &name, const QList<QByteArray> QHttpNetworkHeaderPrivate::headerFieldValues(const QByteArray &name) const { QList<QByteArray> result; - QByteArray lowerName = name.toLower(); QList<QPair<QByteArray, QByteArray> >::ConstIterator it = fields.constBegin(), end = fields.constEnd(); for ( ; it != end; ++it) - if (lowerName == it->first.toLower()) + if (qstricmp(name.constData(), it->first) == 0) result += it->second; return result; @@ -104,10 +103,9 @@ QList<QByteArray> QHttpNetworkHeaderPrivate::headerFieldValues(const QByteArray void QHttpNetworkHeaderPrivate::setHeaderField(const QByteArray &name, const QByteArray &data) { - QByteArray lowerName = name.toLower(); QList<QPair<QByteArray, QByteArray> >::Iterator it = fields.begin(); while (it != fields.end()) { - if (lowerName == it->first.toLower()) + if (qstricmp(name.constData(), it->first) == 0) it = fields.erase(it); else ++it; diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index e990704..2b0c252 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -239,7 +239,7 @@ qint64 QHttpNetworkReplyPrivate::bytesAvailable() const bool QHttpNetworkReplyPrivate::isGzipped() { QByteArray encoding = headerField("content-encoding"); - return encoding.toLower() == "gzip"; + return qstricmp(encoding.constData(), "gzip") == 0; } void QHttpNetworkReplyPrivate::removeAutoDecompressHeader() @@ -247,11 +247,10 @@ void QHttpNetworkReplyPrivate::removeAutoDecompressHeader() // The header "Content-Encoding = gzip" is retained. // Content-Length is removed since the actual one send by the server is for compressed data QByteArray name("content-length"); - QByteArray lowerName = name.toLower(); QList<QPair<QByteArray, QByteArray> >::Iterator it = fields.begin(), end = fields.end(); while (it != end) { - if (name == it->first.toLower()) { + if (qstricmp(name.constData(), it->first.constData()) == 0) { fields.erase(it); break; } @@ -269,6 +268,7 @@ bool QHttpNetworkReplyPrivate::findChallenge(bool forProxy, QByteArray &challeng QList<QByteArray> challenges = headerFieldValues(header); for (int i = 0; i<challenges.size(); i++) { QByteArray line = challenges.at(i); + // todo use qstrincmp if (!line.toLower().startsWith("negotiate")) challenge = line; } diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index 1a92868..3e2db7a 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -141,6 +141,8 @@ QNonContiguousByteDevice* QNetworkAccessBackend::createUploadByteDevice() // and the special backends need to access this. void QNetworkAccessBackend::emitReplyUploadProgress(qint64 bytesSent, qint64 bytesTotal) { + if (reply->isFinished()) + return; reply->emitUploadProgress(bytesSent, bytesTotal); } diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index bfcc299..91f9189 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -732,7 +732,7 @@ void QNetworkAccessHttpBackend::replyHeaderChanged() for (; it != end; ++it) { QByteArray value = rawHeader(it->first); if (!value.isEmpty()) { - if (it->first.toLower() == "set-cookie") + if (qstricmp(it->first.constData(), "set-cookie") == 0) value += "\n"; else value += ", "; diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index 86195c6..c91c608 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -48,6 +48,8 @@ #include "QtCore/qlocale.h" #include "QtCore/qdatetime.h" +#include <ctype.h> + QT_BEGIN_NAMESPACE /*! @@ -606,26 +608,25 @@ static QNetworkRequest::KnownHeaders parseHeaderName(const QByteArray &headerNam { // headerName is not empty here - QByteArray lower = headerName.toLower(); - switch (lower.at(0)) { + switch (tolower(headerName.at(0))) { case 'c': - if (lower == "content-type") + if (qstricmp(headerName.constData(), "content-type") == 0) return QNetworkRequest::ContentTypeHeader; - else if (lower == "content-length") + else if (qstricmp(headerName.constData(), "content-length") == 0) return QNetworkRequest::ContentLengthHeader; - else if (lower == "cookie") + else if (qstricmp(headerName.constData(), "cookie") == 0) return QNetworkRequest::CookieHeader; break; case 'l': - if (lower == "location") + if (qstricmp(headerName.constData(), "location") == 0) return QNetworkRequest::LocationHeader; - else if (lower == "last-modified") + else if (qstricmp(headerName.constData(), "last-modified") == 0) return QNetworkRequest::LastModifiedHeader; break; case 's': - if (lower == "set-cookie") + if (qstricmp(headerName.constData(), "set-cookie") == 0) return QNetworkRequest::SetCookieHeader; break; } @@ -697,11 +698,10 @@ static QVariant parseHeaderValue(QNetworkRequest::KnownHeaders header, const QBy QNetworkHeadersPrivate::RawHeadersList::ConstIterator QNetworkHeadersPrivate::findRawHeader(const QByteArray &key) const { - QByteArray lowerKey = key.toLower(); RawHeadersList::ConstIterator it = rawHeaders.constBegin(); RawHeadersList::ConstIterator end = rawHeaders.constEnd(); for ( ; it != end; ++it) - if (it->first.toLower() == lowerKey) + if (qstricmp(it->first.constData(), key.constData()) == 0) return it; return end; // not found @@ -775,10 +775,9 @@ void QNetworkHeadersPrivate::setCookedHeader(QNetworkRequest::KnownHeaders heade void QNetworkHeadersPrivate::setRawHeaderInternal(const QByteArray &key, const QByteArray &value) { - QByteArray lowerKey = key.toLower(); RawHeadersList::Iterator it = rawHeaders.begin(); while (it != rawHeaders.end()) { - if (it->first.toLower() == lowerKey) + if (qstricmp(it->first.constData(), key.constData()) == 0) it = rawHeaders.erase(it); else ++it; @@ -805,6 +804,68 @@ void QNetworkHeadersPrivate::parseAndSetHeader(const QByteArray &key, const QByt } } +// Fast month string to int conversion. This code +// assumes that the Month name is correct and that +// the string is at least three chars long. +static int name_to_month(const char* month_str) +{ + switch (month_str[0]) { + case 'J': + switch (month_str[1]) { + case 'a': + return 1; + break; + case 'u': + switch (month_str[2] ) { + case 'n': + return 6; + break; + case 'l': + return 7; + break; + } + } + break; + case 'F': + return 2; + break; + case 'M': + switch (month_str[2] ) { + case 'r': + return 3; + break; + case 'y': + return 5; + break; + } + break; + case 'A': + switch (month_str[1]) { + case 'p': + return 4; + break; + case 'u': + return 8; + break; + } + break; + case 'O': + return 10; + break; + case 'S': + return 9; + break; + case 'N': + return 11; + break; + case 'D': + return 12; + break; + } + + return 0; +} + QDateTime QNetworkHeadersPrivate::fromHttpDate(const QByteArray &value) { // HTTP dates have three possible formats: @@ -820,16 +881,20 @@ QDateTime QNetworkHeadersPrivate::fromHttpDate(const QByteArray &value) // no comma -> asctime(3) format dt = QDateTime::fromString(QString::fromLatin1(value), Qt::TextDate); } else { - // eat the weekday, the comma and the space following it - QString sansWeekday = QString::fromLatin1(value.constData() + pos + 2); - - QLocale c = QLocale::c(); - if (pos == 3) - // must be RFC 1123 date - dt = c.toDateTime(sansWeekday, QLatin1String("dd MMM yyyy hh:mm:ss 'GMT")); - else + // Use sscanf over QLocal/QDateTimeParser for speed reasons. See the + // QtWebKit performance benchmarks to get an idea. + if (pos == 3) { + char month_name[4]; + int day, year, hour, minute, second; + if (sscanf(value.constData(), "%*3s, %d %3s %d %d:%d:%d 'GMT'", &day, month_name, &year, &hour, &minute, &second) == 6) + dt = QDateTime(QDate(year, name_to_month(month_name), day), QTime(hour, minute, second)); + } else { + QLocale c = QLocale::c(); + // eat the weekday, the comma and the space following it + QString sansWeekday = QString::fromLatin1(value.constData() + pos + 2); // must be RFC 850 date dt = c.toDateTime(sansWeekday, QLatin1String("dd-MMM-yy hh:mm:ss 'GMT'")); + } } #endif // QT_NO_DATESTRING diff --git a/util/qtscriptparser/make-parser.sh b/src/script/parser/make-parser.sh index cfe2513..d0c71fb 100644..100755 --- a/util/qtscriptparser/make-parser.sh +++ b/src/script/parser/make-parser.sh @@ -42,14 +42,12 @@ me=$(dirname $0) mkdir -p $me/out -(cd $me/out && ${QLALR-qlalr} --troll --no-lines ../qscript.g) +(cd $me/out && ../../../../util/qlalr/qlalr --qt --no-lines ../qscript.g) -for f in $me/out/*.{h,cpp}; do +for f in $me/out/*.h $me/out/*.cpp; do n=$(basename $f) - p4 open $me/../../src/script/$n - cp $f $me/../../src/script/$n + cp $f $n done -p4 revert -a $me/../../src/script/... -p4 diff -du $me/../../src/script/... +git diff . diff --git a/src/script/parser/qscript.g b/src/script/parser/qscript.g index b0b0cdf..7e5568a 100644 --- a/src/script/parser/qscript.g +++ b/src/script/parser/qscript.g @@ -78,8 +78,7 @@ %start Program -/. -/**************************************************************************** +/./**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. @@ -87,12 +86,24 @@ ** ** This file is part of the QtScript module of the Qt Toolkit. ** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions ** contained in the Technology Preview License Agreement accompanying ** this package. -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. @@ -108,20 +119,13 @@ ** ****************************************************************************/ +// This file was generated by qlalr - DO NOT EDIT! + + #include <QtCore/QtDebug> #include <string.h> -#include "qscriptengine.h" -#include "qscriptengine_p.h" -#include "qscriptvalueimpl_p.h" -#include "qscriptcontext_p.h" -#include "qscriptmember_p.h" -#include "qscriptobject_p.h" -#include "qscriptlexer_p.h" -#include "qscriptast_p.h" -#include "qscriptnodepool_p.h" - #define Q_SCRIPT_UPDATE_POSITION(node, startloc, endloc) do { \ node->startLine = startloc.startLine; \ node->startColumn = startloc.startColumn; \ @@ -131,8 +135,7 @@ ./ -/: -/**************************************************************************** +/:/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. @@ -140,10 +143,25 @@ ** ** This file is part of the QtScript module of the Qt Toolkit. ** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions ** contained in the Technology Preview License Agreement accompanying ** this package. -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** @@ -153,10 +171,14 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ +// This file was generated by qlalr - DO NOT EDIT! + + // // W A R N I N G // ------------- diff --git a/src/script/parser/qscriptgrammar.cpp b/src/script/parser/qscriptgrammar.cpp index cbb1ab8..c7f661b 100644 --- a/src/script/parser/qscriptgrammar.cpp +++ b/src/script/parser/qscriptgrammar.cpp @@ -1,4 +1,3 @@ -// This file was generated by qlalr - DO NOT EDIT! /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). @@ -40,6 +39,7 @@ ** ****************************************************************************/ +// This file was generated by qlalr - DO NOT EDIT! #include "qscriptgrammar_p.h" QT_BEGIN_NAMESPACE @@ -68,7 +68,7 @@ const char *const QScriptGrammar::spell [] = { #endif // QLALR_NO_QSCRIPTGRAMMAR_DEBUG_INFO }; -const int QScriptGrammar::lhs [] = { +const short QScriptGrammar::lhs [] = { 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 87, 87, 92, 92, 86, 86, 89, 89, 93, 93, 93, 93, 94, 94, 94, @@ -97,7 +97,7 @@ const int QScriptGrammar::lhs [] = { 163, 97, 167, 167, 164, 164, 165, 165, 168, 84, 169, 169, 170, 170, 166, 166, 88, 88, 171}; -const int QScriptGrammar:: rhs[] = { +const short QScriptGrammar::rhs [] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 5, 3, 4, 3, 2, 4, 1, 2, 0, 1, 3, 5, 1, 1, 1, 1, 1, 1, 1, @@ -429,7 +429,7 @@ const int QScriptGrammar::rule_index [] = { 803, 805, 808, 810, 812, 813, 815, 816, 818}; #endif // QLALR_NO_QSCRIPTGRAMMAR_DEBUG_INFO -const int QScriptGrammar::action_default [] = { +const short QScriptGrammar::action_default [] = { 0, 98, 165, 129, 137, 133, 173, 180, 77, 149, 179, 187, 175, 125, 0, 176, 264, 62, 177, 178, 183, 78, 141, 145, 66, 95, 76, 81, 61, 0, @@ -478,7 +478,7 @@ const int QScriptGrammar::action_default [] = { 15, 88, 86, 90, 87, 85, 89, 204, 197, 0, 205, 201, 0, 203, 193, 0, 194, 198}; -const int QScriptGrammar::goto_default [] = { +const short QScriptGrammar::goto_default [] = { 29, 28, 439, 437, 113, 112, 14, 2, 438, 111, 114, 194, 24, 17, 190, 26, 8, 201, 21, 27, 77, 25, 1, 32, 30, 270, 13, 264, 3, 260, @@ -489,7 +489,7 @@ const int QScriptGrammar::goto_default [] = { 460, 324, 395, 399, 402, 398, 397, 417, 418, 16, 100, 107, 96, 99, 106, 108, 33, 0}; -const int QScriptGrammar::action_index [] = { +const short QScriptGrammar::action_index [] = { 1318, 79, -84, 56, 39, -17, -84, -84, 169, -84, -84, -84, -84, 216, 149, -84, -84, -84, -84, -84, -84, 475, 68, 100, 180, 184, -84, -84, -84, 99, @@ -586,7 +586,7 @@ const int QScriptGrammar::action_index [] = { -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, 5, -88, -88, -56, -88, -88}; -const int QScriptGrammar::action_info [] = { +const short QScriptGrammar::action_info [] = { 305, 307, 109, 400, 400, 400, 273, 105, 416, 302, 297, 295, 293, 423, 273, 151, 313, 321, 406, 407, 424, 295, 422, 198, 420, 149, 313, 353, -47, 396, @@ -777,7 +777,7 @@ const int QScriptGrammar::action_info [] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -const int QScriptGrammar::action_check [] = { +const short QScriptGrammar::action_check [] = { 61, 60, 55, 5, 5, 5, 1, 33, 33, 61, 8, 76, 48, 29, 1, 8, 2, 29, 55, 7, 60, 76, 36, 8, 20, 7, 2, 16, 7, 33, diff --git a/src/script/parser/qscriptgrammar_p.h b/src/script/parser/qscriptgrammar_p.h index 9e0f4f8..0cb6d22 100644 --- a/src/script/parser/qscriptgrammar_p.h +++ b/src/script/parser/qscriptgrammar_p.h @@ -39,11 +39,6 @@ ** ****************************************************************************/ -// This file was generated by qlalr - DO NOT EDIT! - -#ifndef QSCRIPTGRAMMAR_P_H -#define QSCRIPTGRAMMAR_P_H - // // W A R N I N G // ------------- @@ -55,6 +50,10 @@ // We mean it. // +// This file was generated by qlalr - DO NOT EDIT! +#ifndef QSCRIPTGRAMMAR_P_H +#define QSCRIPTGRAMMAR_P_H + #include <QtCore/qglobal.h> QT_BEGIN_NAMESPACE @@ -159,33 +158,28 @@ public: GOTO_CHECK_OFFSET = 1562 }; - static const char *const spell []; - static const int lhs []; - static const int rhs []; + static const char *const spell []; + static const short lhs []; + static const short rhs []; #ifndef QLALR_NO_QSCRIPTGRAMMAR_DEBUG_INFO static const int rule_index []; static const int rule_info []; #endif // QLALR_NO_QSCRIPTGRAMMAR_DEBUG_INFO - static const int goto_default []; - static const int action_default []; - static const int action_index []; - static const int action_info []; - static const int action_check []; + static const short goto_default []; + static const short action_default []; + static const short action_index []; + static const short action_info []; + static const short action_check []; static inline int nt_action (int state, int nt) { - const int *const goto_index = &action_index [GOTO_INDEX_OFFSET]; - const int *const goto_check = &action_check [GOTO_CHECK_OFFSET]; - - const int yyn = goto_index [state] + nt; - - if (yyn < 0 || goto_check [yyn] != nt) + const int yyn = action_index [GOTO_INDEX_OFFSET + state] + nt; + if (yyn < 0 || action_check [GOTO_CHECK_OFFSET + yyn] != nt) return goto_default [nt]; - const int *const goto_info = &action_info [GOTO_INFO_OFFSET]; - return goto_info [yyn]; + return action_info [GOTO_INFO_OFFSET + yyn]; } static inline int t_action (int state, int token) @@ -199,6 +193,7 @@ public: } }; -QT_END_NAMESPACE +QT_END_NAMESPACE #endif // QSCRIPTGRAMMAR_P_H + diff --git a/src/script/parser/qscriptparser.cpp b/src/script/parser/qscriptparser.cpp index 197a486..5ea6c17 100644 --- a/src/script/parser/qscriptparser.cpp +++ b/src/script/parser/qscriptparser.cpp @@ -1,5 +1,3 @@ -// This file was generated by qlalr - DO NOT EDIT! - /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). @@ -41,12 +39,13 @@ ** ****************************************************************************/ +// This file was generated by qlalr - DO NOT EDIT! + + #include <QtCore/QtDebug> #include <string.h> -#include "qscriptast_p.h" - #define Q_SCRIPT_UPDATE_POSITION(node, startloc, endloc) do { \ node->startLine = startloc.startLine; \ node->startColumn = startloc.startColumn; \ @@ -1136,9 +1135,9 @@ case 266: { error_message += QLatin1String (", "); first = false; - error_message += QLatin1Char('`'); + error_message += QLatin1String("`"); error_message += QLatin1String (spell [expected_tokens [s]]); - error_message += QLatin1Char('\''); + error_message += QLatin1String("'"); } } diff --git a/src/script/parser/qscriptparser_p.h b/src/script/parser/qscriptparser_p.h index 5f62db7..c940e1e 100644 --- a/src/script/parser/qscriptparser_p.h +++ b/src/script/parser/qscriptparser_p.h @@ -41,6 +41,7 @@ // This file was generated by qlalr - DO NOT EDIT! + // // W A R N I N G // ------------- diff --git a/tests/auto/networkselftest/tst_networkselftest.cpp b/tests/auto/networkselftest/tst_networkselftest.cpp index a09d998..f13bcad 100644 --- a/tests/auto/networkselftest/tst_networkselftest.cpp +++ b/tests/auto/networkselftest/tst_networkselftest.cpp @@ -80,6 +80,9 @@ private slots: void httpProxyNtlmAuth(); void socks5Proxy(); void socks5ProxyAuth(); + + // ssl supported test + void supportsSsl(); }; class Chat @@ -717,5 +720,14 @@ void tst_NetworkSelfTest::socks5ProxyAuth() ); } +void tst_NetworkSelfTest::supportsSsl() +{ +#ifdef QT_NO_OPENSSL + QFAIL("SSL not compiled in"); +#else + QVERIFY(QSslSocket::supportsSsl()); +#endif +} + QTEST_MAIN(tst_NetworkSelfTest) #include "tst_networkselftest.moc" diff --git a/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp b/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp index 91050f5..a2c4758 100644 --- a/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp +++ b/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp @@ -133,7 +133,7 @@ tst_QDBusAbstractInterface::tst_QDBusAbstractInterface() void tst_QDBusAbstractInterface::initTestCase() { // enable debugging temporarily: - putenv("QDBUS_DEBUG=1"); + //putenv("QDBUS_DEBUG=1"); // register the object QDBusConnection con = QDBusConnection::sessionBus(); @@ -465,6 +465,7 @@ void tst_QDBusAbstractInterface::followSignal() QDBusConnectionInterface::DontAllowReplacement); QVERIFY(r.isValid() && r.value() == QDBusConnectionInterface::ServiceRegistered); QVERIFY(con.interface()->isServiceRegistered(serviceToFollow)); + QCoreApplication::instance()->processEvents(); // emit the signal again: emit targetObj.voidSignal(); diff --git a/tests/auto/qdbusinterface/tst_qdbusinterface.cpp b/tests/auto/qdbusinterface/tst_qdbusinterface.cpp index 62d6342..bcd5bd9 100644 --- a/tests/auto/qdbusinterface/tst_qdbusinterface.cpp +++ b/tests/auto/qdbusinterface/tst_qdbusinterface.cpp @@ -234,6 +234,7 @@ void tst_QDBusInterface::notValid() void tst_QDBusInterface::invalidAfterServiceOwnerChanged() { + // this test is technically the same as tst_QDBusAbstractInterface::followSignal QDBusConnection conn = QDBusConnection::sessionBus(); QDBusConnectionInterface *connIface = conn.interface(); @@ -249,7 +250,7 @@ void tst_QDBusInterface::invalidAfterServiceOwnerChanged() QTestEventLoop::instance().enterLoop(5); QVERIFY(!QTestEventLoop::instance().timeout()); - QVERIFY(!invalidInterface.isValid()); + QVERIFY(invalidInterface.isValid()); } void tst_QDBusInterface::introspect() diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 0b61dcd..bd83c47 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -225,6 +225,9 @@ private Q_SLOTS: void ioPostToHttpUploadProgress(); void ioPostToHttpEmtpyUploadProgress(); + void lastModifiedHeaderForFile(); + void lastModifiedHeaderForHttp(); + void rateControl_data(); void rateControl(); @@ -2619,12 +2622,7 @@ void tst_QNetworkReply::ioPostToHttpFromSocket() QSignalSpy authenticationRequiredSpy(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*))); QSignalSpy proxyAuthenticationRequiredSpy(&manager, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*))); -#ifdef Q_OS_SYMBIAN QTestEventLoop::instance().enterLoop(6); -#else - QTestEventLoop::instance().enterLoop(3); -#endif - disconnect(&manager, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), this, SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*))); disconnect(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), @@ -2969,6 +2967,41 @@ void tst_QNetworkReply::ioPostToHttpEmtpyUploadProgress() server.close(); } +void tst_QNetworkReply::lastModifiedHeaderForFile() +{ + QFileInfo fileInfo(SRCDIR "./bigfile"); + QUrl url = QUrl::fromLocalFile(fileInfo.filePath()); + + QNetworkRequest request(url); + QNetworkReplyPtr reply = manager.head(request); + QSignalSpy spy(reply, SIGNAL(uploadProgress(qint64,qint64))); + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QDateTime header = reply->header(QNetworkRequest::LastModifiedHeader).toDateTime(); + QCOMPARE(header, fileInfo.lastModified()); +} + +void tst_QNetworkReply::lastModifiedHeaderForHttp() +{ + // Tue, 22 May 2007 12:04:57 GMT according to webserver + QUrl url = "http://" + QtNetworkSettings::serverName() + "/gif/fluke.gif"; + + QNetworkRequest request(url); + QNetworkReplyPtr reply = manager.head(request); + QSignalSpy spy(reply, SIGNAL(uploadProgress(qint64,qint64))); + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QDateTime header = reply->header(QNetworkRequest::LastModifiedHeader).toDateTime(); + QDateTime realDate = QDateTime::fromString("2007-05-22T12:04:57", Qt::ISODate); + realDate.setTimeSpec(Qt::UTC); + + QCOMPARE(header, realDate); +} + void tst_QNetworkReply::rateControl_data() { QTest::addColumn<int>("rate"); diff --git a/util/qlalr/cppgenerator.cpp b/util/qlalr/cppgenerator.cpp index 39d94cd..91340d2 100644 --- a/util/qlalr/cppgenerator.cpp +++ b/util/qlalr/cppgenerator.cpp @@ -341,8 +341,8 @@ void CppGenerator::operator () () } QTextStream out (&f); - out << "// This file was generated by qlalr - DO NOT EDIT!\n"; + // copyright headers must come first, otherwise the headers tests will fail if (copyright) { out << copyrightHeader() @@ -350,8 +350,16 @@ void CppGenerator::operator () () << endl; } + out << "// This file was generated by qlalr - DO NOT EDIT!\n"; + out << startIncludeGuard(grammar.merged_output) << endl; + if (copyright) { + out << "#if defined(Q_OS_VXWORKS) && defined(ERROR)" << endl + << "# undef ERROR" << endl + << "#endif" << endl << endl; + } + generateDecl (out); generateImpl (out); out << p.decls(); @@ -371,10 +379,10 @@ void CppGenerator::operator () () QFile f (declFileName); f.open (QFile::WriteOnly); QTextStream out (&f); - out << "// This file was generated by qlalr - DO NOT EDIT!\n"; QString prot = declFileName.toUpper ().replace (QLatin1Char ('.'), QLatin1Char ('_')); + // copyright headers must come first, otherwise the headers tests will fail if (copyright) { out << copyrightHeader() @@ -382,11 +390,19 @@ void CppGenerator::operator () () << endl; } + out << "// This file was generated by qlalr - DO NOT EDIT!\n"; + out << "#ifndef " << prot << endl << "#define " << prot << endl << endl; + if (copyright) { + out << "#include <QtCore/qglobal.h>" << endl << endl; + out << "QT_BEGIN_NAMESPACE" << endl << endl; + } generateDecl (out); + if (copyright) + out << "QT_END_NAMESPACE" << endl; out << "#endif // " << prot << endl << endl; } // end decls @@ -395,13 +411,19 @@ void CppGenerator::operator () () QFile f (bitsFileName); f.open (QFile::WriteOnly); QTextStream out (&f); - out << "// This file was generated by qlalr - DO NOT EDIT!\n"; + // copyright headers must come first, otherwise the headers tests will fail if (copyright) out << copyrightHeader(); + out << "// This file was generated by qlalr - DO NOT EDIT!\n"; + out << "#include \"" << declFileName << "\"" << endl << endl; + if (copyright) + out << "QT_BEGIN_NAMESPACE" << endl << endl; generateImpl(out); + if (copyright) + out << "QT_END_NAMESPACE" << endl; } // end bits @@ -410,7 +432,6 @@ void CppGenerator::operator () () QFile f (grammar.decl_file_name); f.open (QFile::WriteOnly); QTextStream out (&f); - out << "// This file was generated by qlalr - DO NOT EDIT!\n"; out << p.decls(); } @@ -419,7 +440,6 @@ void CppGenerator::operator () () QFile f (grammar.impl_file_name); f.open (QFile::WriteOnly); QTextStream out (&f); - out << "// This file was generated by qlalr - DO NOT EDIT!\n"; out << p.impls(); } } @@ -468,9 +488,9 @@ void CppGenerator::generateDecl (QTextStream &out) << " GOTO_CHECK_OFFSET = " << compressed_action.check.size () << endl << " };" << endl << endl - << " static const char *const spell [];" << endl - << " static const int lhs [];" << endl - << " static const int rhs [];" << endl; + << " static const char *const spell [];" << endl + << " static const short lhs [];" << endl + << " static const short rhs [];" << endl; if (debug_info) { @@ -482,24 +502,19 @@ void CppGenerator::generateDecl (QTextStream &out) << "#endif // " << prot << endl << endl; } - out << " static const int goto_default [];" << endl - << " static const int action_default [];" << endl - << " static const int action_index [];" << endl - << " static const int action_info [];" << endl - << " static const int action_check [];" << endl + out << " static const short goto_default [];" << endl + << " static const short action_default [];" << endl + << " static const short action_index [];" << endl + << " static const short action_info [];" << endl + << " static const short action_check [];" << endl << endl << " static inline int nt_action (int state, int nt)" << endl << " {" << endl - << " const int *const goto_index = &action_index [GOTO_INDEX_OFFSET];" << endl - << " const int *const goto_check = &action_check [GOTO_CHECK_OFFSET];" << endl - << endl - << " const int yyn = goto_index [state] + nt;" << endl - << endl - << " if (yyn < 0 || goto_check [yyn] != nt)" << endl + << " const int yyn = action_index [GOTO_INDEX_OFFSET + state] + nt;" << endl + << " if (yyn < 0 || action_check [GOTO_CHECK_OFFSET + yyn] != nt)" << endl << " return goto_default [nt];" << endl << endl - << " const int *const goto_info = &action_info [GOTO_INFO_OFFSET];" << endl - << " return goto_info [yyn];" << endl + << " return action_info [GOTO_INFO_OFFSET + yyn];" << endl << " }" << endl << endl << " static inline int t_action (int state, int token)" << endl @@ -567,7 +582,7 @@ void CppGenerator::generateImpl (QTextStream &out) out << "};" << endl << endl; - out << "const int " << grammar.table_name << "::lhs [] = {"; + out << "const short " << grammar.table_name << "::lhs [] = {"; idx = 0; for (RulePointer rule = grammar.rules.begin (); rule != grammar.rules.end (); ++rule, ++idx) { @@ -581,7 +596,7 @@ void CppGenerator::generateImpl (QTextStream &out) } out << "};" << endl << endl; - out << "const int " << grammar.table_name << ":: rhs[] = {"; + out << "const short " << grammar.table_name << "::rhs [] = {"; idx = 0; for (RulePointer rule = grammar.rules.begin (); rule != grammar.rules.end (); ++rule, ++idx) { @@ -636,7 +651,7 @@ void CppGenerator::generateImpl (QTextStream &out) << "#endif // " << prot << endl << endl; } - out << "const int " << grammar.table_name << "::action_default [] = {"; + out << "const short " << grammar.table_name << "::action_default [] = {"; idx = 0; for (StatePointer state = aut.states.begin (); state != aut.states.end (); ++state, ++idx) { @@ -653,7 +668,7 @@ void CppGenerator::generateImpl (QTextStream &out) } out << "};" << endl << endl; - out << "const int " << grammar.table_name << "::goto_default [] = {"; + out << "const short " << grammar.table_name << "::goto_default [] = {"; for (int i = 0; i < defgoto.size (); ++i) { if (i) @@ -666,7 +681,7 @@ void CppGenerator::generateImpl (QTextStream &out) } out << "};" << endl << endl; - out << "const int " << grammar.table_name << "::action_index [] = {"; + out << "const short " << grammar.table_name << "::action_index [] = {"; for (int i = 0; i < compressed_action.index.size (); ++i) { if (! (i % 10)) @@ -687,7 +702,7 @@ void CppGenerator::generateImpl (QTextStream &out) } out << "};" << endl << endl; - out << "const int " << grammar.table_name << "::action_info [] = {"; + out << "const short " << grammar.table_name << "::action_info [] = {"; for (int i = 0; i < compressed_action.info.size (); ++i) { if (! (i % 10)) @@ -708,7 +723,7 @@ void CppGenerator::generateImpl (QTextStream &out) } out << "};" << endl << endl; - out << "const int " << grammar.table_name << "::action_check [] = {"; + out << "const short " << grammar.table_name << "::action_check [] = {"; for (int i = 0; i < compressed_action.check.size (); ++i) { if (! (i % 10)) diff --git a/util/qlalr/main.cpp b/util/qlalr/main.cpp index 7041e4a..d864796 100644 --- a/util/qlalr/main.cpp +++ b/util/qlalr/main.cpp @@ -64,7 +64,7 @@ static void help_me () << " --no-debug\t\tno debug information" << endl << " --no-lines\t\tno #line directives" << endl << " --dot\t\t\tgenerate a graph" << endl - << " --troll\t\tadd the Trolltech copyright header" << endl + << " --qt\t\tadd the Qt copyright header and Qt-specific types and macros" << endl << endl; exit (0); } @@ -100,7 +100,7 @@ int main (int argc, char *argv[]) else if (arg == QLatin1String ("--no-debug")) debug_info = false; - else if (arg == QLatin1String ("--troll")) + else if (arg == QLatin1String ("--qt")) troll_copyright = true; else if (file_name.isEmpty ()) |