Fixed all swap shadowing variables

This commit is contained in:
Jan Möbius
2023-08-22 16:47:00 +02:00
parent e3bd67d6c9
commit 0182ada6ff
3 changed files with 13 additions and 14 deletions

View File

@@ -140,8 +140,7 @@ _OFFReader_::read(std::istream& _in, BaseImporter& _bi, Options& _opt )
} }
// filter relevant options for reading // filter relevant options for reading
bool swap = _opt.check( Options::Swap ); bool swap_required = _opt.check( Options::Swap );
userOptions_ = _opt; userOptions_ = _opt;
@@ -159,7 +158,7 @@ _OFFReader_::read(std::istream& _in, BaseImporter& _bi, Options& _opt )
options_ += Options::ColorAlpha; options_ += Options::ColorAlpha;
return (options_.is_binary() ? return (options_.is_binary() ?
read_binary(_in, _bi, _opt, swap) : read_binary(_in, _bi, _opt, swap_required) :
read_ascii(_in, _bi, _opt)); read_ascii(_in, _bi, _opt));
} }

View File

@@ -166,12 +166,12 @@ bool _OMReader_::read_ascii(std::istream& /* _is */, BaseImporter& /* _bi */, Op
bool _OMReader_::read_binary(std::istream& _is, BaseImporter& _bi, Options& _opt) const bool _OMReader_::read_binary(std::istream& _is, BaseImporter& _bi, Options& _opt) const
{ {
bool swap = _opt.check(Options::Swap) || (Endian::local() == Endian::MSB); bool swap_required = _opt.check(Options::Swap) || (Endian::local() == Endian::MSB);
// Initialize byte counter // Initialize byte counter
bytes_ = 0; bytes_ = 0;
bytes_ += restore(_is, header_, swap); bytes_ += restore(_is, header_, swap_required);
if (header_.version_ > _OMWriter_::get_version()) if (header_.version_ > _OMWriter_::get_version())
@@ -183,7 +183,7 @@ bool _OMReader_::read_binary(std::istream& _is, BaseImporter& _bi, Options& _opt
} }
while (!_is.eof()) { while (!_is.eof()) {
bytes_ += restore(_is, chunk_header_, swap); bytes_ += restore(_is, chunk_header_, swap_required);
if (_is.eof()) if (_is.eof())
break; break;
@@ -191,30 +191,30 @@ bool _OMReader_::read_binary(std::istream& _is, BaseImporter& _bi, Options& _opt
// Is this a named property restore the name // Is this a named property restore the name
if (chunk_header_.name_) { if (chunk_header_.name_) {
OMFormat::Chunk::PropertyName pn; OMFormat::Chunk::PropertyName pn;
bytes_ += restore(_is, property_name_, swap); bytes_ += restore(_is, property_name_, swap_required);
} }
// Read in the property data. If it is an anonymous or unknown named // Read in the property data. If it is an anonymous or unknown named
// property, then skip data. // property, then skip data.
switch (chunk_header_.entity_) { switch (chunk_header_.entity_) {
case OMFormat::Chunk::Entity_Vertex: case OMFormat::Chunk::Entity_Vertex:
if (!read_binary_vertex_chunk(_is, _bi, _opt, swap)) if (!read_binary_vertex_chunk(_is, _bi, _opt, swap_required))
return false; return false;
break; break;
case OMFormat::Chunk::Entity_Face: case OMFormat::Chunk::Entity_Face:
if (!read_binary_face_chunk(_is, _bi, _opt, swap)) if (!read_binary_face_chunk(_is, _bi, _opt, swap_required))
return false; return false;
break; break;
case OMFormat::Chunk::Entity_Edge: case OMFormat::Chunk::Entity_Edge:
if (!read_binary_edge_chunk(_is, _bi, _opt, swap)) if (!read_binary_edge_chunk(_is, _bi, _opt, swap_required))
return false; return false;
break; break;
case OMFormat::Chunk::Entity_Halfedge: case OMFormat::Chunk::Entity_Halfedge:
if (!read_binary_halfedge_chunk(_is, _bi, _opt, swap)) if (!read_binary_halfedge_chunk(_is, _bi, _opt, swap_required))
return false; return false;
break; break;
case OMFormat::Chunk::Entity_Mesh: case OMFormat::Chunk::Entity_Mesh:
if (!read_binary_mesh_chunk(_is, _bi, _opt, swap)) if (!read_binary_mesh_chunk(_is, _bi, _opt, swap_required))
return false; return false;
break; break;
case OMFormat::Chunk::Entity_Sentinel: case OMFormat::Chunk::Entity_Sentinel:

View File

@@ -142,7 +142,7 @@ bool _PLYReader_::read(std::istream& _in, BaseImporter& _bi, Options& _opt) {
} }
// filter relevant options for reading // filter relevant options for reading
bool swap = _opt.check(Options::Swap); bool swap_required = _opt.check(Options::Swap);
userOptions_ = _opt; userOptions_ = _opt;
@@ -178,7 +178,7 @@ bool _PLYReader_::read(std::istream& _in, BaseImporter& _bi, Options& _opt) {
// if ( options_.is_binary() && userOptions_.color_has_alpha() ) // if ( options_.is_binary() && userOptions_.color_has_alpha() )
// options_ += Options::ColorAlpha; // options_ += Options::ColorAlpha;
return (options_.is_binary() ? read_binary(_in, _bi, swap, _opt) : read_ascii(_in, _bi, _opt)); return (options_.is_binary() ? read_binary(_in, _bi, swap_required, _opt) : read_ascii(_in, _bi, _opt));
} }