diff --git a/mdal/3rdparty/libplyxx/libplyxx.cpp b/mdal/3rdparty/libplyxx/libplyxx.cpp index e21c16ba..91777011 100644 --- a/mdal/3rdparty/libplyxx/libplyxx.cpp +++ b/mdal/3rdparty/libplyxx/libplyxx.cpp @@ -51,8 +51,8 @@ SOFTWARE. #include #include -#define BIG_ENDIAN 1 -#define LITTLE_ENDIAN 0 +#define PLYXX_BIG_ENDIAN 1 +#define PLYXX_LITTLE_ENDIAN 0 namespace libply { @@ -337,7 +337,7 @@ namespace libply const std::vector 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() ) { @@ -378,16 +378,16 @@ 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 ) { - endian = LITTLE_ENDIAN; + endian = PLYXX_LITTLE_ENDIAN; } else { - endian = BIG_ENDIAN; + endian = PLYXX_BIG_ENDIAN; } if ( !p.isList ) { @@ -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( *buffer ); + size_t listLength = static_cast( static_cast( *buffer ) ); ListProperty *lp = dynamic_cast( &elementBuffer[e_idx] ); lp->define( p.type, listLength ); @@ -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 ""; } @@ -545,7 +546,7 @@ namespace libply std::stringstream ss; const std::vector properties = elementDefinition.properties; size_t e_idx = 0; - for ( PropertyDefinition p : properties ) + for ( const PropertyDefinition &p : properties ) { if ( !p.isList ) { @@ -581,11 +582,11 @@ namespace libply if ( format == File::Format::BINARY_LITTLE_ENDIAN ) { - endian = LITTLE_ENDIAN; + endian = PLYXX_LITTLE_ENDIAN; } else { - endian = BIG_ENDIAN; + endian = PLYXX_BIG_ENDIAN; } const std::vector properties = elementDefinition.properties; @@ -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( write_buffer ), write_size ); + file.write( reinterpret_cast( write_buffer ), static_cast( write_size ) ); e_idx++; } else @@ -610,7 +611,7 @@ namespace libply { size_t write_size; cast( lp->value( i ), write_buffer, write_size, endian ); - file.write( reinterpret_cast( write_buffer ), write_size ); + file.write( reinterpret_cast( write_buffer ), static_cast( write_size ) ); } e_idx++; } diff --git a/mdal/3rdparty/libplyxx/libplyxx_internal.h b/mdal/3rdparty/libplyxx/libplyxx_internal.h index c74de42c..75e9fadd 100644 --- a/mdal/3rdparty/libplyxx/libplyxx_internal.h +++ b/mdal/3rdparty/libplyxx/libplyxx_internal.h @@ -115,8 +115,8 @@ namespace libply t.quad = 1; if ( t.islittle ^ endian ) return w; - auto ptr = reinterpret_cast( &w ); - std::array raw_src, raw_dst; + auto ptr = reinterpret_cast( &w ); + std::array raw_src, raw_dst; for ( std::size_t i = 0; i < sizeof( T ); ++i ) raw_src[i] = ptr[i];