r23890 by jghali - Attempt to fix several warnings related to slicing generated by clang

scribus-commit scribus-commit at lists.scribus.net
Mon Jun 15 22:00:17 UTC 2020


Author: jghali
Date: Mon Jun 15 22:00:17 2020
New Revision: 23890

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23890
Log:
Attempt to fix several warnings related to slicing generated by clang

Modified:
    trunk/Scribus/scribus/gtframestyle.h
    trunk/Scribus/scribus/gtparagraphstyle.h
    trunk/Scribus/scribus/plugins/gettext/csvim/csvim.cpp
    trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.cpp
    trunk/Scribus/scribus/plugins/gettext/sxwim/stylereader.cpp

Modified: trunk/Scribus/scribus/gtframestyle.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23890&path=/trunk/Scribus/scribus/gtframestyle.h
==============================================================================
--- trunk/Scribus/scribus/gtframestyle.h	(original)
+++ trunk/Scribus/scribus/gtframestyle.h	Mon Jun 15 22:00:17 2020
@@ -41,6 +41,9 @@
 	
 	QString target() const override;
 
+	gtParagraphStyle& asGtParagraphStyle() { return dynamic_cast<gtParagraphStyle&>(*this); }
+	const gtParagraphStyle& asGtParagraphStyle() const { return dynamic_cast<const gtParagraphStyle&>(*this); }
+
 	int getColumns() const;
 	void setColumns(int newColumns);
 	double getColumnsGap() const;

Modified: trunk/Scribus/scribus/gtparagraphstyle.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23890&path=/trunk/Scribus/scribus/gtparagraphstyle.h
==============================================================================
--- trunk/Scribus/scribus/gtparagraphstyle.h	(original)
+++ trunk/Scribus/scribus/gtparagraphstyle.h	Mon Jun 15 22:00:17 2020
@@ -74,6 +74,9 @@
 		numWasSet = 8192
 	} wasSetFlags;
 
+	gtStyle& asGtStyle() { return dynamic_cast<gtStyle&>(*this); }
+	const gtStyle& asGtStyle() const { return dynamic_cast<const gtStyle&>(*this); }
+
 	QString target() const override;
 
 	int    getFlags() const;

Modified: trunk/Scribus/scribus/plugins/gettext/csvim/csvim.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23890&path=/trunk/Scribus/scribus/plugins/gettext/csvim/csvim.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/csvim/csvim.cpp	(original)
+++ trunk/Scribus/scribus/plugins/gettext/csvim/csvim.cpp	Mon Jun 15 22:00:17 2020
@@ -52,7 +52,7 @@
 
 void CsvIm::setupPStyles()
 {
-	pstyleData = new gtParagraphStyle(*(writer->getDefaultStyle()));
+	pstyleData = new gtParagraphStyle(writer->getDefaultStyle()->asGtParagraphStyle());
 	pstyleData->setName(writer->getFrameName() + "-" + QObject::tr("CSV_data"));
 	if (!hasHeader)
 		return;

Modified: trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23890&path=/trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.cpp	(original)
+++ trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.cpp	Mon Jun 15 22:00:17 2020
@@ -81,7 +81,7 @@
 		codec = QTextCodec::codecForName(encoding.toLocal8Bit());
 	data = codec->toUnicode(data.toLocal8Bit());
 	// Applying default style is of very limited use with 135svn style system
-	/*gtParagraphStyle *pstyle = new gtParagraphStyle(*(writer->getDefaultStyle()));
+	/*gtParagraphStyle *pstyle = new gtParagraphStyle(writer->getDefaultStyle()->asGtParagraphStyle());
 	pstyle->setName(writer->getFrameName() + "-" + QObject::tr("PDB_data", "PDB Importer"));
 	writer->append(data, pstyle);
 	delete pstyle;*/

Modified: trunk/Scribus/scribus/plugins/gettext/sxwim/stylereader.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23890&path=/trunk/Scribus/scribus/plugins/gettext/sxwim/stylereader.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/sxwim/stylereader.cpp	(original)
+++ trunk/Scribus/scribus/plugins/gettext/sxwim/stylereader.cpp	Mon Jun 15 22:00:17 2020
@@ -57,7 +57,7 @@
 	{
 		/*if (!defaultStyleCreated)
 		{
-			gtParagraphStyle* pstyle = new gtParagraphStyle(*(writer->getDefaultStyle()));
+			gtParagraphStyle* pstyle = new gtParagraphStyle(writer->getDefaultStyle()->asGtParagraphStyle());
 			pstyle->setDefaultStyle(true);
 			currentStyle = dynamic_cast<gtStyle*>(pstyle);
 			currentStyle->setName("default-style");
@@ -167,7 +167,7 @@
 		if (attrs.localName(i) == "style:family")
 			if (attrs.value(i) == "paragraph")
 			{
-				gtParagraphStyle* pstyle = new gtParagraphStyle(*(writer->getDefaultStyle()));
+				gtParagraphStyle* pstyle = new gtParagraphStyle(writer->getDefaultStyle()->asGtParagraphStyle());
 				pstyle->setDefaultStyle(true);
 				currentStyle = dynamic_cast<gtStyle*>(pstyle);
 				currentStyle->setName("default-style");
@@ -309,7 +309,7 @@
 
 	if (!defaultStyleCreated)
 	{
-		gtParagraphStyle* pstyle = new gtParagraphStyle(*(writer->getDefaultStyle()));
+		gtParagraphStyle* pstyle = new gtParagraphStyle(writer->getDefaultStyle()->asGtParagraphStyle());
 		pstyle->setDefaultStyle(true);
 		currentStyle = dynamic_cast<gtStyle*>(pstyle);
 		currentStyle->setName("default-style");
@@ -568,9 +568,9 @@
 			fstyleName = it.key();
 		}
 	}
-	gtFrameStyle* fstyle;
+
 	gtParagraphStyle* pstyle = dynamic_cast<gtParagraphStyle*>(attrsStyles[fstyleName]);
-	fstyle = new gtFrameStyle(*pstyle);
+	gtFrameStyle* fstyle = new gtFrameStyle(*pstyle);
 
 	if (!importTextOnly)
 		writer->setFrameStyle(fstyle);




More information about the scribus-commit mailing list