diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-09-07 20:31:49 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-09-07 21:08:10 +0300 |
commit | fd05f01be60128e70b7e53d566627c9e84b6a98d (patch) | |
tree | c49680b53d0a689e7a8766674e0bec3bc1207908 /source/blender/alembic/intern | |
parent | abeab4fcad6635e6932f5719918338414a20c726 (diff) |
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.
Diffstat (limited to 'source/blender/alembic/intern')
-rw-r--r-- | source/blender/alembic/intern/abc_exporter.cc | 8 | ||||
-rw-r--r-- | source/blender/alembic/intern/abc_mesh.cc | 6 | ||||
-rw-r--r-- | source/blender/alembic/intern/abc_nurbs.cc | 4 | ||||
-rw-r--r-- | source/blender/alembic/intern/alembic_capi.cc | 14 |
4 files changed, 16 insertions, 16 deletions
diff --git a/source/blender/alembic/intern/abc_exporter.cc b/source/blender/alembic/intern/abc_exporter.cc index 9c1909b6022..a7549cc1f47 100644 --- a/source/blender/alembic/intern/abc_exporter.cc +++ b/source/blender/alembic/intern/abc_exporter.cc @@ -197,7 +197,7 @@ AbcExporter::~AbcExporter() { /* Free xforms map */ m_xforms_type::iterator it_x, e_x; - for (it_x = m_xforms.begin(), e_x = m_xforms.end(); it_x != e_x; it_x++) { + for (it_x = m_xforms.begin(), e_x = m_xforms.end(); it_x != e_x; ++it_x) { delete it_x->second; } @@ -331,7 +331,7 @@ void AbcExporter::operator()(float &progress, bool &was_canceled) const float size = static_cast<float>(frames.size()); size_t i = 0; - for (; begin != end; begin++) { + for (; begin != end; ++begin) { progress = (++i / size); if (G.is_break) { @@ -355,14 +355,14 @@ void AbcExporter::operator()(float &progress, bool &was_canceled) } m_xforms_type::iterator xit, xe; - for (xit = m_xforms.begin(), xe = m_xforms.end(); xit != xe; xit++) { + for (xit = m_xforms.begin(), xe = m_xforms.end(); xit != xe; ++xit) { xit->second->write(); } /* Save the archive 's bounding box. */ Imath::Box3d bounds; - for (xit = m_xforms.begin(), xe = m_xforms.end(); xit != xe; xit++) { + for (xit = m_xforms.begin(), xe = m_xforms.end(); xit != xe; ++xit) { Imath::Box3d box = xit->second->bounds(); bounds.extendBy(box); } diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc index 92de3547fd2..5de21075a23 100644 --- a/source/blender/alembic/intern/abc_mesh.cc +++ b/source/blender/alembic/intern/abc_mesh.cc @@ -525,7 +525,7 @@ template<typename Schema> void AbcGenericMeshWriter::writeFaceSets(struct Mesh * getGeoGroups(me, geo_groups); std::map<std::string, std::vector<int32_t>>::iterator it; - for (it = geo_groups.begin(); it != geo_groups.end(); it++) { + for (it = geo_groups.begin(); it != geo_groups.end(); ++it) { OFaceSet face_set = schema.createFaceSet(it->first); OFaceSetSchema::Sample samp; samp.setFaces(Int32ArraySample(it->second)); @@ -707,7 +707,7 @@ static void assign_materials(Main *bmain, std::map<std::string, int>::const_iterator it = mat_index_map.begin(); int matcount = 0; - for (; it != mat_index_map.end(); it++, matcount++) { + for (; it != mat_index_map.end(); ++it, matcount++) { if (!BKE_object_material_slot_add(bmain, ob)) { can_assign = false; break; @@ -723,7 +723,7 @@ static void assign_materials(Main *bmain, if (can_assign) { it = mat_index_map.begin(); - for (; it != mat_index_map.end(); it++) { + for (; it != mat_index_map.end(); ++it) { std::string mat_name = it->first; mat_iter = mat_map.find(mat_name.c_str()); diff --git a/source/blender/alembic/intern/abc_nurbs.cc b/source/blender/alembic/intern/abc_nurbs.cc index f2d0a9f1e16..739276dffa6 100644 --- a/source/blender/alembic/intern/abc_nurbs.cc +++ b/source/blender/alembic/intern/abc_nurbs.cc @@ -208,7 +208,7 @@ bool AbcNurbsReader::valid() const } std::vector<std::pair<INuPatchSchema, IObject>>::const_iterator it; - for (it = m_schemas.begin(); it != m_schemas.end(); it++) { + for (it = m_schemas.begin(); it != m_schemas.end(); ++it) { const INuPatchSchema &schema = it->first; if (!schema.valid()) { @@ -243,7 +243,7 @@ void AbcNurbsReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSele std::vector<std::pair<INuPatchSchema, IObject>>::iterator it; - for (it = m_schemas.begin(); it != m_schemas.end(); it++) { + for (it = m_schemas.begin(); it != m_schemas.end(); ++it) { Nurb *nu = static_cast<Nurb *>(MEM_callocN(sizeof(Nurb), "abc_getnurb")); nu->flag = CU_SMOOTH; nu->type = CU_NURBS; diff --git a/source/blender/alembic/intern/alembic_capi.cc b/source/blender/alembic/intern/alembic_capi.cc index ffe58f7976f..13533ef9972 100644 --- a/source/blender/alembic/intern/alembic_capi.cc +++ b/source/blender/alembic/intern/alembic_capi.cc @@ -211,7 +211,7 @@ static void find_iobject(const IObject &object, IObject &ret, const std::string IObject tmp = object; std::vector<std::string>::iterator iter; - for (iter = tokens.begin(); iter != tokens.end(); iter++) { + for (iter = tokens.begin(); iter != tokens.end(); ++iter) { IObject child = tmp.getChild(*iter); tmp = child; } @@ -704,7 +704,7 @@ static void import_startjob(void *user_data, short *stop, short *do_update, floa ISampleSelector sample_sel(0.0f); std::vector<AbcObjectReader *>::iterator iter; - for (iter = data->readers.begin(); iter != data->readers.end(); iter++) { + for (iter = data->readers.begin(); iter != data->readers.end(); ++iter) { AbcObjectReader *reader = *iter; if (reader->valid()) { @@ -743,7 +743,7 @@ static void import_startjob(void *user_data, short *stop, short *do_update, floa } /* Setup parenthood. */ - for (iter = data->readers.begin(); iter != data->readers.end(); iter++) { + for (iter = data->readers.begin(); iter != data->readers.end(); ++iter) { const AbcObjectReader *reader = *iter; const AbcObjectReader *parent_reader = reader->parent_reader; Object *ob = reader->object(); @@ -758,7 +758,7 @@ static void import_startjob(void *user_data, short *stop, short *do_update, floa /* Setup transformations and constraints. */ i = 0; - for (iter = data->readers.begin(); iter != data->readers.end(); iter++) { + for (iter = data->readers.begin(); iter != data->readers.end(); ++iter) { AbcObjectReader *reader = *iter; reader->setupObjectTransform(0.0f); @@ -782,7 +782,7 @@ static void import_endjob(void *user_data) /* Delete objects on cancellation. */ if (data->was_cancelled) { - for (iter = data->readers.begin(); iter != data->readers.end(); iter++) { + for (iter = data->readers.begin(); iter != data->readers.end(); ++iter) { Object *ob = (*iter)->object(); /* It's possible that cancellation occurred between the creation of @@ -804,7 +804,7 @@ static void import_endjob(void *user_data) lc = BKE_layer_collection_get_active(view_layer); - for (iter = data->readers.begin(); iter != data->readers.end(); iter++) { + for (iter = data->readers.begin(); iter != data->readers.end(); ++iter) { Object *ob = (*iter)->object(); BKE_collection_object_add(data->bmain, lc->collection, ob); @@ -824,7 +824,7 @@ static void import_endjob(void *user_data) DEG_relations_tag_update(data->bmain); } - for (iter = data->readers.begin(); iter != data->readers.end(); iter++) { + for (iter = data->readers.begin(); iter != data->readers.end(); ++iter) { AbcObjectReader *reader = *iter; reader->decref(); |