diff options
author | Rider Linden <rider@lindenlab.com> | 2018-02-09 10:10:13 -0800 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2018-02-09 10:10:13 -0800 |
commit | e9edd37cdb39639e1ab24e2e63d4f83432282c88 (patch) | |
tree | 0419dd92b74a107836e66d29a7189a1a81ba50c7 /indra/llinventory | |
parent | 7838189843ff3b9c800e458b2452943edbc202ea (diff) |
Update a couple constructs
Diffstat (limited to 'indra/llinventory')
-rw-r--r-- | indra/llinventory/llsettingsbase.cpp | 81 | ||||
-rw-r--r-- | indra/llinventory/llsettingsdaycycle.cpp | 20 |
2 files changed, 16 insertions, 85 deletions
diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index ffeae8677f..7ade345168 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -262,57 +262,6 @@ size_t LLSettingsBase::getHash() const return boost::hash<LLSD>{}(hash_settings); } -#ifdef VALIDATION_DEBUG -namespace -{ - bool compare_llsd(LLSD valA, LLSD valB) - { - if (valA.type() != valB.type()) - return false; - - switch (valA.type()) - { - // case LLSD::TypeMap: - // newSettings[key_name] = combineSDMaps(value, LLSD()); - // break; - case LLSD::TypeArray: - if (valA.size() != valB.size()) - return false; - - for (S32 idx = 0; idx < valA.size(); ++idx) - { - if (!compare_llsd(valA[idx], valB[idx])) - return false; - } - return true; - - case LLSD::TypeInteger: - return valA.asInteger() == valB.asInteger(); - - case LLSD::TypeReal: - return is_approx_equal(valA.asReal(), valB.asReal()); - - case LLSD::TypeBoolean: - return valA.asBoolean() == valB.asBoolean(); - - case LLSD::TypeString: - return valA.asString() == valB.asString(); - - case LLSD::TypeUUID: - return valA.asUUID() == valB.asUUID(); - - case LLSD::TypeURI: - return valA.asString() == valB.asString(); - - case LLSD::TypeDate: - return valA.asDate() == valB.asDate(); - } - - return true; - } -} -#endif - bool LLSettingsBase::validate() { validation_list_t validations = getValidationList(); @@ -378,35 +327,17 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida validated.insert(validateType.getName()); // Fields for specific settings. - for (validation_list_t::iterator itv = validations.begin(); itv != validations.end(); ++itv) + for (auto &test: validations) { -#ifdef VALIDATION_DEBUG - LLSD oldvalue; - if (settings.has((*itv).getName())) - { - oldvalue = llsd_clone(mSettings[(*itv).getName()]); - } -#endif - - if (!(*itv).verify(settings)) + if (!test.verify(settings)) { std::stringstream errtext; - errtext << "Settings LLSD fails validation and could not be corrected for '" << (*itv).getName() << "'!"; + errtext << "Settings LLSD fails validation and could not be corrected for '" << test.getName() << "'!"; errors.append( errtext.str() ); isValid = false; } - validated.insert((*itv).getName()); - -#ifdef VALIDATION_DEBUG - if (!oldvalue.isUndefined()) - { - if (!compare_llsd(settings[(*itv).getName()], oldvalue)) - { - LL_WARNS("SETTINGS") << "Setting '" << (*itv).getName() << "' was changed: " << oldvalue << " -> " << settings[(*itv).getName()] << LL_ENDL; - } - } -#endif + validated.insert(test.getName()); } // strip extra entries @@ -422,9 +353,9 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida } } - for (stringset_t::iterator its = strip.begin(); its != strip.end(); ++its) + for (const std::string &its: strip) { - settings.erase(*its); + settings.erase(its); } return LLSDMap("success", LLSD::Boolean(isValid)) diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 3abf76175f..a689dd3710 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -131,20 +131,20 @@ LLSD LLSettingsDay::getSettings() const LLSD tracks(LLSD::emptyArray()); - for (CycleList_t::const_iterator itTrack = mDayTracks.begin(); itTrack != mDayTracks.end(); ++itTrack) + for (auto &track: mDayTracks) { LLSD trackout(LLSD::emptyArray()); - for (CycleTrack_t::const_iterator itFrame = (*itTrack).begin(); itFrame != (*itTrack).end(); ++itFrame) + for (auto &frame: track) { - F32 frame = (*itFrame).first; - LLSettingsBase::ptr_t data = (*itFrame).second; + F32 frame_time = frame.first; + LLSettingsBase::ptr_t data = frame.second; size_t datahash = data->getHash(); std::stringstream keyname; keyname << datahash; - trackout.append(LLSD(LLSDMap(SETTING_KEYKFRAME, LLSD::Real(frame))(SETTING_KEYNAME, keyname.str()))); + trackout.append(LLSD(LLSDMap(SETTING_KEYKFRAME, LLSD::Real(frame_time))(SETTING_KEYNAME, keyname.str()))); in_use[keyname.str()] = data; } tracks.append(trackout); @@ -152,12 +152,12 @@ LLSD LLSettingsDay::getSettings() const settings[SETTING_TRACKS] = tracks; LLSD frames(LLSD::emptyMap()); - for (std::map<std::string, LLSettingsBase::ptr_t>::iterator itFrame = in_use.begin(); itFrame != in_use.end(); ++itFrame) + for (auto &used_frame: in_use) { - LLSD framesettings = llsd_clone((*itFrame).second->getSettings(), + LLSD framesettings = llsd_clone(used_frame.second->getSettings(), LLSDMap("*", true)(SETTING_NAME, false)(SETTING_ID, false)(SETTING_HASH, false)); - frames[(*itFrame).first] = framesettings; + frames[used_frame.first] = framesettings; } settings[SETTING_FRAMES] = frames; @@ -465,9 +465,9 @@ LLSettingsDay::KeyframeList_t LLSettingsDay::getTrackKeyframes(S32 trackno) keyframes.reserve(track.size()); - for (CycleTrack_t::iterator it = track.begin(); it != track.end(); ++it) + for (auto &frame: track) { - keyframes.push_back((*it).first); + keyframes.push_back(frame.first); } return keyframes; |