From 710414d4a209163e9d583aeb9276ead66c01d8d6 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 23 Nov 2016 12:23:04 +0100 Subject: [PATCH] Make sure we can compile QtCore without QT_CONFIG(translation) Change-Id: I755834b77e50ff6f44bda561f007ec3306f3c1f9 Reviewed-by: Thiago Macieira --- src/corelib/io/qfsfileengine_unix.cpp | 2 +- src/corelib/io/qsavefile.h | 3 +++ .../kernel/qsystemsemaphore_systemv.cpp | 26 ++++++++++++++++--- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index bf2f47d399..b2e3df79b8 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -144,7 +144,7 @@ static inline bool setCloseOnExec(int fd) static inline QString msgOpenDirectory() { const char message[] = QT_TRANSLATE_NOOP("QIODevice", "file to open is a directory"); -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(translation) return QIODevice::tr(message); #else return QLatin1String(message); diff --git a/src/corelib/io/qsavefile.h b/src/corelib/io/qsavefile.h index 10857c27d1..0a6af91261 100644 --- a/src/corelib/io/qsavefile.h +++ b/src/corelib/io/qsavefile.h @@ -84,6 +84,9 @@ protected: private: void close() Q_DECL_OVERRIDE; +#if !QT_CONFIG(translation) + static QString tr(const char *string) { return QString::fromLatin1(string); } +#endif private: Q_DISABLE_COPY(QSaveFile) diff --git a/src/corelib/kernel/qsystemsemaphore_systemv.cpp b/src/corelib/kernel/qsystemsemaphore_systemv.cpp index 1967899a58..83da09da44 100644 --- a/src/corelib/kernel/qsystemsemaphore_systemv.cpp +++ b/src/corelib/kernel/qsystemsemaphore_systemv.cpp @@ -72,7 +72,13 @@ QT_BEGIN_NAMESPACE key_t QSystemSemaphorePrivate::handle(QSystemSemaphore::AccessMode mode) { if (key.isEmpty()){ - errorString = QCoreApplication::tr("%1: key is empty", "QSystemSemaphore").arg(QLatin1String("QSystemSemaphore::handle:")); + errorString = +#if QT_CONFIG(translation) + QCoreApplication::tr("%1: key is empty", "QSystemSemaphore") +#else + QString::fromLatin1("%1: key is empty") +#endif + .arg(QLatin1String("QSystemSemaphore::handle:")); error = QSystemSemaphore::KeyError; return -1; } @@ -84,16 +90,30 @@ key_t QSystemSemaphorePrivate::handle(QSystemSemaphore::AccessMode mode) // Create the file needed for ftok int built = QSharedMemoryPrivate::createUnixKeyFile(fileName); if (-1 == built) { - errorString = QCoreApplication::tr("%1: unable to make key", "QSystemSemaphore").arg(QLatin1String("QSystemSemaphore::handle:")); + errorString = +#if QT_CONFIG(translation) + QCoreApplication::tr("%1: unable to make key", "QSystemSemaphore") +#else + QString::fromLatin1("%1: unable to make key") +#endif + .arg(QLatin1String("QSystemSemaphore::handle:")); error = QSystemSemaphore::KeyError; return -1; } createdFile = (1 == built); +#if !defined(QT_NO_SHAREDMEMORY) && !defined(QT_POSIX_IPC) && !defined(Q_OS_ANDROID) // Get the unix key for the created file unix_key = qt_safe_ftok(QFile::encodeName(fileName), 'Q'); +#endif if (-1 == unix_key) { - errorString = QCoreApplication::tr("%1: ftok failed", "QSystemSemaphore").arg(QLatin1String("QSystemSemaphore::handle:")); + errorString = +#if QT_CONFIG(translation) + QCoreApplication::tr("%1: ftok failed", "QSystemSemaphore") +#else + QString::fromLatin1("%1: ftok failed") +#endif + .arg(QLatin1String("QSystemSemaphore::handle:")); error = QSystemSemaphore::KeyError; return -1; }