QMimeBinaryProvider: move CacheFile up in the file
Amends 329722a322 ("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
Pick-to: 6.6 6.7
Change-Id: I76ffba14ece04f24b43efffd17ab9a861aff89b8
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
bb10
parent
987abb9253
commit
c8db469fd5
|
|
@ -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…
Reference in New Issue