From 2cd7b9db25615093a18e8e2335b2dffd4430e471 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 18 Nov 2018 11:41:45 +0100 Subject: 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 --- desktop-widgets/templateedit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) -- cgit v1.2.3-70-g09d2