Commit 9bfc10ee authored by Adam Reichold's avatar Adam Reichold Committed by Albert Astals Cid

Bump required C++ standard version to C++14 and convert a few hopefully...

Bump required C++ standard version to C++14 and convert a few hopefully obvious call sites where types are repeated to using std::make_unique.
parent d2fa4a72
Pipeline #3910 passed with stage
in 10 minutes and 41 seconds
......@@ -34,7 +34,7 @@ set(POPPLER_MINOR_VERSION "68")
set(POPPLER_MICRO_VERSION "0")
set(POPPLER_VERSION "${POPPLER_MAJOR_VERSION}.${POPPLER_MINOR_VERSION}.${POPPLER_MICRO_VERSION}")
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_STANDARD 14)
set (CMAKE_CXX_EXTENSIONS OFF)
# command line switches
......
......@@ -125,7 +125,7 @@ image_private *image_private::create_data(int width, int height, image::format_e
return nullptr;
}
std::unique_ptr<image_private> d(new image_private(width, height, format));
auto d = std::make_unique<image_private>(width, height, format);
d->bytes_num = bpr * height;
d->data = reinterpret_cast<char *>(std::malloc(d->bytes_num));
if (!d->data) {
......
......@@ -336,13 +336,13 @@ std::vector<text_box> page::text_list() const
std::vector<text_box> output_list;
/* config values are same with Qt5 Page::TextList() */
std::unique_ptr<TextOutputDev> output_dev{
new TextOutputDev(nullptr, /* char* fileName */
gFalse, /* GBool physLayoutA */
0, /* double fixedPitchA */
gFalse, /* GBool rawOrderA */
gFalse) /* GBool append */
};
auto output_dev = std::make_unique<TextOutputDev>(
nullptr, /* char* fileName */
gFalse, /* GBool physLayoutA */
0, /* double fixedPitchA */
gFalse, /* GBool rawOrderA */
gFalse /* GBool append */
);
/*
* config values are same with Qt5 Page::TextList(),
......
......@@ -5225,7 +5225,7 @@ GfxPatchMeshShading *GfxPatchMeshShading::parse(GfxResources *res, int typeA, Di
nPatchesA = 0;
patchesA = nullptr;
patchesSize = 0;
std::unique_ptr<GfxShadingBitBuf> bitBuf(new GfxShadingBitBuf(str));
auto bitBuf = std::make_unique<GfxShadingBitBuf>(str);
while (1) {
if (!bitBuf->getBits(flagBits, &flag)) {
break;
......
......@@ -149,13 +149,15 @@ const QPicture& ArthurType3Font::getGlyph(int gid) const
Dict* resDict = m_font->getResources();
QPainter glyphPainter;
glyphs[gid] = std::unique_ptr<QPicture>(new QPicture);
glyphs[gid] = std::make_unique<QPicture>();
glyphPainter.begin(glyphs[gid].get());
std::unique_ptr<ArthurOutputDev> output_dev(new ArthurOutputDev(&glyphPainter));
auto output_dev = std::make_unique<ArthurOutputDev>(&glyphPainter);
std::unique_ptr<Gfx> gfx(new Gfx(m_doc, output_dev.get(), resDict,
&box, // pagebox
nullptr)); // cropBox
auto gfx = std::make_unique<Gfx>(
m_doc, output_dev.get(), resDict,
&box, // pagebox
nullptr // cropBox
);
output_dev->startDoc(m_doc);
......@@ -1059,9 +1061,11 @@ void ArthurOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
int width, int height, GBool invert,
GBool interpolate, GBool inlineImg)
{
std::unique_ptr<ImageStream> imgStr(new ImageStream(str, width,
1, // numPixelComps
1)); // getBits
auto imgStr = std::make_unique<ImageStream>(
str, width,
1, // numPixelComps
1 // getBits
);
imgStr->reset();
// TODO: Would using QImage::Format_Mono be more efficient here?
......@@ -1102,16 +1106,17 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
unsigned int *data;
unsigned int *line;
int x, y;
ImageStream *imgStr;
Guchar *pix;
int i;
QImage image;
int stride;
/* TODO: Do we want to cache these? */
imgStr = new ImageStream(str, width,
colorMap->getNumPixelComps(),
colorMap->getBits());
auto imgStr = std::make_unique<ImageStream>(
str, width,
colorMap->getNumPixelComps(),
colorMap->getBits()
);
imgStr->reset();
image = QImage(width, height, QImage::Format_ARGB32);
......@@ -1144,7 +1149,6 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
// At this point, the QPainter coordinate transformation (CTM) is such
// that QRect(0,0,1,1) is exactly the area of the image.
m_painter.top()->drawImage( QRect(0,0,1,1), image );
delete imgStr;
}
......@@ -1176,14 +1180,18 @@ void ArthurOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *
}
/* TODO: Do we want to cache these? */
std::unique_ptr<ImageStream> imgStr(new ImageStream(str, width,
colorMap->getNumPixelComps(),
colorMap->getBits()));
auto imgStr = std::make_unique<ImageStream>(
str, width,
colorMap->getNumPixelComps(),
colorMap->getBits()
);
imgStr->reset();
std::unique_ptr<ImageStream> maskImageStr(new ImageStream(maskStr, maskWidth,
maskColorMap->getNumPixelComps(),
maskColorMap->getBits()));
auto maskImageStr = std::make_unique<ImageStream>(
maskStr, maskWidth,
maskColorMap->getNumPixelComps(),
maskColorMap->getBits()
);
maskImageStr->reset();
QImage image(width, height, QImage::Format_ARGB32);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment