summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorVille Voutilainen <ville.voutilainen@qt.io>2018-01-12 16:29:00 +0200
committerVille Voutilainen <ville.voutilainen@qt.io>2018-01-25 18:20:20 +0000
commit342bb5b03a76d1428fafb8e1532d66e172bd1c0b (patch)
treee2aaeecbbbc95c8b10d2bcd15540c217669c7ac4 /src/gui/text
parenta87b549edfb66b3c3bc14466455792aea6e80c84 (diff)
Do a static_cast in bit-blasts that are UB
Without this, building Qt and Qt applications fails with GCC 8. The errors look like this: writing to an object of type ‘class QPointer<QQuickPointerHandler>’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess] Task-number: QTBUG-65691 Change-Id: Ie5a30814125deca7a160b9a61f5aa3f944ee1ac9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qtextengine_p.h8
-rw-r--r--src/gui/text/qtextobject.h4
2 files changed, 6 insertions, 6 deletions
diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h
index f49e2638f5..58ddc7c06d 100644
--- a/src/gui/text/qtextengine_p.h
+++ b/src/gui/text/qtextengine_p.h
@@ -236,13 +236,13 @@ struct QGlyphLayout
last = numGlyphs;
if (first == 0 && last == numGlyphs
&& reinterpret_cast<char *>(offsets + numGlyphs) == reinterpret_cast<char *>(glyphs)) {
- memset(offsets, 0, (numGlyphs * SpaceNeeded));
+ memset(static_cast<void *>(offsets), 0, (numGlyphs * SpaceNeeded));
} else {
const int num = last - first;
- memset(offsets + first, 0, num * sizeof(QFixedPoint));
+ memset(static_cast<void *>(offsets + first), 0, num * sizeof(QFixedPoint));
memset(glyphs + first, 0, num * sizeof(glyph_t));
- memset(advances + first, 0, num * sizeof(QFixed));
- memset(justifications + first, 0, num * sizeof(QGlyphJustification));
+ memset(static_cast<void *>(advances + first), 0, num * sizeof(QFixed));
+ memset(static_cast<void *>(justifications + first), 0, num * sizeof(QGlyphJustification));
memset(attributes + first, 0, num * sizeof(QGlyphAttributes));
}
}
diff --git a/src/gui/text/qtextobject.h b/src/gui/text/qtextobject.h
index a5030de112..4cc2535b58 100644
--- a/src/gui/text/qtextobject.h
+++ b/src/gui/text/qtextobject.h
@@ -154,9 +154,9 @@ public:
iterator(const iterator &o) Q_DECL_NOTHROW; // = default
iterator &operator=(const iterator &o) Q_DECL_NOTHROW; // = default
iterator(iterator &&other) Q_DECL_NOTHROW // = default
- { memcpy(this, &other, sizeof(iterator)); }
+ { memcpy(static_cast<void *>(this), static_cast<void *>(&other), sizeof(iterator)); }
iterator &operator=(iterator &&other) Q_DECL_NOTHROW // = default
- { memcpy(this, &other, sizeof(iterator)); return *this; }
+ { memcpy(static_cast<void *>(this), static_cast<void *>(&other), sizeof(iterator)); return *this; }
#endif
QTextFrame *parentFrame() const { return f; }