From fd05f01be60128e70b7e53d566627c9e84b6a98d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 8 Sep 2019 03:31:49 +1000 Subject: Partially revert "Cleanup: use post increment/decrement" This partially reverts commit 0b2d1badecc48b5cbff5ec088b29c6e9acc5e1d0 Post increment can deep-copy for C++ iterators, while in my own checks GCC was able to optimize this to get the same output, better follow C++ best practice and use pre-increment for iterators. --- source/blender/collada/AnimationExporter.cpp | 6 +++--- source/blender/collada/BCAnimationSampler.cpp | 24 ++++++++++++------------ source/blender/collada/BCAnimationSampler.h | 4 ++-- source/blender/collada/BCSampleData.cpp | 4 ++-- source/blender/collada/ControllerExporter.cpp | 6 +++--- source/blender/collada/collada_utils.cpp | 4 ++-- 6 files changed, 24 insertions(+), 24 deletions(-) (limited to 'source/blender/collada') diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index c2ba397131c..9d0d075cade 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -100,7 +100,7 @@ bool AnimationExporter::exportAnimations() openLibrary(); BCObjectSet::iterator it; - for (it = animated_subset.begin(); it != animated_subset.end(); it++) { + for (it = animated_subset.begin(); it != animated_subset.end(); ++it) { Object *ob = *it; exportAnimation(ob, animation_sampler); } @@ -183,7 +183,7 @@ void AnimationExporter::export_curve_animation_set(Object *ob, bool keep_flat_curves = this->export_settings.get_keep_flat_curves(); BCAnimationCurveMap::iterator it; - for (it = curves->begin(); it != curves->end(); it++) { + for (it = curves->begin(); it != curves->end(); ++it) { BCAnimationCurve &curve = *it->second; std::string channel_type = curve.get_channel_type(); if (channel_type == "rotation_quaternion") { @@ -310,7 +310,7 @@ BCAnimationCurve *AnimationExporter::get_modified_export_curve(Object *ob, } BCValueMap::const_iterator vit; - for (vit = lens_values.begin(); vit != lens_values.end(); vit++) { + for (vit = lens_values.begin(); vit != lens_values.end(); ++vit) { int frame = vit->first; float lens_value = vit->second; diff --git a/source/blender/collada/BCAnimationSampler.cpp b/source/blender/collada/BCAnimationSampler.cpp index d1f59125790..5262d0b3672 100644 --- a/source/blender/collada/BCAnimationSampler.cpp +++ b/source/blender/collada/BCAnimationSampler.cpp @@ -49,7 +49,7 @@ BCAnimationSampler::BCAnimationSampler(BCExportSettings &export_settings, BCObje : export_settings(export_settings) { BCObjectSet::iterator it; - for (it = object_set.begin(); it != object_set.end(); it++) { + for (it = object_set.begin(); it != object_set.end(); ++it) { Object *ob = *it; add_object(ob); } @@ -58,7 +58,7 @@ BCAnimationSampler::BCAnimationSampler(BCExportSettings &export_settings, BCObje BCAnimationSampler::~BCAnimationSampler() { BCAnimationObjectMap::iterator it; - for (it = objects.begin(); it != objects.end(); it++) { + for (it = objects.begin(); it != objects.end(); ++it) { BCAnimation *animation = it->second; delete animation; } @@ -146,7 +146,7 @@ void BCAnimationSampler::update_animation_curves(BCAnimation &animation, int frame) { BCAnimationCurveMap::iterator it; - for (it = animation.curve_map.begin(); it != animation.curve_map.end(); it++) { + for (it = animation.curve_map.begin(); it != animation.curve_map.end(); ++it) { BCAnimationCurve *curve = it->second; if (curve->is_transform_curve()) { curve->add_value_from_matrix(sample, frame); @@ -212,7 +212,7 @@ void BCAnimationSampler::sample_scene(BCExportSettings &export_settings, bool ke } BCAnimationObjectMap::iterator obit; - for (obit = objects.begin(); obit != objects.end(); obit++) { + for (obit = objects.begin(); obit != objects.end(); ++obit) { Object *ob = obit->first; BCAnimation *animation = obit->second; BCFrameSet &object_keyframes = animation->frame_set; @@ -268,7 +268,7 @@ void BCAnimationSampler::find_depending_animated(std::set &animated_ob do { found_more = false; std::set::iterator it; - for (it = candidates.begin(); it != candidates.end(); it++) { + for (it = candidates.begin(); it != candidates.end(); ++it) { Object *cob = *it; ListBase *conlist = get_active_constraints(cob); if (is_animated_by_constraint(cob, conlist, animated_objects)) { @@ -353,7 +353,7 @@ void BCAnimationSampler::add_value_set(BCAnimationCurve &curve, const BC_animation_transform_type tm_type = curve.get_transform_type(); BCFrameSampleMap::iterator it; - for (it = samples.begin(); it != samples.end(); it++) { + for (it = samples.begin(); it != samples.end(); ++it) { const int frame_index = nearbyint(it->first); if (animation_type == BC_ANIMATION_EXPORT_SAMPLES || curve.is_keyframe(frame_index)) { @@ -585,7 +585,7 @@ const int BCSampleFrameContainer::get_frames(std::vector &frames) const { frames.clear(); // safety; BCSampleFrameMap::const_iterator it; - for (it = sample_frames.begin(); it != sample_frames.end(); it++) { + for (it = sample_frames.begin(); it != sample_frames.end(); ++it) { frames.push_back(it->first); } return frames.size(); @@ -595,7 +595,7 @@ const int BCSampleFrameContainer::get_frames(Object *ob, BCFrames &frames) const { frames.clear(); // safety; BCSampleFrameMap::const_iterator it; - for (it = sample_frames.begin(); it != sample_frames.end(); it++) { + for (it = sample_frames.begin(); it != sample_frames.end(); ++it) { const BCSampleFrame &frame = it->second; if (frame.has_sample_for(ob)) { frames.push_back(it->first); @@ -608,7 +608,7 @@ const int BCSampleFrameContainer::get_frames(Object *ob, Bone *bone, BCFrames &f { frames.clear(); // safety; BCSampleFrameMap::const_iterator it; - for (it = sample_frames.begin(); it != sample_frames.end(); it++) { + for (it = sample_frames.begin(); it != sample_frames.end(); ++it) { const BCSampleFrame &frame = it->second; if (frame.has_sample_for(ob, bone)) { frames.push_back(it->first); @@ -621,7 +621,7 @@ const int BCSampleFrameContainer::get_samples(Object *ob, BCFrameSampleMap &samp { samples.clear(); // safety; BCSampleFrameMap::const_iterator it; - for (it = sample_frames.begin(); it != sample_frames.end(); it++) { + for (it = sample_frames.begin(); it != sample_frames.end(); ++it) { const BCSampleFrame &frame = it->second; const BCSample *sample = frame.get_sample(ob); if (sample) { @@ -635,7 +635,7 @@ const int BCSampleFrameContainer::get_matrices(Object *ob, BCMatrixSampleMap &sa { samples.clear(); // safety; BCSampleFrameMap::const_iterator it; - for (it = sample_frames.begin(); it != sample_frames.end(); it++) { + for (it = sample_frames.begin(); it != sample_frames.end(); ++it) { const BCSampleFrame &frame = it->second; const BCMatrix *matrix = frame.get_sample_matrix(ob); if (matrix) { @@ -651,7 +651,7 @@ const int BCSampleFrameContainer::get_matrices(Object *ob, { samples.clear(); // safety; BCSampleFrameMap::const_iterator it; - for (it = sample_frames.begin(); it != sample_frames.end(); it++) { + for (it = sample_frames.begin(); it != sample_frames.end(); ++it) { const BCSampleFrame &frame = it->second; const BCMatrix *sample = frame.get_sample_matrix(ob, bone); if (sample) { diff --git a/source/blender/collada/BCAnimationSampler.h b/source/blender/collada/BCAnimationSampler.h index 3d156134260..e8d2ab56ae7 100644 --- a/source/blender/collada/BCAnimationSampler.h +++ b/source/blender/collada/BCAnimationSampler.h @@ -47,7 +47,7 @@ class BCAnimation { ~BCAnimation() { BCAnimationCurveMap::iterator it; - for (it = curve_map.begin(); it != curve_map.end(); it++) { + for (it = curve_map.begin(); it != curve_map.end(); ++it) { delete it->second; } @@ -79,7 +79,7 @@ class BCSampleFrame { ~BCSampleFrame() { BCSampleMap::iterator it; - for (it = sampleMap.begin(); it != sampleMap.end(); it++) { + for (it = sampleMap.begin(); it != sampleMap.end(); ++it) { BCSample *sample = it->second; delete sample; } diff --git a/source/blender/collada/BCSampleData.cpp b/source/blender/collada/BCSampleData.cpp index 4ef13621c97..7e23a2de00f 100644 --- a/source/blender/collada/BCSampleData.cpp +++ b/source/blender/collada/BCSampleData.cpp @@ -23,7 +23,7 @@ BCSample::~BCSample() { BCBoneMatrixMap::iterator it; - for (it = bonemats.begin(); it != bonemats.end(); it++) { + for (it = bonemats.begin(); it != bonemats.end(); ++it) { delete it->second; } } @@ -50,7 +50,7 @@ const bool BCSample::get_value(std::string channel_target, const int array_index bname = bname.substr(2); bname = bc_string_before(bname, "\""); BCBoneMatrixMap::const_iterator it; - for (it = bonemats.begin(); it != bonemats.end(); it++) { + for (it = bonemats.begin(); it != bonemats.end(); ++it) { Bone *bone = it->first; if (bname == bone->name) { matrix = it->second; diff --git a/source/blender/collada/ControllerExporter.cpp b/source/blender/collada/ControllerExporter.cpp index 61835f448ee..bfec387a199 100644 --- a/source/blender/collada/ControllerExporter.cpp +++ b/source/blender/collada/ControllerExporter.cpp @@ -265,7 +265,7 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm) if (sumw > 0.0f) { float invsumw = 1.0f / sumw; vcounts.push_back(jw.size()); - for (std::map::iterator m = jw.begin(); m != jw.end(); m++) { + for (std::map::iterator m = jw.begin(); m != jw.end(); ++m) { joints.push_back((*m).first); weights.push_back(invsumw * (*m).second); } @@ -616,7 +616,7 @@ std::string ControllerExporter::add_weights_source(Mesh *me, source.prepareToAppendValues(); - for (std::list::const_iterator i = weights.begin(); i != weights.end(); i++) { + for (std::list::const_iterator i = weights.begin(); i != weights.end(); ++i) { source.appendValues(*i); } @@ -658,7 +658,7 @@ void ControllerExporter::add_vertex_weights_element(const std::string &weights_s /* write deformer index - weight index pairs */ int weight_index = 0; - for (std::list::const_iterator i = joints.begin(); i != joints.end(); i++) { + for (std::list::const_iterator i = joints.begin(); i != joints.end(); ++i) { weightselem.appendValues(*i, weight_index++); } diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp index f740fcee664..dd5611c4bef 100644 --- a/source/blender/collada/collada_utils.cpp +++ b/source/blender/collada/collada_utils.cpp @@ -525,7 +525,7 @@ BoneExtensionMap &BoneExtensionManager::getExtensionMap(bArmature *armature) BoneExtensionManager::~BoneExtensionManager() { std::map::iterator map_it; - for (map_it = extended_bone_maps.begin(); map_it != extended_bone_maps.end(); map_it++) { + for (map_it = extended_bone_maps.begin(); map_it != extended_bone_maps.end(); ++map_it) { BoneExtensionMap *extended_bones = map_it->second; for (BoneExtensionMap::iterator ext_it = extended_bones->begin(); ext_it != extended_bones->end(); @@ -916,7 +916,7 @@ bool bc_is_animated(BCMatrixSampleMap &values) BCMatrixSampleMap::iterator it; const BCMatrix *refmat = NULL; - for (it = values.begin(); it != values.end(); it++) { + for (it = values.begin(); it != values.end(); ++it) { const BCMatrix *matrix = it->second; if (refmat == NULL) { -- cgit v1.2.3