Android: Fix some warnings
Use a static logging category where possible, and check the return value of QFile::open. Change-Id: Ieda9f7874d1b88d9bfeb593243eb867d0c274e9f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io> (cherry picked from commit e0ef713a2c6a74fe574481e98f0a582819418ed0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
e076767bfd
commit
60d28c8c7c
@ -21,7 +21,7 @@
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
Q_LOGGING_CATEGORY(lcIconEngineFontDownload, "qt.qpa.iconengine.fontdownload")
|
||||
Q_STATIC_LOGGING_CATEGORY(lcIconEngineFontDownload, "qt.qpa.iconengine.fontdownload")
|
||||
|
||||
// the primary types to work with the FontRequest API
|
||||
Q_DECLARE_JNI_CLASS(FontRequest, "androidx/core/provider/FontRequest")
|
||||
@ -203,7 +203,13 @@ static QString fetchFont(const QString &query)
|
||||
|
||||
int fd = fileDescriptor.callMethod<int>("detachFd");
|
||||
QFile file;
|
||||
file.open(fd, QFile::OpenModeFlag::ReadOnly, QFile::FileHandleFlag::AutoCloseHandle);
|
||||
if (!file.open(fd, QFile::OpenModeFlag::ReadOnly,
|
||||
QFile::FileHandleFlag::AutoCloseHandle)) {
|
||||
qCWarning(lcIconEngineFontDownload, "Font file '%ls' cannot be opened: %ls",
|
||||
qUtf16Printable(fontUri.toString()),
|
||||
qUtf16Printable(file.errorString()));
|
||||
continue;
|
||||
}
|
||||
const QByteArray fontData = file.readAll();
|
||||
qCDebug(lcIconEngineFontDownload) << "Font file read:" << fontData.size() << "bytes";
|
||||
int fontId = QFontDatabase::addApplicationFontFromData(fontData);
|
||||
|
Loading…
x
Reference in New Issue
Block a user