[Libreoffice-commits] libcdr.git: src/lib
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Oct 8 07:25:02 UTC 2019
src/lib/CDRTransforms.cpp | 10 ----------
src/lib/CDRTransforms.h | 8 ++++++--
src/lib/CDRTypes.h | 4 ++--
3 files changed, 8 insertions(+), 14 deletions(-)
New commits:
commit 012bce64e08d45c9ce37c9c6758e8556cebf8688
Author: Albert Astals Cid <aacid at kde.org>
AuthorDate: Sat Oct 5 18:41:01 2019 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Oct 8 09:24:44 2019 +0200
Fix -Wdeprecated-copy warnings
New gcc complains when you're using the default defined operator= but
your class has an explicitely defined copy constructor.
This is because if you implemented the copy constructor is usually
because you needed something special, so you'll need that special in the
assignment operator.
In the cases here it's not really a problem since the explicitely
defined constructors where just doing the same as the default so i've
just marked them as default as well as the assignment operator
Example:
CDRParser.cpp: In member function ‘void libcdr::CDRParser::readFont(librevenge::RVNGInputStream*, unsigned int)’:
CDRParser.cpp:2550:53: warning: implicitly-declared ‘libcdr::CDRFont& libcdr::CDRFont::operator=(const libcdr::CDRFont&)’ is deprecated [-Wdeprecated-copy]
2550 | m_fonts[fontId] = CDRFont(fontName, fontEncoding);
| ^
In file included from CDRParser.h:18,
from CDRParser.cpp:10:
CDRTypes.h:372:3: note: because ‘libcdr::CDRFont’ has user-provided ‘libcdr::CDRFont::CDRFont(const libcdr::CDRFont&)’
372 | CDRFont(const CDRFont &font)
| ^~~~~~~
Change-Id: I3011f415cc1e44222509d69a2d5a791a3e3e91e1
Reviewed-on: https://gerrit.libreoffice.org/80302
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
Tested-by: Miklos Vajna <vmiklos at collabora.com>
diff --git a/src/lib/CDRTransforms.cpp b/src/lib/CDRTransforms.cpp
index e29303e..e95cfc7 100644
--- a/src/lib/CDRTransforms.cpp
+++ b/src/lib/CDRTransforms.cpp
@@ -23,11 +23,6 @@ libcdr::CDRTransform::CDRTransform(double v0, double v1, double x0, double v3, d
{
}
-libcdr::CDRTransform::CDRTransform(const CDRTransform &trafo)
- : m_v0(trafo.m_v0), m_v1(trafo.m_v1), m_x0(trafo.m_x0),
- m_v3(trafo.m_v3), m_v4(trafo.m_v4), m_y0(trafo.m_y0) {}
-
-
void libcdr::CDRTransform::applyToPoint(double &x, double &y) const
{
double tmpX = m_v0*x + m_v1*y+m_x0;
@@ -222,11 +217,6 @@ libcdr::CDRTransforms::CDRTransforms()
{
}
-libcdr::CDRTransforms::CDRTransforms(const CDRTransforms &trafos)
- : m_trafos(trafos.m_trafos)
-{
-}
-
libcdr::CDRTransforms::~CDRTransforms()
{
}
diff --git a/src/lib/CDRTransforms.h b/src/lib/CDRTransforms.h
index df789de..1ecf36e 100644
--- a/src/lib/CDRTransforms.h
+++ b/src/lib/CDRTransforms.h
@@ -21,7 +21,9 @@ class CDRTransform
public:
CDRTransform();
CDRTransform(double v0, double v1, double x0, double v3, double v4, double y0);
- CDRTransform(const CDRTransform &trafo);
+ CDRTransform(const CDRTransform &trafo) = default;
+
+ CDRTransform &operator=(const CDRTransform &trafo) = default;
void applyToPoint(double &x, double &y) const;
void applyToArc(double &rx, double &ry, double &rotation, bool &sweep, double &endx, double &endy) const;
@@ -49,9 +51,11 @@ class CDRTransforms
{
public:
CDRTransforms();
- CDRTransforms(const CDRTransforms &trafos);
+ CDRTransforms(const CDRTransforms &trafos) = default;
~CDRTransforms();
+ CDRTransforms &operator=(const CDRTransforms &trafo) = default;
+
void append(double v0, double v1, double x0, double v3, double v4, double y0);
void append(const CDRTransform &trafo);
void clear();
diff --git a/src/lib/CDRTypes.h b/src/lib/CDRTypes.h
index 3563b27..3ea5667 100644
--- a/src/lib/CDRTypes.h
+++ b/src/lib/CDRTypes.h
@@ -369,8 +369,8 @@ struct CDRFont
CDRFont() : m_name(), m_encoding(0) {}
CDRFont(const librevenge::RVNGString &name, unsigned short encoding)
: m_name(name), m_encoding(encoding) {}
- CDRFont(const CDRFont &font)
- : m_name(font.m_name), m_encoding(font.m_encoding) {}
+ CDRFont(const CDRFont &font) = default;
+ CDRFont& operator=(const CDRFont &font) = default;
librevenge::RVNGString m_name;
unsigned short m_encoding;
};
More information about the Libreoffice-commits
mailing list