diff --git a/src/qt/qt_opengloptions.cpp b/src/qt/qt_opengloptions.cpp index 04ca16234..f90ba37c0 100644 --- a/src/qt/qt_opengloptions.cpp +++ b/src/qt/qt_opengloptions.cpp @@ -14,6 +14,7 @@ * Copyright 2022 Teemu Korhonen */ +#include #include #include #include @@ -89,7 +90,7 @@ OpenGLOptions::save() const auto path = m_shaders.first().path().toLocal8Bit(); if (!path.isEmpty()) - strcpy(video_shader, path.constData()); + qstrncpy(video_shader, path.constData(), sizeof(video_shader)); else video_shader[0] = '\0'; } @@ -144,6 +145,9 @@ OpenGLOptions::addShader(const QString &path) shader_file.close(); + /* Remove parameter lines */ + shader_text.remove(QRegularExpression("^\\s*#pragma parameter.*?\\n", QRegularExpression::MultilineOption)); + QRegularExpression version("^\\s*(#version\\s+\\w+)", QRegularExpression::MultilineOption); auto match = version.match(shader_text);