From 12f1eb15ca3fed6310402847559a7c99d3c77847 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sat, 2 Apr 2022 17:14:10 -0400 Subject: Programmatically apply new formatting to code Run this: for i in **/*.cc **/*.c **/*.h **/*.hh; do clang-format < $i >| $i.new && mv $i.new $i done --- libqpdf/BitStream.cc | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) (limited to 'libqpdf/BitStream.cc') diff --git a/libqpdf/BitStream.cc b/libqpdf/BitStream.cc index d0e991df..504e35c4 100644 --- a/libqpdf/BitStream.cc +++ b/libqpdf/BitStream.cc @@ -18,8 +18,7 @@ BitStream::reset() { p = start; bit_offset = 7; - if (QIntC::to_uint(nbytes) > static_cast(-1) / 8) - { + if (QIntC::to_uint(nbytes) > static_cast(-1) / 8) { throw std::runtime_error("array too large for bitstream"); } bits_available = 8 * nbytes; @@ -28,22 +27,18 @@ BitStream::reset() unsigned long long BitStream::getBits(size_t nbits) { - return read_bits(this->p, this->bit_offset, - this->bits_available, nbits); + return read_bits(this->p, this->bit_offset, this->bits_available, nbits); } long long BitStream::getBitsSigned(size_t nbits) { - unsigned long long bits = read_bits(this->p, this->bit_offset, - this->bits_available, nbits); + unsigned long long bits = + read_bits(this->p, this->bit_offset, this->bits_available, nbits); long long result = 0; - if (static_cast(bits) > 1LL << (nbits - 1)) - { - result = static_cast(bits -(1ULL << nbits)); - } - else - { + if (static_cast(bits) > 1LL << (nbits - 1)) { + result = static_cast(bits - (1ULL << nbits)); + } else { result = static_cast(bits); } return result; @@ -52,20 +47,16 @@ BitStream::getBitsSigned(size_t nbits) int BitStream::getBitsInt(size_t nbits) { - return static_cast( - QIntC::to_uint( - read_bits(this->p, this->bit_offset, - this->bits_available, nbits))); + return static_cast(QIntC::to_uint( + read_bits(this->p, this->bit_offset, this->bits_available, nbits))); } void BitStream::skipToNextByte() { - if (bit_offset != 7) - { + if (bit_offset != 7) { size_t bits_to_skip = bit_offset + 1; - if (bits_available < bits_to_skip) - { + if (bits_available < bits_to_skip) { throw std::logic_error( "INTERNAL ERROR: overflow skipping to next byte in bitstream"); } -- cgit v1.2.3-70-g09d2