Some compilation fixed, update README.md

This commit is contained in:
Jakub Melka 2022-07-17 16:10:42 +02:00
parent 3cdee09ade
commit 910e50ebcc
9 changed files with 26 additions and 16 deletions

View File

@ -23,16 +23,22 @@
#include <QApplication>
#include <QReadWriteLock>
#ifdef PDF4QT_COMPILER_MSVC
#pragma warning(push)
#pragma warning(disable:5033)
#endif
#define CMS_NO_REGISTER_KEYWORD
#include <lcms2.h>
#include <lcms2_plugin.h>
#ifdef PDF4QT_COMPILER_MSVC
#pragma warning(pop)
#endif
#ifdef Q_OS_WIN
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <Windows.h>
#include <Icm.h>
#if defined(PDF4QT_USE_PRAGMA_LIB)

View File

@ -21,6 +21,8 @@
#include "pdfglobal.h"
#include "pdfexception.h"
#include <optional>
class QPainter;
class QKeyEvent;
class QMouseEvent;

View File

@ -1858,7 +1858,7 @@ void PDFJBIG2Decoder::processTextRegion(const PDFJBIG2SegmentHeader& header)
{
uint16_t huffmanFlags = m_reader.readUnsignedWord();
auto readHuffmanTableSelection = [&huffmanFlags]() -> const uint8_t
auto readHuffmanTableSelection = [&huffmanFlags]() -> uint8_t
{
const uint8_t result = huffmanFlags & 0x03;
huffmanFlags = huffmanFlags >> 2;
@ -2049,7 +2049,7 @@ void PDFJBIG2Decoder::processTextRegion(const PDFJBIG2SegmentHeader& header)
{
// Read run code lengths
std::vector<PDFJBIG2HuffmanTableEntry> rangeLengthTable(35, PDFJBIG2HuffmanTableEntry());
for (int32_t i = 0; i < rangeLengthTable.size(); ++i)
for (int32_t i = 0; i < static_cast<int32_t>(rangeLengthTable.size()); ++i)
{
rangeLengthTable[i].value = i;
rangeLengthTable[i].prefixBitLength = m_reader.read(4);

View File

@ -268,7 +268,7 @@ PDFLexicalAnalyzer::Token PDFLexicalAnalyzer::fetch()
int octalNumber = -1;
if (fetchOctalNumber(3, &octalNumber))
{
string += static_cast<const char>(octalNumber);
string += static_cast<char>(octalNumber);
}
else
{

View File

@ -628,9 +628,9 @@ void PDFFloatBitmap::blend(const PDFFloatBitmap& source,
return channelBlendModes[channel];
};
for (size_t x = blendRegion.left(); x <= blendRegion.right(); ++x)
for (int x = blendRegion.left(); x <= blendRegion.right(); ++x)
{
for (size_t y = blendRegion.top(); y <= blendRegion.bottom(); ++y)
for (int y = blendRegion.top(); y <= blendRegion.bottom(); ++y)
{
PDFConstColorBuffer sourceColor = source.getPixel(x, y);
PDFColorBuffer targetColor = target.getPixel(x, y);
@ -2187,7 +2187,8 @@ void PDFTransparencyRenderer::performPathPainting(const QPainterPath& path, bool
const PDFLineDashPattern& lineDashPattern = getGraphicState()->getLineDashPattern();
if (!lineDashPattern.isSolid())
{
stroker.setDashPattern(QVector<PDFReal>::fromStdVector(lineDashPattern.getDashArray()));
const auto& dashArray = lineDashPattern.getDashArray();
stroker.setDashPattern(QVector<PDFReal>(dashArray.begin(), dashArray.end()));
stroker.setDashOffset(lineDashPattern.getDashOffset());
}
QPainterPath strokedPath = stroker.createStroke(path);

View File

@ -44,7 +44,7 @@ PDFAboutDialog::PDFAboutDialog(QWidget* parent) :
ui->tableWidget->setSelectionMode(QTableView::SingleSelection);
ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
for (int i = 0; i < infos.size(); ++i)
for (size_t i = 0; i < infos.size(); ++i)
{
const pdf::PDFDependentLibraryInfo& info = infos[i];
ui->tableWidget->setItem(i, 0, new QTableWidgetItem(info.library));

View File

@ -96,7 +96,7 @@ void PDFEncryptionSettingsDialog::updateUi()
pdf::PDFTemporaryValueChange guard(&m_isUpdatingUi, true);
const pdf::PDFSecurityHandlerFactory::Algorithm algorithm = static_cast<const pdf::PDFSecurityHandlerFactory::Algorithm>(ui->algorithmComboBox->currentData().toInt());
const pdf::PDFSecurityHandlerFactory::Algorithm algorithm = static_cast<pdf::PDFSecurityHandlerFactory::Algorithm>(ui->algorithmComboBox->currentData().toInt());
const bool encrypted = algorithm != pdf::PDFSecurityHandlerFactory::None;
const bool isEncryptedUsingCertificate = algorithm == pdf::PDFSecurityHandlerFactory::Certificate;
@ -200,7 +200,7 @@ void PDFEncryptionSettingsDialog::updateCertificates()
void PDFEncryptionSettingsDialog::updatePasswordScore()
{
const pdf::PDFSecurityHandlerFactory::Algorithm algorithm = static_cast<const pdf::PDFSecurityHandlerFactory::Algorithm>(ui->algorithmComboBox->currentData().toInt());
const pdf::PDFSecurityHandlerFactory::Algorithm algorithm = static_cast<pdf::PDFSecurityHandlerFactory::Algorithm>(ui->algorithmComboBox->currentData().toInt());
const int userPasswordScore = pdf::PDFSecurityHandlerFactory::getPasswordEntropy(ui->userPasswordEdit->text(), algorithm);
const int ownerPasswordScore = pdf::PDFSecurityHandlerFactory::getPasswordEntropy(ui->ownerPasswordEdit->text(), algorithm);
@ -223,7 +223,7 @@ void PDFEncryptionSettingsDialog::accept()
}
settings.id = m_documentId;
settings.algorithm = static_cast<const pdf::PDFSecurityHandlerFactory::Algorithm>(ui->algorithmComboBox->currentData().toInt());
settings.algorithm = static_cast<pdf::PDFSecurityHandlerFactory::Algorithm>(ui->algorithmComboBox->currentData().toInt());
settings.encryptContents = encryptContents;
settings.userPassword = ui->userPasswordEdit->text();
settings.ownerPassword = ui->ownerPasswordEdit->text();

View File

@ -73,7 +73,7 @@ void PDFRecentFileManager::update()
m_recentFiles.pop_back();
}
for (int i = 0; i < m_actions.size(); ++i)
for (int i = 0; i < static_cast<int>(m_actions.size()); ++i)
{
QAction* recentFileAction = m_actions[i];
if (i < m_recentFiles.size())

View File

@ -1,8 +1,9 @@
# PDF4QT
**(c) Jakub Melka 2018-2021**
**(c) Jakub Melka 2018-2022**
**Mgr.Jakub.Melka@gmail.com**
**https://jakubmelka.github.io/**
This software is consisting of PDF rendering library, and several
applications, such as advanced document viewer, command line tool,
@ -87,17 +88,17 @@ On Windows, you can use Visual Studio 2019, clang or mingw. On linux, only GCC 1
was tested.
### Compilation instructions (.pro file, Windows, Visual Studio):
1. Download Visual Studio 2019
2. Download Qt, minimal supported version is 5.14.2
1. Download Visual Studio 2022
2. Download Qt, minimal supported version is 5.15.2
3. Download [precompiled libraries](https://github.com/JakubMelka/PdfForQt-Dependencies),
or compile them yourself. Libraries must be in same root directory as this project,
so root folder of this project will have a sibling folder with these libraries
4. Open Qt Creator and root project Pdf4Qt.pro
5. Create target for Microsoft Visual Studio 2019 and compile the project
5. Create target for Microsoft Visual Studio 2022 and compile the project
### Compilation instructions (.qbs file, Windows/Linux)
For QBS build, you will need to install [Conan](https://conan.io/), a C++ package manager, Qt framework
(minimal supported version is 5.14.2), and compiler supporting C++20 (Visual Studio 2019, Clang, Mingw,
(minimal supported version is 5.15.2), and compiler supporting C++20 (Visual Studio 2022, Clang, Mingw,
GCC).
1. Prepare prerequisites (Conan, Qt, compiler)
2. Open QBS project file