QResource: de-inline registerSelf for files
No other changes, aside from the coding style update to make sure the coding style bot won't complain. Change-Id: Iae320a2868db402a993dfffd15689a8a6ac202e8 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
parent
57b4b45cbd
commit
f56ca2c4f6
@ -1050,20 +1050,23 @@ public:
|
|||||||
QString mappingFile() const { return fileName; }
|
QString mappingFile() const { return fileName; }
|
||||||
ResourceRootType type() const override { return Resource_File; }
|
ResourceRootType type() const override { return Resource_File; }
|
||||||
|
|
||||||
bool registerSelf(const QString &f) {
|
bool registerSelf(const QString &f);
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifndef MAP_FILE
|
||||||
|
# define MAP_FILE 0
|
||||||
|
#endif
|
||||||
|
#ifndef MAP_FAILED
|
||||||
|
# define MAP_FAILED -1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool QDynamicFileResourceRoot::registerSelf(const QString &f)
|
||||||
|
{
|
||||||
bool fromMM = false;
|
bool fromMM = false;
|
||||||
uchar *data = 0;
|
uchar *data = 0;
|
||||||
unsigned int data_len = 0;
|
unsigned int data_len = 0;
|
||||||
|
|
||||||
#ifdef QT_USE_MMAP
|
#ifdef QT_USE_MMAP
|
||||||
|
|
||||||
#ifndef MAP_FILE
|
|
||||||
#define MAP_FILE 0
|
|
||||||
#endif
|
|
||||||
#ifndef MAP_FAILED
|
|
||||||
#define MAP_FAILED -1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int fd = QT_OPEN(QFile::encodeName(f), O_RDONLY,
|
int fd = QT_OPEN(QFile::encodeName(f), O_RDONLY,
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
_S_IREAD | _S_IWRITE
|
_S_IREAD | _S_IWRITE
|
||||||
@ -1089,7 +1092,7 @@ public:
|
|||||||
::close(fd);
|
::close(fd);
|
||||||
}
|
}
|
||||||
#endif // QT_USE_MMAP
|
#endif // QT_USE_MMAP
|
||||||
if(!data) {
|
if (!data) {
|
||||||
QFile file(f);
|
QFile file(f);
|
||||||
if (!file.exists())
|
if (!file.exists())
|
||||||
return false;
|
return false;
|
||||||
@ -1108,7 +1111,7 @@ public:
|
|||||||
fromMM = false;
|
fromMM = false;
|
||||||
}
|
}
|
||||||
if (data && QDynamicBufferResourceRoot::registerSelf(data, data_len)) {
|
if (data && QDynamicBufferResourceRoot::registerSelf(data, data_len)) {
|
||||||
if(fromMM) {
|
if (fromMM) {
|
||||||
unmapPointer = data;
|
unmapPointer = data;
|
||||||
unmapLength = data_len;
|
unmapLength = data_len;
|
||||||
}
|
}
|
||||||
@ -1116,8 +1119,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
static QString qt_resource_fixResourceRoot(QString r) {
|
static QString qt_resource_fixResourceRoot(QString r) {
|
||||||
if(!r.isEmpty()) {
|
if(!r.isEmpty()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user