QMimeBinaryProvider: move CacheFile up in the file
Amends 329722a322a80d5ea8d6f9aa993c2fc4995b08a4 ("QMimeBinaryProvider: manage m_cacheFile with a std::unique_ptr"), which added the std::unique_ptr<CacheFile>. This is required because in C++23 std::unique_ptr's destructor became constexpr and is therefore instantiated more eagerly. The type must be fully defined (not forward-declared) when the std::unique_ptr member is initialised in the QMimeBinaryProvider constructors. Fixes: QTBUG-121204 Change-Id: I76ffba14ece04f24b43efffd17ab9a861aff89b8 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> (cherry picked from commit c8db469fd584cfd2bee34b572601b19bfb2cd921) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 7d12cf673a221cec92f080e3364cc939ab3dd34a)
This commit is contained in:
parent
6494137c6a
commit
8da0980aef
@ -51,6 +51,33 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
struct QMimeBinaryProvider::CacheFile
|
||||
{
|
||||
CacheFile(const QString &fileName);
|
||||
~CacheFile();
|
||||
|
||||
bool isValid() const { return m_valid; }
|
||||
inline quint16 getUint16(int offset) const
|
||||
{
|
||||
return qFromBigEndian(*reinterpret_cast<quint16 *>(data + offset));
|
||||
}
|
||||
inline quint32 getUint32(int offset) const
|
||||
{
|
||||
return qFromBigEndian(*reinterpret_cast<quint32 *>(data + offset));
|
||||
}
|
||||
inline const char *getCharStar(int offset) const
|
||||
{
|
||||
return reinterpret_cast<const char *>(data + offset);
|
||||
}
|
||||
bool load();
|
||||
bool reload();
|
||||
|
||||
QFile file;
|
||||
uchar *data;
|
||||
QDateTime m_mtime;
|
||||
bool m_valid;
|
||||
};
|
||||
|
||||
static inline void appendIfNew(QStringList &list, const QString &str)
|
||||
{
|
||||
if (!list.contains(str))
|
||||
@ -88,33 +115,6 @@ QMimeBinaryProvider::QMimeBinaryProvider(QMimeDatabasePrivate *db, const QString
|
||||
ensureLoaded();
|
||||
}
|
||||
|
||||
struct QMimeBinaryProvider::CacheFile
|
||||
{
|
||||
CacheFile(const QString &fileName);
|
||||
~CacheFile();
|
||||
|
||||
bool isValid() const { return m_valid; }
|
||||
inline quint16 getUint16(int offset) const
|
||||
{
|
||||
return qFromBigEndian(*reinterpret_cast<quint16 *>(data + offset));
|
||||
}
|
||||
inline quint32 getUint32(int offset) const
|
||||
{
|
||||
return qFromBigEndian(*reinterpret_cast<quint32 *>(data + offset));
|
||||
}
|
||||
inline const char *getCharStar(int offset) const
|
||||
{
|
||||
return reinterpret_cast<const char *>(data + offset);
|
||||
}
|
||||
bool load();
|
||||
bool reload();
|
||||
|
||||
QFile file;
|
||||
uchar *data;
|
||||
QDateTime m_mtime;
|
||||
bool m_valid;
|
||||
};
|
||||
|
||||
QMimeBinaryProvider::CacheFile::CacheFile(const QString &fileName)
|
||||
: file(fileName), m_valid(false)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user