mirror of
https://github.com/vale981/tdesktop
synced 2025-03-08 19:21:39 -05:00
30 lines
715 B
C++
30 lines
715 B
C++
/*
|
|
This file is part of Telegram Desktop,
|
|
the official desktop application for the Telegram messaging service.
|
|
|
|
For license and copyright information please follow this link:
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
*/
|
|
#include "lottie/lottie_common.h"
|
|
|
|
#include "base/algorithm.h"
|
|
|
|
#include <QFile>
|
|
|
|
namespace Lottie {
|
|
namespace {
|
|
|
|
QByteArray ReadFile(const QString &filepath) {
|
|
auto f = QFile(filepath);
|
|
return (f.size() <= kMaxFileSize && f.open(QIODevice::ReadOnly))
|
|
? f.readAll()
|
|
: QByteArray();
|
|
}
|
|
|
|
} // namespace
|
|
|
|
QByteArray ReadContent(const QByteArray &data, const QString &filepath) {
|
|
return data.isEmpty() ? ReadFile(filepath) : base::duplicate(data);
|
|
}
|
|
|
|
} // namespace Lottie
|