[poppler] 3 commits - fofi/FoFiBase.h poppler/PSOutputDev.cc poppler/PSOutputDev.h qt5/src qt6/src
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Apr 7 12:01:10 UTC 2022
fofi/FoFiBase.h | 4 ++--
poppler/PSOutputDev.cc | 10 +++++-----
poppler/PSOutputDev.h | 9 ++++-----
qt5/src/poppler-ps-converter.cc | 4 ++--
qt6/src/poppler-ps-converter.cc | 4 ++--
5 files changed, 15 insertions(+), 16 deletions(-)
New commits:
commit bea57d66fdba3c51b60fc6899481f6eb156c3b50
Author: Albert Astals Cid <aacid at kde.org>
Date: Thu Apr 7 13:52:47 2022 +0200
FoFiOutputFunc: Use size_t instead of int
diff --git a/fofi/FoFiBase.h b/fofi/FoFiBase.h
index 0cb7e438..ca62e948 100644
--- a/fofi/FoFiBase.h
+++ b/fofi/FoFiBase.h
@@ -13,7 +13,7 @@
// All changes made under the Poppler project to this file are licensed
// under GPL version 2 or later
//
-// Copyright (C) 2018 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2018, 2022 Albert Astals Cid <aacid at kde.org>
// Copyright (C) 2022 Oliver Sander <oliver.sander at tu-dresden.de>
//
// To see a description of the changes please see the Changelog file that
@@ -26,7 +26,7 @@
//------------------------------------------------------------------------
-using FoFiOutputFunc = void (*)(void *stream, const char *data, int len);
+using FoFiOutputFunc = void (*)(void *stream, const char *data, size_t len);
//------------------------------------------------------------------------
// FoFiBase
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index b836ddc3..136b06fb 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -1074,7 +1074,7 @@ extern "C" {
typedef void (*SignalFunc)(int);
}
-static void outputToFile(void *stream, const char *data, int len)
+static void outputToFile(void *stream, const char *data, size_t len)
{
fwrite(data, 1, len, (FILE *)stream);
}
diff --git a/qt5/src/poppler-ps-converter.cc b/qt5/src/poppler-ps-converter.cc
index 4e44eef9..fd2bbc19 100644
--- a/qt5/src/poppler-ps-converter.cc
+++ b/qt5/src/poppler-ps-converter.cc
@@ -1,5 +1,5 @@
/* poppler-ps-converter.cc: qt interface to poppler
- * Copyright (C) 2007, 2009, 2010, 2015, 2020, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2007, 2009, 2010, 2015, 2020, 2022, Albert Astals Cid <aacid at kde.org>
* Copyright (C) 2008, Pino Toscano <pino at kde.org>
* Copyright (C) 2010 Hib Eris <hib at hiberis.nl>
* Copyright (C) 2011 Glad Deschrijver <glad.deschrijver at gmail.com>
@@ -30,7 +30,7 @@
#include "PSOutputDev.h"
-static void outputToQIODevice(void *stream, const char *data, int len)
+static void outputToQIODevice(void *stream, const char *data, size_t len)
{
static_cast<QIODevice *>(stream)->write(data, len);
}
diff --git a/qt6/src/poppler-ps-converter.cc b/qt6/src/poppler-ps-converter.cc
index 4f06f1b4..e495c459 100644
--- a/qt6/src/poppler-ps-converter.cc
+++ b/qt6/src/poppler-ps-converter.cc
@@ -1,5 +1,5 @@
/* poppler-ps-converter.cc: qt interface to poppler
- * Copyright (C) 2007, 2009, 2010, 2015, 2020, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2007, 2009, 2010, 2015, 2020, 2022, Albert Astals Cid <aacid at kde.org>
* Copyright (C) 2008, Pino Toscano <pino at kde.org>
* Copyright (C) 2010 Hib Eris <hib at hiberis.nl>
* Copyright (C) 2011 Glad Deschrijver <glad.deschrijver at gmail.com>
@@ -30,7 +30,7 @@
#include "PSOutputDev.h"
-static void outputToQIODevice(void *stream, const char *data, int len)
+static void outputToQIODevice(void *stream, const char *data, size_t len)
{
static_cast<QIODevice *>(stream)->write(data, len);
}
commit 85e5dfb062a19cf0b4ee531746a941f6dadf1cdd
Author: Albert Astals Cid <aacid at kde.org>
Date: Thu Apr 7 13:50:37 2022 +0200
easier to understand definition for FoFiOutputFunc
diff --git a/fofi/FoFiBase.h b/fofi/FoFiBase.h
index 0246320e..0cb7e438 100644
--- a/fofi/FoFiBase.h
+++ b/fofi/FoFiBase.h
@@ -26,7 +26,7 @@
//------------------------------------------------------------------------
-typedef void (*FoFiOutputFunc)(void *stream, const char *data, int len);
+using FoFiOutputFunc = void (*)(void *stream, const char *data, int len);
//------------------------------------------------------------------------
// FoFiBase
commit 5973e32c9366f000c48d4a4f939abf2699faf145
Author: Albert Astals Cid <aacid at kde.org>
Date: Thu Apr 7 13:49:33 2022 +0200
PSOutputFunc -> FoFiOutputFunc
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 9db62299..b836ddc3 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -1181,8 +1181,8 @@ PSOutputDev::PSOutputDev(int fdA, PDFDoc *docA, char *psTitleA, const std::vecto
init(outputToFile, f, fileTypeA, psTitleA, docA, pagesA, modeA, imgLLXA, imgLLYA, imgURXA, imgURYA, manualCtrlA, paperWidthA, paperHeightA, noCropA, duplexA, levelA);
}
-PSOutputDev::PSOutputDev(PSOutputFunc outputFuncA, void *outputStreamA, char *psTitleA, PDFDoc *docA, const std::vector<int> &pagesA, PSOutMode modeA, int paperWidthA, int paperHeightA, bool noCropA, bool duplexA, int imgLLXA, int imgLLYA,
- int imgURXA, int imgURYA, PSForceRasterize forceRasterizeA, bool manualCtrlA, PSOutCustomCodeCbk customCodeCbkA, void *customCodeCbkDataA, PSLevel levelA)
+PSOutputDev::PSOutputDev(FoFiOutputFunc outputFuncA, void *outputStreamA, char *psTitleA, PDFDoc *docA, const std::vector<int> &pagesA, PSOutMode modeA, int paperWidthA, int paperHeightA, bool noCropA, bool duplexA, int imgLLXA,
+ int imgLLYA, int imgURXA, int imgURYA, PSForceRasterize forceRasterizeA, bool manualCtrlA, PSOutCustomCodeCbk customCodeCbkA, void *customCodeCbkDataA, PSLevel levelA)
{
underlayCbk = nullptr;
underlayCbkData = nullptr;
@@ -1233,8 +1233,8 @@ static bool pageDimensionEqual(int a, int b)
// Store the values but do not process them so the function that
// created the PSOutputDev can use the various setters to change defaults.
-void PSOutputDev::init(PSOutputFunc outputFuncA, void *outputStreamA, PSFileType fileTypeA, char *psTitleA, PDFDoc *docA, const std::vector<int> &pagesA, PSOutMode modeA, int imgLLXA, int imgLLYA, int imgURXA, int imgURYA, bool manualCtrlA,
- int paperWidthA, int paperHeightA, bool noCropA, bool duplexA, PSLevel levelA)
+void PSOutputDev::init(FoFiOutputFunc outputFuncA, void *outputStreamA, PSFileType fileTypeA, char *psTitleA, PDFDoc *docA, const std::vector<int> &pagesA, PSOutMode modeA, int imgLLXA, int imgLLYA, int imgURXA, int imgURYA,
+ bool manualCtrlA, int paperWidthA, int paperHeightA, bool noCropA, bool duplexA, PSLevel levelA)
{
if (pagesA.empty()) {
diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h
index 2e6b1d63..76d72396 100644
--- a/poppler/PSOutputDev.h
+++ b/poppler/PSOutputDev.h
@@ -46,6 +46,7 @@
#include "GfxState.h"
#include "GlobalParams.h"
#include "OutputDev.h"
+#include "fofi/FoFiBase.h"
#include <set>
#include <map>
#include <vector>
@@ -112,8 +113,6 @@ enum PSForceRasterize
psNeverRasterize // never rasterize, may produce incorrect output
};
-typedef void (*PSOutputFunc)(void *stream, const char *data, int len);
-
typedef GooString *(*PSOutCustomCodeCbk)(PSOutputDev *psOut, PSOutCustomCodeLocation loc, int n, void *data);
class POPPLER_PRIVATE_EXPORT PSOutputDev : public OutputDev
@@ -131,7 +130,7 @@ public:
// Open a PSOutputDev that will write to a generic stream.
// pages has to be sorted in increasing order
- PSOutputDev(PSOutputFunc outputFuncA, void *outputStreamA, char *psTitleA, PDFDoc *docA, const std::vector<int> &pages, PSOutMode modeA, int paperWidthA = -1, int paperHeightA = -1, bool noCrop = false, bool duplexA = true,
+ PSOutputDev(FoFiOutputFunc outputFuncA, void *outputStreamA, char *psTitleA, PDFDoc *docA, const std::vector<int> &pages, PSOutMode modeA, int paperWidthA = -1, int paperHeightA = -1, bool noCrop = false, bool duplexA = true,
int imgLLXA = 0, int imgLLYA = 0, int imgURXA = 0, int imgURYA = 0, PSForceRasterize forceRasterizeA = psRasterizeWhenNeeded, bool manualCtrlA = false, PSOutCustomCodeCbk customCodeCbkA = nullptr,
void *customCodeCbkDataA = nullptr, PSLevel levelA = psLevel2);
@@ -361,7 +360,7 @@ public:
}
private:
- void init(PSOutputFunc outputFuncA, void *outputStreamA, PSFileType fileTypeA, char *psTitleA, PDFDoc *doc, const std::vector<int> &pages, PSOutMode modeA, int imgLLXA, int imgLLYA, int imgURXA, int imgURYA, bool manualCtrlA,
+ void init(FoFiOutputFunc outputFuncA, void *outputStreamA, PSFileType fileTypeA, char *psTitleA, PDFDoc *doc, const std::vector<int> &pages, PSOutMode modeA, int imgLLXA, int imgLLYA, int imgURXA, int imgURYA, bool manualCtrlA,
int paperWidthA, int paperHeightA, bool noCropA, bool duplexA, PSLevel levelA);
void postInit();
void setupResources(Dict *resDict);
@@ -433,7 +432,7 @@ private:
char *psTitle;
bool postInitDone; // true if postInit() was called
- PSOutputFunc outputFunc;
+ FoFiOutputFunc outputFunc;
void *outputStream;
PSFileType fileType; // file / pipe / stdout
bool manualCtrl;
More information about the poppler
mailing list