From 09bbf7651d443f649a1c828bf73bf0a0d3a92e56 Mon Sep 17 00:00:00 2001 From: Qv2ray-dev <59914293+Qv2ray-dev@users.noreply.github.com> Date: Sat, 21 Mar 2020 20:33:37 +0800 Subject: [PATCH] fix: stop eating memory and added header guards --- src/common/QvHelpers.hpp | 2 +- src/core/connection/ConnectionIO.hpp | 2 +- src/core/connection/Generation.hpp | 1 + src/core/connection/Serialization.hpp | 1 + src/core/settings/SettingsBackend.hpp | 1 + src/ui/w_PreferencesWindow.cpp | 2 +- src/ui/w_PreferencesWindow.hpp | 2 +- 7 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/common/QvHelpers.hpp b/src/common/QvHelpers.hpp index 0f015f6e..c05e8429 100644 --- a/src/common/QvHelpers.hpp +++ b/src/common/QvHelpers.hpp @@ -50,7 +50,7 @@ namespace Qv2ray::common } // template - QString StructToJsonString(const TYPE t) + QString StructToJsonString(const TYPE &t) { return QString::fromStdString(x2struct::X::tojson(t, "", 4, ' ')); } diff --git a/src/core/connection/ConnectionIO.hpp b/src/core/connection/ConnectionIO.hpp index c6114159..0489a271 100644 --- a/src/core/connection/ConnectionIO.hpp +++ b/src/core/connection/ConnectionIO.hpp @@ -1,6 +1,6 @@ +#pragma once #include "base/Qv2rayBase.hpp" #include "core/CoreSafeTypes.hpp" - namespace Qv2ray::core::connection { namespace ConnectionIO diff --git a/src/core/connection/Generation.hpp b/src/core/connection/Generation.hpp index e2a15c99..add99c11 100644 --- a/src/core/connection/Generation.hpp +++ b/src/core/connection/Generation.hpp @@ -1,3 +1,4 @@ +#pragma once #include "base/Qv2rayBase.hpp" namespace Qv2ray::core::connection diff --git a/src/core/connection/Serialization.hpp b/src/core/connection/Serialization.hpp index d9fa6620..25a44a30 100644 --- a/src/core/connection/Serialization.hpp +++ b/src/core/connection/Serialization.hpp @@ -1,3 +1,4 @@ +#pragma once #include "base/Qv2rayBase.hpp" #include "core/CoreSafeTypes.hpp" diff --git a/src/core/settings/SettingsBackend.hpp b/src/core/settings/SettingsBackend.hpp index 1e54ffb4..cfcc20b1 100644 --- a/src/core/settings/SettingsBackend.hpp +++ b/src/core/settings/SettingsBackend.hpp @@ -1,3 +1,4 @@ +#pragma once #include "base/Qv2rayBase.hpp" namespace Qv2ray::core::config diff --git a/src/ui/w_PreferencesWindow.cpp b/src/ui/w_PreferencesWindow.cpp index c42c41bf..f73ef239 100644 --- a/src/ui/w_PreferencesWindow.cpp +++ b/src/ui/w_PreferencesWindow.cpp @@ -806,7 +806,7 @@ void PreferencesWindow::on_nsBarFontSizeSB_valueChanged(double arg1) SET_LINE_LIST_TEXT } -QString PreferencesWindow::GetBarLineDescription(QvBarLine barLine) +QString PreferencesWindow::GetBarLineDescription(const QvBarLine &barLine) { QString result = "Empty"; result = NetSpeedPluginMessages[barLine.ContentType]; diff --git a/src/ui/w_PreferencesWindow.hpp b/src/ui/w_PreferencesWindow.hpp index 7d39f52b..442ca246 100644 --- a/src/ui/w_PreferencesWindow.hpp +++ b/src/ui/w_PreferencesWindow.hpp @@ -172,7 +172,7 @@ class PreferencesWindow void SetAutoStartButtonsState(bool isAutoStart); // Set ui parameters for a line; void ShowLineParameters(QvBarLine &line); - QString GetBarLineDescription(QvBarLine line); + QString GetBarLineDescription(const QvBarLine &barLine); // int CurrentBarLineId; int CurrentBarPageId;