summaryrefslogtreecommitdiffstats
path: root/tools/porting
diff options
context:
space:
mode:
Diffstat (limited to 'tools/porting')
-rw-r--r--tools/porting/src/filewriter.cpp14
-rw-r--r--tools/porting/src/logger.cpp6
2 files changed, 14 insertions, 6 deletions
diff --git a/tools/porting/src/filewriter.cpp b/tools/porting/src/filewriter.cpp
index ee8debb..99bd6e7 100644
--- a/tools/porting/src/filewriter.cpp
+++ b/tools/porting/src/filewriter.cpp
@@ -44,6 +44,7 @@
#include <QFileInfo>
#include <QDir>
#include <ctype.h>
+#include <errno.h>
QT_BEGIN_NAMESPACE
@@ -106,11 +107,18 @@ FileWriter::WriteResult FileWriter::writeFile(QString filePath, QByteArray conte
char answer = 0;
while (answer != 'y' && answer != 'n' && answer != 'a') {
#if defined(Q_OS_WIN) && defined(_MSC_VER) && _MSC_VER >= 1400
- scanf_s("%c", &answer);
+ int result = scanf_s("%c", &answer);
#else
- scanf("%c", &answer);
+ int result = scanf("%c", &answer);
#endif
- answer = tolower(answer);
+ if (1 == result)
+ answer = tolower(answer);
+ else if (EOF == result) {
+ if (EINTR == errno || EILSEQ == errno)
+ continue;
+
+ answer = 'n';
+ }
}
if(answer == 'n')
diff --git a/tools/porting/src/logger.cpp b/tools/porting/src/logger.cpp
index 09e49d2..a32e96a 100644
--- a/tools/porting/src/logger.cpp
+++ b/tools/porting/src/logger.cpp
@@ -60,8 +60,8 @@ SourcePointLogEntry::SourcePointLogEntry(QString type, QString location, QString
QString SourcePointLogEntry::description() const
{
return QLatin1String("In file ") + file +
- QLatin1String(" at line ") + QString(QLatin1String("%1")).arg(line + 1) + //line count is zero based, adjust here.
- QLatin1String(" column ") + QString(QLatin1String("%1")).arg(column) +
+ QLatin1String(" at line ") + QString::number(line + 1) + //line count is zero based, adjust here.
+ QLatin1String(" column ") + QString::number(column) +
QLatin1String(": ") + text ;
}
@@ -127,7 +127,7 @@ QStringList Logger::fullReport()
commitSection();
QStringList report;
report << QLatin1String("Log for qt3to4 on ") + QDateTime::currentDateTime().toString() +
- QLatin1String(". Number of log entries: ") + QString(QLatin1String("%1")).arg(logEntries.size());
+ QLatin1String(". Number of log entries: ") + QString::number(logEntries.size());
foreach(LogEntry *logEntry, logEntries) {
report << logEntry->description();
}