Skip to content

Commit

Permalink
{format} Update to clang-format 18 & reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
asmaloney committed Apr 20, 2024
1 parent f940d04 commit f5c58ed
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/format-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ jobs:
- name: Run clang-format style check
uses: jidicula/[email protected]
with:
clang-format-version: '15'
clang-format-version: '18'
exclude-regex: 'extern'
3 changes: 1 addition & 2 deletions include/E57Exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,7 @@ namespace e57
E57Exception() = delete;
E57Exception( ErrorCode ecode, std::string context, const char *srcFileName = nullptr,
int srcLineNumber = 0, const char *srcFunctionName = nullptr ) :
errorCode_( ecode ),
context_( std::move( context ) ), sourceFileName_( srcFileName ),
errorCode_( ecode ), context_( std::move( context ) ), sourceFileName_( srcFileName ),
sourceFunctionName_( srcFunctionName ), sourceLineNumber_( srcLineNumber )
{
}
Expand Down
6 changes: 2 additions & 4 deletions src/BlobNodeImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ namespace e57
}

BlobNodeImpl::BlobNodeImpl( ImageFileImplWeakPtr destImageFile, int64_t fileOffset,
int64_t length ) :
NodeImpl( destImageFile )
int64_t length ) : NodeImpl( destImageFile )
{
// Init blob object that already exists in E57 file currently reading.

Expand Down Expand Up @@ -210,8 +209,7 @@ namespace e57
void BlobNodeImpl::dump( int indent, std::ostream &os ) const
{
// don't checkImageFileOpen
os << space( indent ) << "type: Blob"
<< " (" << type() << ")" << std::endl;
os << space( indent ) << "type: Blob" << " (" << type() << ")" << std::endl;
NodeImpl::dump( indent, os );
os << space( indent ) << "blobLogicalLength_: " << blobLogicalLength_ << std::endl;
os << space( indent ) << "binarySectionLogicalStart: " << binarySectionLogicalStart_
Expand Down
4 changes: 2 additions & 2 deletions src/CompressedVectorNodeImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ namespace e57
#ifdef E57_ENABLE_DIAGNOSTIC_OUTPUT
void CompressedVectorNodeImpl::dump( int indent, std::ostream &os ) const
{
os << space( indent ) << "type: CompressedVector"
<< " (" << type() << ")" << std::endl;
os << space( indent ) << "type: CompressedVector" << " (" << type() << ")"
<< std::endl;
NodeImpl::dump( indent, os );
if ( prototype_ )
{
Expand Down
3 changes: 1 addition & 2 deletions src/CompressedVectorWriterImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ namespace e57

CompressedVectorWriterImpl::CompressedVectorWriterImpl(
std::shared_ptr<CompressedVectorNodeImpl> ni, std::vector<SourceDestBuffer> &sbufs ) :
cVector_( ni ),
isOpen_( false ) // set to true when succeed below
cVector_( ni ), isOpen_( false ) // set to true when succeed below
{
//??? check if cvector already been written (can't write twice)

Expand Down
3 changes: 1 addition & 2 deletions src/DecodeChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ namespace e57
{
DecodeChannel::DecodeChannel( SourceDestBuffer dbuf_arg, std::shared_ptr<Decoder> decoder_arg,
unsigned bytestreamNumber_arg, uint64_t maxRecordCount_arg ) :
dbuf( dbuf_arg ),
decoder( decoder_arg ), bytestreamNumber( bytestreamNumber_arg )
dbuf( dbuf_arg ), decoder( decoder_arg ), bytestreamNumber( bytestreamNumber_arg )
{
maxRecordCount = maxRecordCount_arg;
currentPacketLogicalOffset = 0;
Expand Down
6 changes: 2 additions & 4 deletions src/Decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,7 @@ Decoder::Decoder( unsigned bytestreamNumber ) : bytestreamNumber_( bytestreamNum

BitpackDecoder::BitpackDecoder( unsigned bytestreamNumber, SourceDestBuffer &dbuf,
unsigned alignmentSize, uint64_t maxRecordCount ) :
Decoder( bytestreamNumber ),
maxRecordCount_( maxRecordCount ), destBuffer_( dbuf.impl() ),
Decoder( bytestreamNumber ), maxRecordCount_( maxRecordCount ), destBuffer_( dbuf.impl() ),
inBuffer_( 1024 ), // !!! need to pick smarter channel buffer sizes
inBufferAlignmentSize_( alignmentSize ), bitsPerWord_( 8 * alignmentSize ),
bytesPerWord_( alignmentSize )
Expand Down Expand Up @@ -856,8 +855,7 @@ ConstantIntegerDecoder::ConstantIntegerDecoder( bool isScaledInteger, unsigned b
SourceDestBuffer &dbuf, int64_t minimum,
double scale, double offset,
uint64_t maxRecordCount ) :
Decoder( bytestreamNumber ),
maxRecordCount_( maxRecordCount ), destBuffer_( dbuf.impl() ),
Decoder( bytestreamNumber ), maxRecordCount_( maxRecordCount ), destBuffer_( dbuf.impl() ),
isScaledInteger_( isScaledInteger ), minimum_( minimum ), scale_( scale ), offset_( offset )
{
}
Expand Down
4 changes: 2 additions & 2 deletions src/E57XmlParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ class E57FileInputStream : public BinInputStream

E57FileInputStream::E57FileInputStream( CheckedFile *cf, uint64_t logicalStart,
uint64_t logicalLength ) :
cf_( cf ),
logicalStart_( logicalStart ), logicalLength_( logicalLength ), logicalPosition_( logicalStart )
cf_( cf ), logicalStart_( logicalStart ), logicalLength_( logicalLength ),
logicalPosition_( logicalStart )
{
}

Expand Down
15 changes: 7 additions & 8 deletions src/Encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ void Encoder::dump( int indent, std::ostream &os ) const

BitpackEncoder::BitpackEncoder( unsigned bytestreamNumber, SourceDestBuffer &sbuf,
unsigned outputMaxSize, unsigned alignmentSize ) :
Encoder( bytestreamNumber ),
sourceBuffer_( sbuf.impl() ), outBuffer_( outputMaxSize ), outBufferFirst_( 0 ),
outBufferEnd_( 0 ), outBufferAlignmentSize_( alignmentSize ), currentRecordIndex_( 0 )
Encoder( bytestreamNumber ), sourceBuffer_( sbuf.impl() ), outBuffer_( outputMaxSize ),
outBufferFirst_( 0 ), outBufferEnd_( 0 ), outBufferAlignmentSize_( alignmentSize ),
currentRecordIndex_( 0 )
{
}

Expand Down Expand Up @@ -496,9 +496,8 @@ void BitpackFloatEncoder::dump( int indent, std::ostream &os ) const

BitpackStringEncoder::BitpackStringEncoder( unsigned bytestreamNumber, SourceDestBuffer &sbuf,
unsigned outputMaxSize ) :
BitpackEncoder( bytestreamNumber, sbuf, outputMaxSize, 1 ),
totalBytesProcessed_( 0 ), isStringActive_( false ), prefixComplete_( false ),
currentCharPosition_( 0 )
BitpackEncoder( bytestreamNumber, sbuf, outputMaxSize, 1 ), totalBytesProcessed_( 0 ),
isStringActive_( false ), prefixComplete_( false ), currentCharPosition_( 0 )
{
}

Expand Down Expand Up @@ -896,8 +895,8 @@ void BitpackIntegerEncoder<RegisterT>::dump( int indent, std::ostream &os ) cons

ConstantIntegerEncoder::ConstantIntegerEncoder( unsigned bytestreamNumber, SourceDestBuffer &sbuf,
int64_t minimum ) :
Encoder( bytestreamNumber ),
sourceBuffer_( sbuf.impl() ), currentRecordIndex_( 0 ), minimum_( minimum )
Encoder( bytestreamNumber ), sourceBuffer_( sbuf.impl() ), currentRecordIndex_( 0 ),
minimum_( minimum )
{
}

Expand Down
7 changes: 3 additions & 4 deletions src/FloatNodeImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ namespace e57
{
FloatNodeImpl::FloatNodeImpl( ImageFileImplWeakPtr destImageFile, double value,
FloatPrecision precision, double minimum, double maximum ) :
NodeImpl( destImageFile ),
value_( value ), precision_( precision ), minimum_( minimum ), maximum_( maximum )
NodeImpl( destImageFile ), value_( value ), precision_( precision ), minimum_( minimum ),
maximum_( maximum )
{
// Since this ctor also used to construct single precision, and defaults for minimum/maximum
// are for double precision, adjust bounds smaller if single.
Expand Down Expand Up @@ -214,8 +214,7 @@ namespace e57
void FloatNodeImpl::dump( int indent, std::ostream &os ) const
{
// don't checkImageFileOpen
os << space( indent ) << "type: Float"
<< " (" << type() << ")" << std::endl;
os << space( indent ) << "type: Float" << " (" << type() << ")" << std::endl;
NodeImpl::dump( indent, os );
os << space( indent ) << "precision: ";
if ( precision() == PrecisionSingle )
Expand Down
6 changes: 2 additions & 4 deletions src/IntegerNodeImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ namespace e57
{
IntegerNodeImpl::IntegerNodeImpl( ImageFileImplWeakPtr destImageFile, int64_t value,
int64_t minimum, int64_t maximum ) :
NodeImpl( destImageFile ),
value_( value ), minimum_( minimum ), maximum_( maximum )
NodeImpl( destImageFile ), value_( value ), minimum_( minimum ), maximum_( maximum )
{
}

Expand Down Expand Up @@ -160,8 +159,7 @@ namespace e57
void IntegerNodeImpl::dump( int indent, std::ostream &os ) const
{
// don't checkImageFileOpen
os << space( indent ) << "type: Integer"
<< " (" << type() << ")" << std::endl;
os << space( indent ) << "type: Integer" << " (" << type() << ")" << std::endl;
NodeImpl::dump( indent, os );
os << space( indent ) << "value: " << value_ << std::endl;
os << space( indent ) << "minimum: " << minimum_ << std::endl;
Expand Down
8 changes: 3 additions & 5 deletions src/ScaledIntegerNodeImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ namespace e57
ScaledIntegerNodeImpl::ScaledIntegerNodeImpl( ImageFileImplWeakPtr destImageFile,
int64_t rawValue, int64_t minimum, int64_t maximum,
double scale, double offset ) :
NodeImpl( destImageFile ),
value_( rawValue ), minimum_( minimum ), maximum_( maximum ), scale_( scale ),
offset_( offset )
NodeImpl( destImageFile ), value_( rawValue ), minimum_( minimum ), maximum_( maximum ),
scale_( scale ), offset_( offset )
{
}

Expand Down Expand Up @@ -228,8 +227,7 @@ namespace e57
void ScaledIntegerNodeImpl::dump( int indent, std::ostream &os ) const
{
// don't checkImageFileOpen
os << space( indent ) << "type: ScaledInteger"
<< " (" << type() << ")" << std::endl;
os << space( indent ) << "type: ScaledInteger" << " (" << type() << ")" << std::endl;
NodeImpl::dump( indent, os );
os << space( indent ) << "rawValue: " << value_ << std::endl;
os << space( indent ) << "minimum: " << minimum_ << std::endl;
Expand Down
9 changes: 4 additions & 5 deletions src/SourceDestBufferImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ using namespace e57;
SourceDestBufferImpl::SourceDestBufferImpl( ImageFileImplWeakPtr destImageFile,
const ustring &pathName, const size_t capacity,
bool doConversion, bool doScaling ) :
destImageFile_( destImageFile ),
pathName_( pathName ), memoryRepresentation_( Int32 ), capacity_( capacity ),
doConversion_( doConversion ), doScaling_( doScaling )
destImageFile_( destImageFile ), pathName_( pathName ), memoryRepresentation_( Int32 ),
capacity_( capacity ), doConversion_( doConversion ), doScaling_( doScaling )
{
}

Expand Down Expand Up @@ -109,8 +108,8 @@ template void SourceDestBufferImpl::setTypeInfo<double>( double *base, size_t st

SourceDestBufferImpl::SourceDestBufferImpl( ImageFileImplWeakPtr destImageFile,
const ustring &pathName, std::vector<ustring> *b ) :
destImageFile_( destImageFile ),
pathName_( pathName ), memoryRepresentation_( UString ), ustrings_( b )
destImageFile_( destImageFile ), pathName_( pathName ), memoryRepresentation_( UString ),
ustrings_( b )
{
/// don't checkImageFileOpen, checkState_ will do it

Expand Down
3 changes: 1 addition & 2 deletions src/StringNodeImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ namespace e57
#ifdef E57_ENABLE_DIAGNOSTIC_OUTPUT
void StringNodeImpl::dump( int indent, std::ostream &os ) const
{
os << space( indent ) << "type: String"
<< " (" << type() << ")" << std::endl;
os << space( indent ) << "type: String" << " (" << type() << ")" << std::endl;
NodeImpl::dump( indent, os );
os << space( indent ) << "value: '" << value_ << "'" << std::endl;
}
Expand Down
3 changes: 1 addition & 2 deletions src/StructureNodeImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,7 @@ void StructureNodeImpl::writeXml( ImageFileImplSharedPtr imf, CheckedFile &cf, i
void StructureNodeImpl::dump( int indent, std::ostream &os ) const
{
// don't checkImageFileOpen
os << space( indent ) << "type: Structure"
<< " (" << type() << ")" << std::endl;
os << space( indent ) << "type: Structure" << " (" << type() << ")" << std::endl;
NodeImpl::dump( indent, os );
for ( unsigned i = 0; i < children_.size(); i++ )
{
Expand Down
3 changes: 1 addition & 2 deletions src/VectorNodeImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ namespace e57
void VectorNodeImpl::dump( int indent, std::ostream &os ) const
{
// don't checkImageFileOpen
os << space( indent ) << "type: Vector"
<< " (" << type() << ")" << std::endl;
os << space( indent ) << "type: Vector" << " (" << type() << ")" << std::endl;
NodeImpl::dump( indent, os ); // NOLINT(bugprone-parent-virtual-call)
os << space( indent ) << "allowHeteroChildren: " << allowHeteroChildren() << std::endl;
for ( unsigned i = 0; i < children_.size(); i++ )
Expand Down

0 comments on commit f5c58ed

Please sign in to comment.