From 5ddd9d0c977bea070008baefdb452e808077f98c Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 16 Aug 2018 21:38:49 +0100 Subject: Make settings vfuncs use SETTINGS_OVERRIDE macro (override keyword in viewer codebase) to fix OS X compilation. Mark cloning funcs and derived class overrides as const. --- indra/newview/llsettingsvo.cpp | 8 ++++---- indra/newview/llsettingsvo.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index b9eb1fd5c6..c410f0d955 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -485,7 +485,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildDefaultSky() return skyp; } -LLSettingsSky::ptr_t LLSettingsVOSky::buildClone() +LLSettingsSky::ptr_t LLSettingsVOSky::buildClone() const { LLSD settings = cloneSettings(); @@ -736,7 +736,7 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildDefaultWater() return waterp; } -LLSettingsWater::ptr_t LLSettingsVOWater::buildClone() +LLSettingsWater::ptr_t LLSettingsVOWater::buildClone() const { LLSD settings = cloneSettings(); LLSettingsWater::validation_list_t validations = LLSettingsWater::validationList(); @@ -1074,7 +1074,7 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromEnvironmentMessage(LLSD settings) } -LLSettingsDay::ptr_t LLSettingsVODay::buildClone() +LLSettingsDay::ptr_t LLSettingsVODay::buildClone() const { LLSD settings = cloneSettings(); @@ -1092,7 +1092,7 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildClone() return dayp; } -LLSettingsDay::ptr_t LLSettingsVODay::buildDeepCloneAndUncompress() +LLSettingsDay::ptr_t LLSettingsVODay::buildDeepCloneAndUncompress() const { // no need for SETTING_TRACKS or SETTING_FRAMES, so take base LLSD LLSD settings = llsd_clone(mSettings); diff --git a/indra/newview/llsettingsvo.h b/indra/newview/llsettingsvo.h index fedb758b48..5431a5d027 100644 --- a/indra/newview/llsettingsvo.h +++ b/indra/newview/llsettingsvo.h @@ -89,7 +89,7 @@ public: static ptr_t buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings); static ptr_t buildDefaultSky(); - virtual ptr_t buildClone() override; + virtual ptr_t buildClone() const SETTINGS_OVERRIDE; static ptr_t buildFromLegacyPresetFile(const std::string &name, const std::string &path); @@ -123,7 +123,7 @@ public: static ptr_t buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings); static ptr_t buildDefaultWater(); - virtual ptr_t buildClone() override; + virtual ptr_t buildClone() const SETTINGS_OVERRIDE; static ptr_t buildFromLegacyPresetFile(const std::string &name, const std::string &path); @@ -155,8 +155,8 @@ public: static ptr_t buildFromLegacyMessage(const LLUUID ®ionId, LLSD daycycle, LLSD skys, LLSD water); static ptr_t buildDefaultDayCycle(); static ptr_t buildFromEnvironmentMessage(LLSD settings); - virtual ptr_t buildClone() override; - virtual ptr_t buildDeepCloneAndUncompress(); + virtual ptr_t buildClone() const SETTINGS_OVERRIDE; + virtual ptr_t buildDeepCloneAndUncompress() const SETTINGS_OVERRIDE; static LLSD convertToLegacy(const ptr_t &); -- cgit v1.3 From 597d28ad343d39f0812f7403119cc817dfab3d64 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 16 Aug 2018 22:00:53 +0100 Subject: Fix constness of LLSettingsVODay::buildDeepCloneAndUncompress. --- indra/llinventory/llsettingsdaycycle.cpp | 11 ++++++++++- indra/llinventory/llsettingsdaycycle.h | 1 + indra/newview/llsettingsvo.cpp | 4 ++-- 3 files changed, 13 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 4a99be0c4b..8ca4ca4a6d 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -593,7 +593,16 @@ LLSettingsDay::validation_list_t LLSettingsDay::validationList() return validation; } -LLSettingsDay::CycleTrack_t &LLSettingsDay::getCycleTrack(S32 track) +LLSettingsDay::CycleTrack_t& LLSettingsDay::getCycleTrack(S32 track) +{ + static CycleTrack_t emptyTrack; + if (mDayTracks.size() <= track) + return emptyTrack; + + return mDayTracks[track]; +} + +const LLSettingsDay::CycleTrack_t& LLSettingsDay::getCycleTrackConst(S32 track) const { static CycleTrack_t emptyTrack; if (mDayTracks.size() <= track) diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 878eec8301..46dc0cec74 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -118,6 +118,7 @@ public: void setInitialized(bool value = true) { mInitialized = value; } CycleTrack_t & getCycleTrack(S32 track); + const CycleTrack_t & getCycleTrackConst(S32 track) const; bool clearCycleTrack(S32 track); bool replaceCycleTrack(S32 track, const CycleTrack_t &source); bool isTrackEmpty(S32 track) const; diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index c410f0d955..ef74ecf46f 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -1101,8 +1101,8 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildDeepCloneAndUncompress() const for (S32 i = 0; i < LLSettingsDay::TRACK_MAX; ++i) { - LLSettingsDay::CycleTrack_t track = getCycleTrack(i); - LLSettingsDay::CycleTrack_t::iterator iter = track.begin(); + const LLSettingsDay::CycleTrack_t& track = getCycleTrackConst(i); + LLSettingsDay::CycleTrack_t::const_iterator iter = track.begin(); while (iter != track.end()) { // 'Unpack', usually for editing -- cgit v1.3