1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-19 00:13:33 +00:00

editors/calligra: switch to C++17 for upcoming poppler

This is a fix-it-before-it-breaks commit. Upcoming poppler update
requires C++17 in consumers, while Calligra was fixed on C++14.
There is no upstream release for this.

This is a mess: the upstream repo contains fixes, but they're
mostly committed as "fix warnings" and many commits combine C++17-
related fixes with other bits and pieces. As a result, there's
some direct upstream patches now in files/ and a big glommed-
together one put together from parts of other commits.

PR:	260956
This commit is contained in:
Adriaan de Groot 2022-01-17 19:33:00 +01:00
parent 9dc9eb71e5
commit 6880d50e13
5 changed files with 1616 additions and 6 deletions

View File

@ -36,7 +36,7 @@ LIB_DEPENDS= libImath.so:math/Imath \
BUILD_DEPENDS= pstoedit:graphics/pstoedit
RUN_DEPENDS= pstoedit:graphics/pstoedit
USES= cmake cpe compiler:c++11-lib desktop-file-utils eigen:3 \
USES= cmake cpe compiler:c++17-lang desktop-file-utils eigen:3 \
gettext iconv:translit jpeg kde:5 localbase:ldflags perl5 \
pkgconfig qca qt:5 shared-mime-info sqlite tar:xz xorg
USE_KDE= akonadicontacts activities archive auth bookmarks codecs completion \

View File

