summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/templateedit.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-11-18 11:41:45 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-11-19 13:51:03 -0800
commit2cd7b9db25615093a18e8e2335b2dffd4430e471 (patch)
tree314a511fa58b020cfb882e0501b656a781a63e91 /desktop-widgets/templateedit.cpp
parent26a4fb56326667c244f2a73aaf8a76be906e9fb8 (diff)
downloadsubsurface-2cd7b9db25615093a18e8e2335b2dffd4430e471.tar.gz
Warnings: replace memcpy by assignment
New gcc (v8.2) complains about memcpy()ing an object with non-POD members. Even though this seems not to be an issue for template_options, the warning has some merrit. The compiler will recognize when to do a memcpy() anyway. Moreover, the assignment is easier to read and also more secure, as a-priory we can't know if Qt's QColor copy-constructor does some strange things (hopefully not). Thus, replace memcpy() by simple assignment. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/templateedit.cpp')
-rw-r--r--desktop-widgets/templateedit.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/desktop-widgets/templateedit.cpp b/desktop-widgets/templateedit.cpp
index 82b02c324..36af4c994 100644
--- a/desktop-widgets/templateedit.cpp
+++ b/desktop-widgets/templateedit.cpp
@@ -147,7 +147,7 @@ void TemplateEdit::saveSettings()
msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Cancel);
if (msgBox.exec() == QMessageBox::Save) {
- memcpy(templateOptions, &newTemplateOptions, sizeof(struct template_options));
+ *templateOptions = newTemplateOptions;
if (templateChanged) {
TemplateLayout::writeTemplate(printOptions->p_template, ui->plainTextEdit->toPlainText());
if (printOptions->type == print_options::DIVELIST)