mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-05-28 00:30:23 -04:00
minor tweaks in HEIF and AVIF plugins
It is mostly only about casting between types.
This commit is contained in:
parent
dcab3a06ab
commit
3b1e8f7054
@ -63,7 +63,7 @@ bool QAVIFHandler::canRead(QIODevice *device)
|
|||||||
}
|
}
|
||||||
|
|
||||||
avifROData input;
|
avifROData input;
|
||||||
input.data = (const uint8_t *)header.constData();
|
input.data = reinterpret_cast<const uint8_t *>(header.constData());
|
||||||
input.size = header.size();
|
input.size = header.size();
|
||||||
|
|
||||||
if (avifPeekCompatibleFileType(&input)) {
|
if (avifPeekCompatibleFileType(&input)) {
|
||||||
@ -116,7 +116,7 @@ bool QAVIFHandler::ensureDecoder()
|
|||||||
|
|
||||||
m_rawData = device()->readAll();
|
m_rawData = device()->readAll();
|
||||||
|
|
||||||
m_rawAvifData.data = (const uint8_t *)m_rawData.constData();
|
m_rawAvifData.data = reinterpret_cast<const uint8_t *>(m_rawData.constData());
|
||||||
m_rawAvifData.size = m_rawData.size();
|
m_rawAvifData.size = m_rawData.size();
|
||||||
|
|
||||||
if (avifPeekCompatibleFileType(&m_rawAvifData) == AVIF_FALSE) {
|
if (avifPeekCompatibleFileType(&m_rawAvifData) == AVIF_FALSE) {
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QPointF>
|
#include <QPointF>
|
||||||
#include <QSysInfo>
|
#include <QSysInfo>
|
||||||
|
#include <limits>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
namespace // Private.
|
namespace // Private.
|
||||||
@ -637,8 +638,8 @@ bool HEIFHandler::ensureDecoder()
|
|||||||
heif_color_profile_type profileType = heif_image_handle_get_color_profile_type(handle.get_raw_image_handle());
|
heif_color_profile_type profileType = heif_image_handle_get_color_profile_type(handle.get_raw_image_handle());
|
||||||
struct heif_error err;
|
struct heif_error err;
|
||||||
if (profileType == heif_color_profile_type_prof || profileType == heif_color_profile_type_rICC) {
|
if (profileType == heif_color_profile_type_prof || profileType == heif_color_profile_type_rICC) {
|
||||||
int rawProfileSize = (int)heif_image_handle_get_raw_color_profile_size(handle.get_raw_image_handle());
|
size_t rawProfileSize = heif_image_handle_get_raw_color_profile_size(handle.get_raw_image_handle());
|
||||||
if (rawProfileSize > 0) {
|
if (rawProfileSize > 0 && rawProfileSize < std::numeric_limits<int>::max()) {
|
||||||
QByteArray ba(rawProfileSize, 0);
|
QByteArray ba(rawProfileSize, 0);
|
||||||
err = heif_image_handle_get_raw_color_profile(handle.get_raw_image_handle(), ba.data());
|
err = heif_image_handle_get_raw_color_profile(handle.get_raw_image_handle(), ba.data());
|
||||||
if (err.code) {
|
if (err.code) {
|
||||||
@ -650,7 +651,7 @@ bool HEIFHandler::ensureDecoder()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "icc profile is empty";
|
qWarning() << "icc profile is empty or above limits";
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (profileType == heif_color_profile_type_nclx) {
|
} else if (profileType == heif_color_profile_type_nclx) {
|
||||||
|
Loading…
Reference in New Issue
Block a user