@ -0,0 +1,46 @@
Part of this commit, which fixes build in C++17
commit 068cd9aec11052733e393976142516d2190e4564
Author: Pierre Ducroquet <pinaraf@pinaraf.info>
Date: Sun Feb 28 23:23:02 2021 +0100
Fix some more warnings
diff --git filters/words/msword-odf/wv2/src/styles.h filters/words/msword-odf/wv2/src/styles.h
index ba02def6845..41c8278dd21 100644
--- filters/words/msword-odf/wv2/src/styles.h
+++ filters/words/msword-odf/wv2/src/styles.h
@@ -58,8 +58,9 @@ struct STD
STD();
/**
* Simply calls read(...)
+ * @throw InvalidFormatException
*/
- STD( U16 stdfSize, U16 totalSize, OLEStreamReader* stream, bool preservePos = false ) throw(InvalidFormatException);
+ STD( U16 stdfSize, U16 totalSize, OLEStreamReader* stream, bool preservePos = false );
/**
* Attention: This struct allocates memory on the heap
*/
@@ -74,8 +75,9 @@ struct STD
* false the state of stream will be changed!
*
* @return true - success, false - failed
+ * @throw InvalidFormatException
*/
- bool read( const U16 cbStd, const U16 stdfSize, OLEStreamReader* stream, bool preservePos = false ) throw(InvalidFormatException);
+ bool read( const U16 cbStd, const U16 stdfSize, OLEStreamReader* stream, bool preservePos = false );
/**
* Same as reading :)
@@ -365,7 +367,10 @@ private:
class WV2_EXPORT StyleSheet
{
public:
- StyleSheet( OLEStreamReader* tableStream, U32 fcStshf, U32 lcbStshf ) throw(InvalidFormatException);
+ /**
+ * @throw InvalidFormatException
+ */
+ StyleSheet( OLEStreamReader* tableStream, U32 fcStshf, U32 lcbStshf );
~StyleSheet();
/**

View File

@ -0,0 +1,127 @@
diff --git filters/libmsooxml/CMakeLists.txt filters/libmsooxml/CMakeLists.txt
index cd5b597d319..b243cf875eb 100644
--- filters/libmsooxml/CMakeLists.txt
+++ filters/libmsooxml/CMakeLists.txt
@@ -2,11 +2,6 @@ if(Qca-qt5_FOUND)
add_definitions( -DHAVE_QCA2 )
endif()
-# TEMPORARY: for std::auto_ptr deprecation warnings are only annoying noise
-if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUC)
- add_definitions(-Wno-deprecated-declarations)
-endif ()
-
include_directories(
${KOMAIN_INCLUDES}
${KOODF2_INCLUDES} # For charts
diff --git filters/libmsooxml/MsooXmlImport.cpp filters/libmsooxml/MsooXmlImport.cpp
index 8876988220f..c873a998413 100644
--- filters/libmsooxml/MsooXmlImport.cpp
+++ filters/libmsooxml/MsooXmlImport.cpp
@@ -594,8 +594,8 @@ KoFilter::ConversionStatus MsooXmlImport::imageFromFile(const QString& sourceNam
QString errorMessage;
KoFilter::ConversionStatus status = KoFilter::OK;
- std::auto_ptr<QIODevice> inputDevice(Utils::openDeviceForFile(m_zip, errorMessage, sourceName, status));
- if (!inputDevice.get()) {
+ std::unique_ptr<QIODevice> inputDevice(Utils::openDeviceForFile(m_zip, errorMessage, sourceName, status));
+ if (!inputDevice) {
return status;
}
QImageReader r(inputDevice.get(), QFileInfo(sourceName).suffix().toLatin1());
diff --git filters/libmsooxml/MsooXmlThemesReader.cpp filters/libmsooxml/MsooXmlThemesReader.cpp
index 5818a5caf03..9919d7f1ffb 100644
--- filters/libmsooxml/MsooXmlThemesReader.cpp
+++ filters/libmsooxml/MsooXmlThemesReader.cpp
@@ -736,14 +736,14 @@ KoFilter::ConversionStatus MsooXmlThemesReader::read_color()
*/
KoFilter::ConversionStatus MsooXmlThemesReader::read_srgbClr_local()
{
- std::auto_ptr<DrawingMLColorSchemeItem> color(new DrawingMLColorSchemeItem);
+ std::unique_ptr<DrawingMLColorSchemeItem> color(new DrawingMLColorSchemeItem);
m_currentColor_local = 0;
READ_PROLOGUE
const QXmlStreamAttributes attrs(attributes());
READ_ATTR_WITHOUT_NS(val)
- color.get()->color = Utils::ST_HexColorRGB_to_QColor(val);
- //debugMsooXml << color.get()->color;
+ color->color = Utils::ST_HexColorRGB_to_QColor(val);
+ //debugMsooXml << color->color;
readNext();
READ_EPILOGUE_WITHOUT_RETURN
@@ -841,19 +841,19 @@ KoFilter::ConversionStatus MsooXmlThemesReader::read_srgbClr_local()
*/
KoFilter::ConversionStatus MsooXmlThemesReader::read_sysClr_local()
{
- std::auto_ptr<DrawingMLColorSchemeSystemItem> color(new DrawingMLColorSchemeSystemItem);
+ std::unique_ptr<DrawingMLColorSchemeSystemItem> color(new DrawingMLColorSchemeSystemItem);
m_currentColor_local = 0;
READ_PROLOGUE
const QXmlStreamAttributes attrs(attributes());
READ_ATTR_WITHOUT_NS(lastClr)
- color.get()->lastColor = Utils::ST_HexColorRGB_to_QColor(lastClr);
-// debugMsooXml << "lastClr:" << color.get()->lastColor.name();
+ color->lastColor = Utils::ST_HexColorRGB_to_QColor(lastClr);
+// debugMsooXml << "lastClr:" << color->lastColor.name();
// System color value. This color is based upon the value that this color
// currently has within the system on which the document is being viewed.
- READ_ATTR_WITHOUT_NS_INTO(val, color.get()->systemColor)
-// debugMsooXml << "val:" << color.get()->systemColor;
+ READ_ATTR_WITHOUT_NS_INTO(val, color->systemColor)
+// debugMsooXml << "val:" << color->systemColor;
readNext();
READ_EPILOGUE_WITHOUT_RETURN
diff --git filters/libmsooxml/MsooXmlUtils.cpp filters/libmsooxml/MsooXmlUtils.cpp
index 49f8faea449..99460c28df9 100644
--- filters/libmsooxml/MsooXmlUtils.cpp
+++ filters/libmsooxml/MsooXmlUtils.cpp
@@ -189,8 +189,8 @@ KoFilter::ConversionStatus Utils::loadAndParse(KoXmlDocument& doc, const KZip* z
{
errorMessage.clear();
KoFilter::ConversionStatus status;
- std::auto_ptr<QIODevice> device(openDeviceForFile(zip, errorMessage, fileName, status));
- if (!device.get())
+ std::unique_ptr<QIODevice> device(openDeviceForFile(zip, errorMessage, fileName, status));
+ if (!device)
return status;
return loadAndParse(device.get(), doc, errorMessage, fileName);
}
@@ -205,8 +205,8 @@ KoFilter::ConversionStatus Utils::loadAndParseDocument(MsooXmlReader* reader,
Q_UNUSED(writers)
errorMessage.clear();
KoFilter::ConversionStatus status;
- std::auto_ptr<QIODevice> device(openDeviceForFile(zip, errorMessage, fileName, status));
- if (!device.get())
+ std::unique_ptr<QIODevice> device(openDeviceForFile(zip, errorMessage, fileName, status));
+ if (!device)
return status;
reader->setDevice(device.get());
reader->setFileName(fileName); // for error reporting
@@ -389,9 +389,9 @@ KoFilter::ConversionStatus Utils::copyFile(const KZip* zip, QString& errorMessag
return status;
}
- std::auto_ptr<QIODevice> inputDevice = std::auto_ptr<QIODevice>(Utils::openDeviceForFile(zip, errorMessage, sourceName, status));
+ std::unique_ptr<QIODevice> inputDevice(Utils::openDeviceForFile(zip, errorMessage, sourceName, status));
- if (!inputDevice.get()) {
+ if (!inputDevice) {
return status;
}
@@ -423,8 +423,8 @@ KoFilter::ConversionStatus Utils::imageSize(const KZip* zip, QString& errorMessa
{
Q_ASSERT(size);
KoFilter::ConversionStatus status;
- std::auto_ptr<QIODevice> inputDevice(Utils::openDeviceForFile(zip, errorMessage, sourceName, status));
- if (!inputDevice.get()) {
+ std::unique_ptr<QIODevice> inputDevice(Utils::openDeviceForFile(zip, errorMessage, sourceName, status));
+ if (!inputDevice) {
return status;
}
QImageReader r(inputDevice.get(), QFileInfo(sourceName).suffix().toLatin1());

View File

@ -1,10 +1,26 @@
Fix build against KDE Frameworks 5.83
(no longer ships find module, and the
cmake default one is used).
- Use the C++ setting from "outside"; ECM uses modern C++ by default now
- Fix build against KDE Frameworks 5.83
(no longer ships find module, and the
cmake default one is used).
--- CMakeLists.txt.orig 2021-07-09 21:31:30 UTC
--- CMakeLists.txt.orig 2020-05-14 06:53:49 UTC
+++ CMakeLists.txt
@@ -641,8 +641,8 @@ if(NOT WIN32 AND NOT APPLE)
@@ -104,13 +104,7 @@ if(NOT DEFINED RELEASE_BUILD)
endif()
message(STATUS "Release build: ${RELEASE_BUILD}")
-# use CPP-11
-if (CMAKE_VERSION VERSION_LESS "3.1")
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
-else ()
- set (CMAKE_CXX_STANDARD 11)
-endif ()
-
+ set (CMAKE_CXX_STANDARD 17)
############
#############
## Options ##
@@ -641,8 +634,8 @@ if(NOT WIN32 AND NOT APPLE)
)
endif()

File diff suppressed because it is too large Load Diff