forked from qt-creator/qt-creator
Workaround 5.15 deprecations in QTextStreams
Change-Id: Ifc2b7fd353e7c12346e9716115e830679cea7666 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -33,7 +33,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace GLSL;
|
using namespace GLSL;
|
||||||
using namespace Qt;
|
|
||||||
|
|
||||||
ASTDump::ASTDump(QTextStream &out)
|
ASTDump::ASTDump(QTextStream &out)
|
||||||
: out(out), _depth(0)
|
: out(out), _depth(0)
|
||||||
@@ -53,7 +52,7 @@ bool ASTDump::preVisit(AST *ast)
|
|||||||
char *cppId = abi::__cxa_demangle(id, nullptr, nullptr, nullptr);
|
char *cppId = abi::__cxa_demangle(id, nullptr, nullptr, nullptr);
|
||||||
id = cppId;
|
id = cppId;
|
||||||
#endif
|
#endif
|
||||||
out << QByteArray(_depth, ' ') << id << endl;
|
out << QByteArray(_depth, ' ') << id << '\n';
|
||||||
#ifdef Q_CC_GNU
|
#ifdef Q_CC_GNU
|
||||||
free(cppId);
|
free(cppId);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -42,13 +42,18 @@
|
|||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
using namespace Qt;
|
|
||||||
|
|
||||||
// Read and write rectangle in X11 resource syntax "12x12+4+3"
|
// Read and write rectangle in X11 resource syntax "12x12+4+3"
|
||||||
static QString rectangleToString(const QRect &r)
|
static QString rectangleToString(const QRect &r)
|
||||||
{
|
{
|
||||||
QString result;
|
QString result;
|
||||||
QTextStream(&result) << r.width() << 'x' << r.height() << forcesign << r.x() << r.y();
|
QTextStream str(&result);
|
||||||
|
str << r.width() << 'x' << r.height() << r.x() << r.y();
|
||||||
|
if (r.x() >= 0)
|
||||||
|
str << '+';
|
||||||
|
str << r.x();
|
||||||
|
if (r.y() >= 0)
|
||||||
|
str << '+';
|
||||||
|
str << r.y();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,8 +84,8 @@ QDebug operator<<(QDebug d, const CompletionEntry &e)
|
|||||||
QDebugStateSaver saver(d);
|
QDebugStateSaver saver(d);
|
||||||
d.noquote();
|
d.noquote();
|
||||||
d.nospace();
|
d.nospace();
|
||||||
d << "CompletionEntry(\"" << e.text << "\", flags=" << hex
|
d << "CompletionEntry(\"" << e.text << "\", flags="
|
||||||
<< showbase << int(e.findFlags) << dec << noshowbase << ')';
|
<< "0x" << QString::number(e.findFlags, 16) << ')';
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,8 +39,6 @@
|
|||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
using namespace Qt;
|
|
||||||
|
|
||||||
namespace Gerrit {
|
namespace Gerrit {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -152,10 +150,10 @@ bool AuthenticationDialog::setupCredentials()
|
|||||||
replaceEntry(line, "login", user);
|
replaceEntry(line, "login", user);
|
||||||
replaceEntry(line, "password", password);
|
replaceEntry(line, "password", password);
|
||||||
}
|
}
|
||||||
out << line << endl;
|
out << line << '\n';
|
||||||
}
|
}
|
||||||
if (!found)
|
if (!found)
|
||||||
out << "machine " << m_server->host << " login " << user << " password " << password << endl;
|
out << "machine " << m_server->host << " login " << user << " password " << password << '\n';
|
||||||
Utils::FileSaver saver(m_netrcFileName, QFile::WriteOnly | QFile::Truncate | QFile::Text);
|
Utils::FileSaver saver(m_netrcFileName, QFile::WriteOnly | QFile::Truncate | QFile::Text);
|
||||||
saver.write(netrcContents.toUtf8());
|
saver.write(netrcContents.toUtf8());
|
||||||
return saver.finalize();
|
return saver.finalize();
|
||||||
|
|||||||
@@ -55,8 +55,6 @@ enum { debug = 0 };
|
|||||||
|
|
||||||
using namespace VcsBase;
|
using namespace VcsBase;
|
||||||
|
|
||||||
using namespace Qt;
|
|
||||||
|
|
||||||
namespace Gerrit {
|
namespace Gerrit {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -124,7 +122,10 @@ QString GerritPatchSet::approvalsToHtml() const
|
|||||||
str << a.reviewer.fullName;
|
str << a.reviewer.fullName;
|
||||||
if (!a.reviewer.email.isEmpty())
|
if (!a.reviewer.email.isEmpty())
|
||||||
str << " <a href=\"mailto:" << a.reviewer.email << "\">" << a.reviewer.email << "</a>";
|
str << " <a href=\"mailto:" << a.reviewer.email << "\">" << a.reviewer.email << "</a>";
|
||||||
str << ": " << forcesign << a.approval << noforcesign;
|
str << ": ";
|
||||||
|
if (a.approval >= 0)
|
||||||
|
str << '+';
|
||||||
|
str << a.approval;
|
||||||
}
|
}
|
||||||
str << "</tr>\n";
|
str << "</tr>\n";
|
||||||
return result;
|
return result;
|
||||||
@@ -166,7 +167,10 @@ QString GerritPatchSet::approvalsColumn() const
|
|||||||
for (TypeReviewMapConstIterator it = reviews.constBegin(); it != cend; ++it) {
|
for (TypeReviewMapConstIterator it = reviews.constBegin(); it != cend; ++it) {
|
||||||
if (!result.isEmpty())
|
if (!result.isEmpty())
|
||||||
str << ' ';
|
str << ' ';
|
||||||
str << it.key() << ": " << forcesign << it.value() << noforcesign;
|
str << it.key() << ": ";
|
||||||
|
if (it.value() >= 0)
|
||||||
|
str << '+';
|
||||||
|
str << it.value();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,8 +101,6 @@ using namespace QmlJS::AST;
|
|||||||
using namespace QmlJSTools;
|
using namespace QmlJSTools;
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
|
|
||||||
using namespace Qt;
|
|
||||||
|
|
||||||
namespace QmlJSEditor {
|
namespace QmlJSEditor {
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -559,24 +557,24 @@ public:
|
|||||||
*m_stream << m_indent;
|
*m_stream << m_indent;
|
||||||
if (!propertyInfo.isWriteable())
|
if (!propertyInfo.isWriteable())
|
||||||
*m_stream << "readonly ";
|
*m_stream << "readonly ";
|
||||||
*m_stream << "property " << type << " " << name << endl;
|
*m_stream << "property " << type << " " << name << '\n';
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool processSignal(const QString &name, const Value *value) override
|
bool processSignal(const QString &name, const Value *value) override
|
||||||
{
|
{
|
||||||
*m_stream << m_indent << "signal " << name << stringifyFunctionParameters(value) << endl;
|
*m_stream << m_indent << "signal " << name << stringifyFunctionParameters(value) << '\n';
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool processSlot(const QString &name, const Value *value) override
|
bool processSlot(const QString &name, const Value *value) override
|
||||||
{
|
{
|
||||||
*m_stream << m_indent << "function " << name << stringifyFunctionParameters(value) << endl;
|
*m_stream << m_indent << "function " << name << stringifyFunctionParameters(value) << '\n';
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool processGeneratedSlot(const QString &name, const Value *value) override
|
bool processGeneratedSlot(const QString &name, const Value *value) override
|
||||||
{
|
{
|
||||||
*m_stream << m_indent << "/*generated*/ function " << name
|
*m_stream << m_indent << "/*generated*/ function " << name
|
||||||
<< stringifyFunctionParameters(value) << endl;
|
<< stringifyFunctionParameters(value) << '\n';
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -633,33 +631,33 @@ static QString inspectCppComponent(const CppComponentValue *cppValue)
|
|||||||
if (superClassName.isEmpty())
|
if (superClassName.isEmpty())
|
||||||
superClassName = cppValue->metaObject()->className();
|
superClassName = cppValue->metaObject()->className();
|
||||||
|
|
||||||
bufWriter << "import QtQuick " << cppValue->importVersion().toString() << endl
|
bufWriter << "import QtQuick " << cppValue->importVersion().toString() << '\n'
|
||||||
<< "// " << cppValue->metaObject()->className()
|
<< "// " << cppValue->metaObject()->className()
|
||||||
<< " imported as " << cppValue->moduleName() << " "
|
<< " imported as " << cppValue->moduleName() << " "
|
||||||
<< cppValue->importVersion().toString() << endl
|
<< cppValue->importVersion().toString() << '\n'
|
||||||
<< endl
|
<< '\n'
|
||||||
<< superClassName << " {" << endl;
|
<< superClassName << " {" << '\n';
|
||||||
|
|
||||||
CodeModelInspector insp(cppValue, &bufWriter);
|
CodeModelInspector insp(cppValue, &bufWriter);
|
||||||
cppValue->processMembers(&insp);
|
cppValue->processMembers(&insp);
|
||||||
|
|
||||||
bufWriter << endl;
|
bufWriter << '\n';
|
||||||
const int enumeratorCount = cppValue->metaObject()->enumeratorCount();
|
const int enumeratorCount = cppValue->metaObject()->enumeratorCount();
|
||||||
for (int index = cppValue->metaObject()->enumeratorOffset(); index < enumeratorCount; ++index) {
|
for (int index = cppValue->metaObject()->enumeratorOffset(); index < enumeratorCount; ++index) {
|
||||||
LanguageUtils::FakeMetaEnum enumerator = cppValue->metaObject()->enumerator(index);
|
LanguageUtils::FakeMetaEnum enumerator = cppValue->metaObject()->enumerator(index);
|
||||||
bufWriter << " enum " << enumerator.name() << " {" << endl;
|
bufWriter << " enum " << enumerator.name() << " {" << '\n';
|
||||||
const QStringList keys = enumerator.keys();
|
const QStringList keys = enumerator.keys();
|
||||||
const int keysCount = keys.size();
|
const int keysCount = keys.size();
|
||||||
for (int i = 0; i < keysCount; ++i) {
|
for (int i = 0; i < keysCount; ++i) {
|
||||||
bufWriter << " " << keys.at(i);
|
bufWriter << " " << keys.at(i);
|
||||||
if (i != keysCount - 1)
|
if (i != keysCount - 1)
|
||||||
bufWriter << ',';
|
bufWriter << ',';
|
||||||
bufWriter << endl;
|
bufWriter << '\n';
|
||||||
}
|
}
|
||||||
bufWriter << " }" << endl;
|
bufWriter << " }" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
bufWriter << "}" << endl;
|
bufWriter << "}" << '\n';
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,8 +40,6 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
using namespace Qt;
|
|
||||||
|
|
||||||
CompilerOutputProcessor::CompilerOutputProcessor(CompilerType compilerType, QIODevice &source)
|
CompilerOutputProcessor::CompilerOutputProcessor(CompilerType compilerType, QIODevice &source)
|
||||||
: m_compilerType(compilerType)
|
: m_compilerType(compilerType)
|
||||||
, m_source(source)
|
, m_source(source)
|
||||||
@@ -88,5 +86,5 @@ void CompilerOutputProcessor::handleTask(const ProjectExplorer::Task &task)
|
|||||||
*m_ostream << ':' << task.line;
|
*m_ostream << ':' << task.line;
|
||||||
*m_ostream << ": ";
|
*m_ostream << ": ";
|
||||||
}
|
}
|
||||||
*m_ostream << task.description << endl;
|
*m_ostream << task.description << '\n';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,24 +36,22 @@
|
|||||||
|
|
||||||
using namespace Valgrind::Fake;
|
using namespace Valgrind::Fake;
|
||||||
|
|
||||||
using namespace Qt;
|
|
||||||
|
|
||||||
QTextStream qerr(stderr);
|
QTextStream qerr(stderr);
|
||||||
QTextStream qout(stdout);
|
QTextStream qout(stdout);
|
||||||
|
|
||||||
void usage(QTextStream& stream)
|
void usage(QTextStream& stream)
|
||||||
{
|
{
|
||||||
stream << "valgrind-fake OPTIONS" << endl;
|
stream << "valgrind-fake OPTIONS" << '\n';
|
||||||
stream << endl;
|
stream << '\n';
|
||||||
stream << " REQUIRED OPTIONS:" << endl;
|
stream << " REQUIRED OPTIONS:" << '\n';
|
||||||
stream << " --xml-socket=ipaddr:port \tXML output to socket ipaddr:port" << endl;
|
stream << " --xml-socket=ipaddr:port \tXML output to socket ipaddr:port" << '\n';
|
||||||
stream << " -i, --xml-input FILE \tpath to a XML file as generated by valgrind" << endl;
|
stream << " -i, --xml-input FILE \tpath to a XML file as generated by valgrind" << '\n';
|
||||||
stream << endl;
|
stream << '\n';
|
||||||
stream << " OPTIONAL OPTIONS:" << endl;
|
stream << " OPTIONAL OPTIONS:" << '\n';
|
||||||
stream << " -c, --crash \tcrash randomly" << endl;
|
stream << " -c, --crash \tcrash randomly" << '\n';
|
||||||
stream << " -g, --garbage \toutput invalid XML somewhere" << endl;
|
stream << " -g, --garbage \toutput invalid XML somewhere" << '\n';
|
||||||
stream << " -w, --wait SECONDS \twait randomly for the given amount of seconds" << endl;
|
stream << " -w, --wait SECONDS \twait randomly for the given amount of seconds" << '\n';
|
||||||
stream << " -h, --help \tprint help" << endl;
|
stream << " -h, --help \tprint help" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
@@ -89,7 +87,7 @@ int main(int argc, char** argv)
|
|||||||
bool ok;
|
bool ok;
|
||||||
arg_wait = args.at(i+1).toUInt(&ok);
|
arg_wait = args.at(i+1).toUInt(&ok);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
qerr << "ERROR: invalid wait time given" << args.at(i+1) << endl;
|
qerr << "ERROR: invalid wait time given" << args.at(i+1) << '\n';
|
||||||
usage(qerr);
|
usage(qerr);
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
@@ -100,31 +98,31 @@ int main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (arg_xmlFile.isEmpty()) {
|
if (arg_xmlFile.isEmpty()) {
|
||||||
qerr << "ERROR: no XML input file given" << endl;
|
qerr << "ERROR: no XML input file given" << '\n';
|
||||||
usage(qerr);
|
usage(qerr);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (arg_server.isEmpty()) {
|
if (arg_server.isEmpty()) {
|
||||||
qerr << "ERROR: no server given" << endl;
|
qerr << "ERROR: no server given" << '\n';
|
||||||
usage(qerr);
|
usage(qerr);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
if (arg_port.isEmpty()) {
|
if (arg_port.isEmpty()) {
|
||||||
qerr << "ERROR: no port given" << endl;
|
qerr << "ERROR: no port given" << '\n';
|
||||||
usage(qerr);
|
usage(qerr);
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
QFile xmlFile(arg_xmlFile);
|
QFile xmlFile(arg_xmlFile);
|
||||||
if (!xmlFile.exists() || !xmlFile.open(QIODevice::ReadOnly)) {
|
if (!xmlFile.exists() || !xmlFile.open(QIODevice::ReadOnly)) {
|
||||||
qerr << "ERROR: invalid XML file" << endl;
|
qerr << "ERROR: invalid XML file" << '\n';
|
||||||
usage(qerr);
|
usage(qerr);
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
quint16 port = arg_port.toUInt(&ok);
|
quint16 port = arg_port.toUInt(&ok);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
qerr << "ERROR: invalid port" << endl;
|
qerr << "ERROR: invalid port" << '\n';
|
||||||
usage(qerr);
|
usage(qerr);
|
||||||
return 30;
|
return 30;
|
||||||
}
|
}
|
||||||
@@ -132,12 +130,12 @@ int main(int argc, char** argv)
|
|||||||
QTcpSocket socket;
|
QTcpSocket socket;
|
||||||
socket.connectToHost(arg_server, port, QIODevice::WriteOnly);
|
socket.connectToHost(arg_server, port, QIODevice::WriteOnly);
|
||||||
if (!socket.isOpen()) {
|
if (!socket.isOpen()) {
|
||||||
qerr << "ERROR: could not open socket to server:" << arg_server << ":" << port << endl;
|
qerr << "ERROR: could not open socket to server:" << arg_server << ":" << port << '\n';
|
||||||
usage(qerr);
|
usage(qerr);
|
||||||
return 20;
|
return 20;
|
||||||
}
|
}
|
||||||
if (!socket.waitForConnected()) {
|
if (!socket.waitForConnected()) {
|
||||||
qerr << "ERROR: could not connect to socket: " << socket.errorString() << endl;
|
qerr << "ERROR: could not connect to socket: " << socket.errorString() << '\n';
|
||||||
return 21;
|
return 21;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ void doSleep(int msec)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Qt;
|
|
||||||
using namespace Valgrind::Fake;
|
using namespace Valgrind::Fake;
|
||||||
|
|
||||||
OutputGenerator::OutputGenerator(QAbstractSocket *output, QIODevice *input) :
|
OutputGenerator::OutputGenerator(QAbstractSocket *output, QIODevice *input) :
|
||||||
@@ -116,7 +115,7 @@ void OutputGenerator::produceRuntimeError()
|
|||||||
blockingWrite(m_output, "<</GARBAGE = '\"''asdfaqre");
|
blockingWrite(m_output, "<</GARBAGE = '\"''asdfaqre");
|
||||||
m_output->flush();
|
m_output->flush();
|
||||||
} else if (m_wait) {
|
} else if (m_wait) {
|
||||||
qDebug() << "waiting in fake valgrind for " << m_wait << " seconds..." << endl;
|
qDebug() << "waiting in fake valgrind for " << m_wait << " seconds..." << '\n';
|
||||||
doSleep(1000 * m_wait);
|
doSleep(1000 * m_wait);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user