mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Issue #25: MinGW compilation fix
This commit is contained in:
@@ -21,6 +21,11 @@
|
||||
#include <QFile>
|
||||
#include <QStandardPaths>
|
||||
|
||||
#if defined(PDF4QT_COMPILER_MINGW) || defined(PDF4QT_COMPILER_GCC)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/rsa.h>
|
||||
#include <openssl/rsaerr.h>
|
||||
@@ -249,3 +254,7 @@ bool PDFSignatureFactory::sign(QString certificateName, QString password, QByteA
|
||||
}
|
||||
|
||||
} // namespace pdf
|
||||
|
||||
#if defined(PDF4QT_COMPILER_MINGW) || defined(PDF4QT_COMPILER_GCC)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
@@ -883,7 +883,8 @@ void PDFDiff::finalizeGraphicsPieces(PDFDiffPageContext& context)
|
||||
continue;
|
||||
}
|
||||
|
||||
hasher.addData(reinterpret_cast<const char*>(info.hash.data()), int(info.hash.size()));
|
||||
QByteArrayView view(reinterpret_cast<const char*>(info.hash.data()), info.hash.size());
|
||||
hasher.addData(view);
|
||||
}
|
||||
|
||||
QByteArray hash = hasher.result();
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include <QKeyEvent>
|
||||
#include <QApplication>
|
||||
#include <QPixmapCache>
|
||||
#include <QColorSpace>
|
||||
|
||||
namespace pdf
|
||||
{
|
||||
@@ -566,7 +567,7 @@ PDFOpenGLDrawWidget::PDFOpenGLDrawWidget(PDFWidget* widget, int samplesCount, QW
|
||||
QSurfaceFormat format = this->format();
|
||||
format.setProfile(QSurfaceFormat::CoreProfile);
|
||||
format.setSamples(samplesCount);
|
||||
format.setColorSpace(QSurfaceFormat::sRGBColorSpace);
|
||||
format.setColorSpace(QColorSpace(QColorSpace::SRgb));
|
||||
format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
|
||||
setFormat(format);
|
||||
}
|
||||
|
@@ -2233,9 +2233,9 @@ QString PDFEncoding::convertTextString(const QByteArray& stream)
|
||||
|
||||
QString PDFEncoding::convertFromUnicode(const QByteArray& stream)
|
||||
{
|
||||
const ushort* bytes = reinterpret_cast<const ushort*>(stream.data());
|
||||
const char16_t* bytes = reinterpret_cast<const char16_t*>(stream.data());
|
||||
const int sizeInChars = stream.size();
|
||||
const int sizeSizeInUShorts = sizeInChars / sizeof(const ushort) * sizeof(char);
|
||||
const size_t sizeSizeInUShorts = sizeInChars / sizeof(const ushort) * sizeof(char);
|
||||
|
||||
return QString::fromUtf16(bytes, sizeSizeInUShorts);
|
||||
}
|
||||
|
@@ -705,7 +705,7 @@ PDFObject PDFParser::getObject()
|
||||
{
|
||||
case PDFLexicalAnalyzer::TokenType::Boolean:
|
||||
{
|
||||
Q_ASSERT(m_lookAhead1.data.type() == QVariant::Bool);
|
||||
Q_ASSERT(m_lookAhead1.data.typeId() == QVariant::Bool);
|
||||
const bool value = m_lookAhead1.data.toBool();
|
||||
shift();
|
||||
return PDFObject::createBool(value);
|
||||
@@ -713,7 +713,7 @@ PDFObject PDFParser::getObject()
|
||||
|
||||
case PDFLexicalAnalyzer::TokenType::Integer:
|
||||
{
|
||||
Q_ASSERT(m_lookAhead1.data.type() == QVariant::LongLong);
|
||||
Q_ASSERT(m_lookAhead1.data.typeId() == QVariant::LongLong);
|
||||
const PDFInteger value = m_lookAhead1.data.toLongLong();
|
||||
shift();
|
||||
|
||||
@@ -723,7 +723,7 @@ PDFObject PDFParser::getObject()
|
||||
m_lookAhead2.type == PDFLexicalAnalyzer::TokenType::Command &&
|
||||
m_lookAhead2.data.toByteArray() == PDF_REFERENCE_COMMAND)
|
||||
{
|
||||
Q_ASSERT(m_lookAhead1.data.type() == QVariant::LongLong);
|
||||
Q_ASSERT(m_lookAhead1.data.typeId() == QVariant::LongLong);
|
||||
const PDFInteger generation = m_lookAhead1.data.toLongLong();
|
||||
shift();
|
||||
shift();
|
||||
@@ -738,7 +738,7 @@ PDFObject PDFParser::getObject()
|
||||
|
||||
case PDFLexicalAnalyzer::TokenType::Real:
|
||||
{
|
||||
Q_ASSERT(m_lookAhead1.data.type() == QVariant::Double);
|
||||
Q_ASSERT(m_lookAhead1.data.typeId() == QVariant::Double);
|
||||
const PDFReal value = m_lookAhead1.data.toDouble();
|
||||
shift();
|
||||
return PDFObject::createReal(value);
|
||||
@@ -746,7 +746,7 @@ PDFObject PDFParser::getObject()
|
||||
|
||||
case PDFLexicalAnalyzer::TokenType::String:
|
||||
{
|
||||
Q_ASSERT(m_lookAhead1.data.type() == QVariant::ByteArray);
|
||||
Q_ASSERT(m_lookAhead1.data.typeId() == QVariant::ByteArray);
|
||||
QByteArray array = m_lookAhead1.data.toByteArray();
|
||||
array.shrink_to_fit();
|
||||
shift();
|
||||
@@ -755,7 +755,7 @@ PDFObject PDFParser::getObject()
|
||||
|
||||
case PDFLexicalAnalyzer::TokenType::Name:
|
||||
{
|
||||
Q_ASSERT(m_lookAhead1.data.type() == QVariant::ByteArray);
|
||||
Q_ASSERT(m_lookAhead1.data.typeId() == QVariant::ByteArray);
|
||||
QByteArray array = m_lookAhead1.data.toByteArray();
|
||||
array.shrink_to_fit();
|
||||
shift();
|
||||
|
@@ -26,6 +26,11 @@
|
||||
|
||||
#include <QRandomGenerator>
|
||||
|
||||
#if defined(PDF4QT_COMPILER_MINGW) || defined(PDF4QT_COMPILER_GCC)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
#include <openssl/rc4.h>
|
||||
#include <openssl/md5.h>
|
||||
#include <openssl/aes.h>
|
||||
@@ -2612,3 +2617,8 @@ PDFObject PDFPublicKeySecurityHandler::createEncryptionDictionaryObject() const
|
||||
}
|
||||
|
||||
} // namespace pdf
|
||||
|
||||
#if defined(PDF4QT_COMPILER_MINGW) || defined(PDF4QT_COMPILER_GCC)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2020-2022 Jakub Melka
|
||||
// Copyright (C) 2020-2022 Jakub Melka
|
||||
//
|
||||
// This file is part of PDF4QT.
|
||||
//
|
||||
@@ -23,6 +23,11 @@
|
||||
#include "pdfdbgheap.h"
|
||||
#include "pdfsignaturehandler_impl.h"
|
||||
|
||||
#if defined(PDF4QT_COMPILER_MINGW) || defined(PDF4QT_COMPILER_GCC)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/sha.h>
|
||||
#include <openssl/rsa.h>
|
||||
@@ -2100,3 +2105,7 @@ pdf::PDFCertificateStore::CertificateEntries pdf::PDFCertificateStore::getSystem
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#if defined(PDF4QT_COMPILER_MINGW) || defined(PDF4QT_COMPILER_GCC)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
@@ -12134,19 +12134,19 @@ void PDFXFAEngineImpl::drawUi(const xfa::XFA_ui* ui,
|
||||
passwordEdit || signature || textEdit;
|
||||
const bool isDefaultUi = !isNonDefaultUi || defaultUi;
|
||||
|
||||
if (textEdit || (isDefaultUi && value.value.type() == QVariant::String))
|
||||
if (textEdit || (isDefaultUi && value.value.typeId() == QVariant::String))
|
||||
{
|
||||
drawUiTextEdit(textEdit, value, errors, nominalExtentArea, paragraphSettingsIndex, painter);
|
||||
}
|
||||
else if (checkButton || (isDefaultUi && value.value.type() == QVariant::Bool))
|
||||
else if (checkButton || (isDefaultUi && value.value.typeId() == QVariant::Bool))
|
||||
{
|
||||
drawUiCheckButton(checkButton, value, nominalExtentArea, painter);
|
||||
}
|
||||
else if (imageEdit || (isDefaultUi && value.value.type() == QVariant::Image))
|
||||
else if (imageEdit || (isDefaultUi && value.value.typeId() == QVariant::Image))
|
||||
{
|
||||
drawUiImageEdit(imageEdit, value, errors, nominalExtentArea, painter);
|
||||
}
|
||||
else if (numericEdit || (isDefaultUi && value.value.type() == QVariant::Double))
|
||||
else if (numericEdit || (isDefaultUi && value.value.typeId() == QVariant::Double))
|
||||
{
|
||||
drawUiNumericEdit(numericEdit, value, errors, nominalExtentArea, paragraphSettingsIndex, painter);
|
||||
}
|
||||
@@ -12166,9 +12166,9 @@ void PDFXFAEngineImpl::drawUi(const xfa::XFA_ui* ui,
|
||||
{
|
||||
errors << PDFRenderError(RenderErrorType::NotImplemented, PDFTranslationContext::tr("XFA: Buttons not implemented."));
|
||||
}
|
||||
else if (dateTimeEdit || (isDefaultUi && (value.value.type() == QVariant::DateTime ||
|
||||
value.value.type() == QVariant::Date ||
|
||||
value.value.type() == QVariant::Time)))
|
||||
else if (dateTimeEdit || (isDefaultUi && (value.value.typeId() == QVariant::DateTime ||
|
||||
value.value.typeId() == QVariant::Date ||
|
||||
value.value.typeId() == QVariant::Time)))
|
||||
{
|
||||
drawUiDateTimeEdit(dateTimeEdit, value, errors, nominalExtentArea, paragraphSettingsIndex, painter);
|
||||
}
|
||||
@@ -12391,15 +12391,15 @@ void PDFXFAEngineImpl::drawUiDateTimeEdit(const xfa::XFA_dateTimeEdit* dateTimeE
|
||||
|
||||
QString text;
|
||||
|
||||
if (value.value.type() == QVariant::DateTime)
|
||||
if (value.value.typeId() == QVariant::DateTime)
|
||||
{
|
||||
text = value.value.toDateTime().toString();
|
||||
}
|
||||
else if (value.value.type() == QVariant::Time)
|
||||
else if (value.value.typeId() == QVariant::Time)
|
||||
{
|
||||
text = value.value.toTime().toString();
|
||||
}
|
||||
else if (value.value.type() == QVariant::Date)
|
||||
else if (value.value.typeId() == QVariant::Date)
|
||||
{
|
||||
text = value.value.toDate().toString();
|
||||
}
|
||||
|
Reference in New Issue
Block a user