From b57a9a3cd9c95ab6549ea672715245210720c8da Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 27 Feb 2024 20:08:23 -0800 Subject: Bootstrap: remove QTemporaryFile Done by harmonizing the use on the QT_CONFIG(temporaryfile) macro and fixing one test that was missing. We can't remove the older macro because it is marked PBULIC) but we don't need to use it ourselves. Change-Id: I01ec3c774d9943adb903fffd17b7eb4dd1a4e63f Reviewed-by: Ahmad Samir --- src/corelib/global/qconfig-bootstrapped.h | 2 +- src/corelib/io/qfile.cpp | 6 +++--- src/corelib/io/qsavefile.cpp | 4 ++-- src/corelib/io/qsavefile.h | 4 ++-- src/corelib/io/qsavefile_p.h | 4 ++-- src/corelib/io/qsettings.cpp | 4 ++-- src/corelib/io/qtemporarydir.cpp | 4 ++-- src/corelib/io/qtemporarydir.h | 4 ++-- src/corelib/io/qtemporaryfile.cpp | 4 ++-- src/corelib/io/qtemporaryfile.h | 4 ++-- src/corelib/io/qtemporaryfile_p.h | 4 ++-- src/tools/bootstrap/CMakeLists.txt | 1 - 12 files changed, 22 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h index 57f4b9eb6a..4d80f23786 100644 --- a/src/corelib/global/qconfig-bootstrapped.h +++ b/src/corelib/global/qconfig-bootstrapped.h @@ -84,7 +84,7 @@ #define QT_FEATURE_slog2 -1 #define QT_FEATURE_syslog -1 #define QT_NO_SYSTEMLOCALE -#define QT_FEATURE_temporaryfile 1 +#define QT_FEATURE_temporaryfile -1 #define QT_FEATURE_textdate 1 #undef QT_FEATURE_thread #define QT_FEATURE_thread -1 diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index 7b3c0a9055..6d1a38160a 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -584,7 +584,7 @@ QFile::rename(const QString &newName) return false; } -#ifdef Q_OS_LINUX +#if defined(Q_OS_LINUX) && QT_CONFIG(temporaryfile) // rename() on Linux simply does nothing when renaming "foo" to "Foo" on a case-insensitive // FS, such as FAT32. Move the file away and rename in 2 steps to work around. QTemporaryFileName tfn(d->fileName); @@ -789,7 +789,7 @@ QFile::copy(const QString &newName) d->setError(QFile::CopyError, tr("Cannot open %1 for input").arg(d->fileName)); } else { const auto fileTemplate = "%1/qt_temp.XXXXXX"_L1; -#ifdef QT_NO_TEMPORARYFILE +#if !QT_CONFIG(temporaryfile) QFile out(fileTemplate.arg(QFileInfo(newName).path())); if (!out.open(QIODevice::ReadWrite)) error = true; @@ -841,7 +841,7 @@ QFile::copy(const QString &newName) .arg(newName, out.errorString())); } } -#ifdef QT_NO_TEMPORARYFILE +#if !QT_CONFIG(temporaryfile) if (error) out.remove(); #else diff --git a/src/corelib/io/qsavefile.cpp b/src/corelib/io/qsavefile.cpp index aa7fb21390..3a0fccbe1d 100644 --- a/src/corelib/io/qsavefile.cpp +++ b/src/corelib/io/qsavefile.cpp @@ -3,7 +3,7 @@ #include "qsavefile.h" -#ifndef QT_NO_TEMPORARYFILE +#if QT_CONFIG(temporaryfile) #include "qplatformdefs.h" #include "private/qsavefile_p.h" @@ -412,4 +412,4 @@ QT_END_NAMESPACE #include "moc_qsavefile.cpp" #endif -#endif // QT_NO_TEMPORARYFILE +#endif // QT_CONFIG(temporaryfile) diff --git a/src/corelib/io/qsavefile.h b/src/corelib/io/qsavefile.h index 9ea4887c3c..db8a25507c 100644 --- a/src/corelib/io/qsavefile.h +++ b/src/corelib/io/qsavefile.h @@ -6,7 +6,7 @@ #include -#ifndef QT_NO_TEMPORARYFILE +#if QT_CONFIG(temporaryfile) #include #include @@ -62,6 +62,6 @@ private: QT_END_NAMESPACE -#endif // QT_NO_TEMPORARYFILE +#endif // QT_CONFIG(temporaryfile) #endif // QSAVEFILE_H diff --git a/src/corelib/io/qsavefile_p.h b/src/corelib/io/qsavefile_p.h index 50de9e4e68..4d0f40fbb0 100644 --- a/src/corelib/io/qsavefile_p.h +++ b/src/corelib/io/qsavefile_p.h @@ -17,7 +17,7 @@ #include -#ifndef QT_NO_TEMPORARYFILE +#if QT_CONFIG(temporaryfile) #include "private/qfiledevice_p.h" @@ -42,6 +42,6 @@ protected: QT_END_NAMESPACE -#endif // QT_NO_TEMPORARYFILE +#endif // QT_CONFIG(temporaryfile) #endif // QSAVEFILE_P_H diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 7c439ae6be..6934ca4404 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -129,12 +129,12 @@ bool QConfFile::isWritable() const { QFileInfo fileInfo(name); -#ifndef QT_NO_TEMPORARYFILE +#if QT_CONFIG(temporaryfile) if (fileInfo.exists()) { #endif QFile file(name); return file.open(QFile::ReadWrite); -#ifndef QT_NO_TEMPORARYFILE +#if QT_CONFIG(temporaryfile) } else { // Create the directories to the file. QDir dir(fileInfo.absolutePath()); diff --git a/src/corelib/io/qtemporarydir.cpp b/src/corelib/io/qtemporarydir.cpp index 719e86208b..8187524067 100644 --- a/src/corelib/io/qtemporarydir.cpp +++ b/src/corelib/io/qtemporarydir.cpp @@ -4,7 +4,7 @@ #include "qtemporarydir.h" -#ifndef QT_NO_TEMPORARYFILE +#if QT_CONFIG(temporaryfile) #include "qdebug.h" #include "qplatformdefs.h" @@ -324,4 +324,4 @@ bool QTemporaryDir::remove() QT_END_NAMESPACE -#endif // QT_NO_TEMPORARYFILE +#endif // QT_CONFIG(temporaryfile) diff --git a/src/corelib/io/qtemporarydir.h b/src/corelib/io/qtemporarydir.h index 1fdaa83fb0..8737bf9e26 100644 --- a/src/corelib/io/qtemporarydir.h +++ b/src/corelib/io/qtemporarydir.h @@ -11,7 +11,7 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_TEMPORARYFILE +#if QT_CONFIG(temporaryfile) class QTemporaryDirPrivate; @@ -52,7 +52,7 @@ inline void swap(QTemporaryDir &lhs, QTemporaryDir &rhs) noexcept lhs.swap(rhs); } -#endif // QT_NO_TEMPORARYFILE +#endif // QT_CONFIG(temporaryfile) QT_END_NAMESPACE diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index ff6a514fc9..a99ad22223 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -156,7 +156,7 @@ QFileSystemEntry::NativePath QTemporaryFileName::generateNext() return path; } -#ifndef QT_NO_TEMPORARYFILE +#if QT_CONFIG(temporaryfile) /*! \internal @@ -969,7 +969,7 @@ bool QTemporaryFile::open(OpenMode flags) return false; } -#endif // QT_NO_TEMPORARYFILE +#endif // QT_CONFIG(temporaryfile) QT_END_NAMESPACE diff --git a/src/corelib/io/qtemporaryfile.h b/src/corelib/io/qtemporaryfile.h index 721ebc5b22..9d07e1633b 100644 --- a/src/corelib/io/qtemporaryfile.h +++ b/src/corelib/io/qtemporaryfile.h @@ -14,7 +14,7 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_TEMPORARYFILE +#if QT_CONFIG(temporaryfile) class QTemporaryFilePrivate; class QLockFilePrivate; @@ -94,7 +94,7 @@ private: Q_DISABLE_COPY(QTemporaryFile) }; -#endif // QT_NO_TEMPORARYFILE +#endif // QT_CONFIG(temporaryfile) QT_END_NAMESPACE diff --git a/src/corelib/io/qtemporaryfile_p.h b/src/corelib/io/qtemporaryfile_p.h index 3a2ed73cf9..8815069daa 100644 --- a/src/corelib/io/qtemporaryfile_p.h +++ b/src/corelib/io/qtemporaryfile_p.h @@ -45,7 +45,7 @@ struct QTemporaryFileName QFileSystemEntry::NativePath generateNext(); }; -#ifndef QT_NO_TEMPORARYFILE +#if QT_CONFIG(temporaryfile) class QTemporaryFilePrivate : public QFilePrivate { @@ -116,7 +116,7 @@ public: bool unnamedFile = false; }; -#endif // QT_NO_TEMPORARYFILE +#endif // QT_CONFIG(temporaryfile) QT_END_NAMESPACE diff --git a/src/tools/bootstrap/CMakeLists.txt b/src/tools/bootstrap/CMakeLists.txt index 3f4d993fbf..feb27ddf2a 100644 --- a/src/tools/bootstrap/CMakeLists.txt +++ b/src/tools/bootstrap/CMakeLists.txt @@ -39,7 +39,6 @@ qt_internal_extend_target(Bootstrap ../../corelib/io/qresource.cpp ../../corelib/io/qsavefile.cpp ../../corelib/io/qstandardpaths.cpp - ../../corelib/io/qtemporaryfile.cpp ../../corelib/kernel/qcoreapplication.cpp ../../corelib/kernel/qiterable.cpp ../../corelib/kernel/qmetacontainer.cpp -- cgit v1.2.3