Skip to content

Commit

Permalink
fix clang tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
vcloarec committed May 25, 2023
1 parent c48f5a7 commit 816dd58
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions mdal/3rdparty/libplyxx/libplyxx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ namespace libply
const std::vector<PropertyDefinition> properties = elementDefinition.properties;
size_t t_idx = 0;
size_t e_idx = 0;
for ( PropertyDefinition p : properties )
for ( const PropertyDefinition &p : properties )
{
if ( t_idx == m_tokens.size() || e_idx == elementBuffer.size() )
{
Expand Down Expand Up @@ -378,7 +378,7 @@ namespace libply
char buffer[MAX_PROPERTY_SIZE];
size_t e_idx = 0;

for ( PropertyDefinition p : properties )
for ( const PropertyDefinition &p : properties )
{
uint32_t endian;
if ( format == File::Format::BINARY_LITTLE_ENDIAN )
Expand All @@ -403,7 +403,7 @@ namespace libply
const auto lengthType = p.listLengthType;
const auto lengthTypeSize = TYPE_SIZE_MAP.at( lengthType );
fs.read( buffer, lengthTypeSize );
size_t listLength = static_cast<size_t>( *buffer );
size_t listLength = static_cast<size_t>( static_cast<unsigned long>( *buffer ) );

ListProperty *lp = dynamic_cast<ListProperty *>( &elementBuffer[e_idx] );
lp->define( p.type, listLength );
Expand Down Expand Up @@ -512,8 +512,9 @@ namespace libply
case Type::UINT32: return "uint";
case Type::INT32: return "int";
case Type::FLOAT32: return "float";
case Type::FLOAT64: return "double";
case Type::COORDINATE: return "double";
case Type::FLOAT64:
case Type::COORDINATE:
return "double";
}
return "";
}
Expand Down Expand Up @@ -545,7 +546,7 @@ namespace libply
std::stringstream ss;
const std::vector<PropertyDefinition> properties = elementDefinition.properties;
size_t e_idx = 0;
for ( PropertyDefinition p : properties )
for ( const PropertyDefinition &p : properties )
{
if ( !p.isList )
{
Expand Down Expand Up @@ -597,7 +598,7 @@ namespace libply
auto &cast = p.writeCastFunction;
size_t write_size;
cast( buffer[e_idx], write_buffer, write_size, endian );
file.write( reinterpret_cast<char *>( write_buffer ), write_size );
file.write( reinterpret_cast<char *>( write_buffer ), static_cast<std::streamsize>( write_size ) );
e_idx++;
}
else
Expand All @@ -610,7 +611,7 @@ namespace libply
{
size_t write_size;
cast( lp->value( i ), write_buffer, write_size, endian );
file.write( reinterpret_cast<char *>( write_buffer ), write_size );
file.write( reinterpret_cast<char *>( write_buffer ), static_cast<std::streamsize>( write_size ) );
}
e_idx++;
}
Expand Down

0 comments on commit 816dd58

Please sign in to comment.