From c17db5f2f6338586e55f1b44a744f7a43d8ff289 Mon Sep 17 00:00:00 2001 From: Martchus Date: Sat, 4 May 2019 21:03:09 +0200 Subject: [PATCH] Apply cmake-format and clang-format --- CMakeLists.txt | 3 ++- id3/id3v2frame.cpp | 2 +- matroska/matroskacontainer.cpp | 6 +++--- mp4/mp4track.cpp | 33 +++++++++++++++++------------- mpegaudio/mpegaudioframestream.cpp | 7 +++---- ogg/oggcontainer.cpp | 2 +- wav/waveaudiostream.cpp | 7 +++---- 7 files changed, 32 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bdeb069..320ae0f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -176,7 +176,8 @@ set(META_REQUIRED_CPP_UNIT_VERSION 1.14.0) set(META_ADD_DEFAULT_CPP_UNIT_TEST_APPLICATION ON) # find c++utilities -set(CONFIGURATION_PACKAGE_SUFFIX "" CACHE STRING "sets the suffix for find_package() calls to packages configured via c++utilities") +set(CONFIGURATION_PACKAGE_SUFFIX "" + CACHE STRING "sets the suffix for find_package() calls to packages configured via c++utilities") find_package(c++utilities${CONFIGURATION_PACKAGE_SUFFIX} 5.0.0 REQUIRED) use_cpp_utilities(VISIBILITY PUBLIC) diff --git a/id3/id3v2frame.cpp b/id3/id3v2frame.cpp index c335b60..fe2efbb 100644 --- a/id3/id3v2frame.cpp +++ b/id3/id3v2frame.cpp @@ -607,7 +607,7 @@ Id3v2FrameMaker::Id3v2FrameMaker(Id3v2Frame &frame, std::uint8_t version, Diagno } else if (((version >= 3 && m_frameId == Id3v2FrameIds::lComment) || (version < 3 && m_frameId == Id3v2FrameIds::sComment)) || ((version >= 3 && m_frameId == Id3v2FrameIds::lUnsynchronizedLyrics) - || (version < 3 && m_frameId == Id3v2FrameIds::sUnsynchronizedLyrics))) { + || (version < 3 && m_frameId == Id3v2FrameIds::sUnsynchronizedLyrics))) { // make comment frame or the unsynchronized lyrics frame m_frame.makeComment(m_data, m_decompressedSize, *values.front(), version, diag); diff --git a/matroska/matroskacontainer.cpp b/matroska/matroskacontainer.cpp index 723161a..87e05be 100644 --- a/matroska/matroskacontainer.cpp +++ b/matroska/matroskacontainer.cpp @@ -1239,7 +1239,7 @@ void MatroskaContainer::internalMakeFile(Diagnostics &diag, AbortableProgressFee segment.clusterEndOffset = level1Element->endOffset(); if (segment.cuesElement && segment.cuesUpdater.updateOffsets( - clusterReadOffset, level1Element->startOffset() - 4 - segment.sizeDenotationLength - ebmlHeaderSize) + clusterReadOffset, level1Element->startOffset() - 4 - segment.sizeDenotationLength - ebmlHeaderSize) && newCuesPos == ElementPosition::BeforeData) { cuesInvalidated = true; } @@ -1326,13 +1326,13 @@ void MatroskaContainer::internalMakeFile(Diagnostics &diag, AbortableProgressFee if (rewriteRequired) { if (newTagPos != ElementPosition::AfterData && (!fileInfo().forceTagPosition() - || (fileInfo().tagPosition() == ElementPosition::Keep && currentTagPos == ElementPosition::Keep))) { + || (fileInfo().tagPosition() == ElementPosition::Keep && currentTagPos == ElementPosition::Keep))) { // rewriting might be avoided by writing the tags at the end newTagPos = ElementPosition::AfterData; rewriteRequired = false; } else if (newCuesPos != ElementPosition::AfterData && (!fileInfo().forceIndexPosition() - || (fileInfo().indexPosition() == ElementPosition::Keep && currentCuesPos == ElementPosition::Keep))) { + || (fileInfo().indexPosition() == ElementPosition::Keep && currentCuesPos == ElementPosition::Keep))) { // rewriting might be avoided by writing the cues at the end newCuesPos = ElementPosition::AfterData; rewriteRequired = false; diff --git a/mp4/mp4track.cpp b/mp4/mp4track.cpp index 501df0e..d841915 100644 --- a/mp4/mp4track.cpp +++ b/mp4/mp4track.cpp @@ -437,9 +437,9 @@ TrackHeaderInfo Mp4Track::verifyPresentTrackHeader() const info.requiredSize = m_tkhdAtom->dataSize() + 8; // -> add 12 byte to size if update from version 0 to version 1 is required (which needs 12 byte more) if ((info.version == 0) - && (static_cast((m_creationTime - startDate).totalSeconds()) > numeric_limits::max() - || static_cast((m_modificationTime - startDate).totalSeconds()) > numeric_limits::max() - || static_cast(m_duration.totalSeconds() * m_timeScale) > numeric_limits::max())) { + && (static_cast((m_creationTime - startDate).totalSeconds()) > numeric_limits::max() + || static_cast((m_modificationTime - startDate).totalSeconds()) > numeric_limits::max() + || static_cast(m_duration.totalSeconds() * m_timeScale) > numeric_limits::max())) { info.requiredSize += 12; } // -> add 8 byte to the size because it must be denoted using a 64-bit integer @@ -592,7 +592,8 @@ std::unique_ptr Mp4Track::parseMpeg4ElementaryStreamI if (esInfo->ocrFlag()) { esInfo->ocrId = reader.readUInt16BE(); } - for (Mpeg4Descriptor *esDescChild = esDesc.denoteFirstChild(static_cast(static_cast(reader.stream()->tellg()) - esDesc.startOffset())); + for (Mpeg4Descriptor *esDescChild + = esDesc.denoteFirstChild(static_cast(static_cast(reader.stream()->tellg()) - esDesc.startOffset())); esDescChild; esDescChild = esDescChild->nextSibling()) { esDescChild->parse(diag); switch (esDescChild->id()) { @@ -1107,10 +1108,10 @@ std::uint64_t Mp4Track::requiredSize(Diagnostics &diag) const } // ... mdhd total size if (static_cast((m_creationTime - startDate).totalSeconds()) > numeric_limits::max() - || static_cast((m_modificationTime - startDate).totalSeconds()) > numeric_limits::max() - || static_cast(m_duration.totalSeconds() * m_timeScale) > numeric_limits::max()) { + || static_cast((m_modificationTime - startDate).totalSeconds()) > numeric_limits::max() + || static_cast(m_duration.totalSeconds() * m_timeScale) > numeric_limits::max()) { // write version 1 where those fields are 64-bit - size += 44; + size += 44; } else { // write version 0 where those fields are 32-bit size += 32; @@ -1201,9 +1202,11 @@ void Mp4Track::makeTrackHeader(Diagnostics &diag) const auto creationTime = static_cast((m_creationTime - startDate).totalSeconds()); const auto modificationTime = static_cast((m_modificationTime - startDate).totalSeconds()); const auto duration = static_cast(m_duration.totalSeconds() * m_timeScale); - const std::uint8_t version = (info.version == 0) && (creationTime > numeric_limits::max() - || modificationTime > numeric_limits::max() - || duration > numeric_limits::max()) ? 1 : info.version; + const std::uint8_t version = (info.version == 0) + && (creationTime > numeric_limits::max() || modificationTime > numeric_limits::max() + || duration > numeric_limits::max()) + ? 1 + : info.version; // make version and flags writer().writeByte(version); @@ -1276,9 +1279,10 @@ void Mp4Track::makeMedia(Diagnostics &diag) const auto creationTime = static_cast((m_creationTime - startDate).totalSeconds()); const auto modificationTime = static_cast((m_modificationTime - startDate).totalSeconds()); const auto duration = static_cast(m_duration.totalSeconds() * m_timeScale); - const std::uint8_t version = (creationTime > numeric_limits::max() - || modificationTime > numeric_limits::max() - || duration > numeric_limits::max()) ? 1 : 0; + const std::uint8_t version = (creationTime > numeric_limits::max() || modificationTime > numeric_limits::max() + || duration > numeric_limits::max()) + ? 1 + : 0; writer().writeUInt32BE(version != 0 ? 44 : 32); // size writer().writeUInt32BE(Mp4AtomIds::MediaHeader); writer().writeByte(version); // version @@ -1311,7 +1315,8 @@ void Mp4Track::makeMedia(Diagnostics &diag) language = 0; break; } - diag.emplace_back(DiagLevel::Warning, "Assigned language \"" % m_language + "\" is of an invalid format. Setting language to undefined.", "making mdhd atom"); + diag.emplace_back(DiagLevel::Warning, "Assigned language \"" % m_language + "\" is of an invalid format. Setting language to undefined.", + "making mdhd atom"); language = 0x55C4; // und(efined) break; } diff --git a/mpegaudio/mpegaudioframestream.cpp b/mpegaudio/mpegaudioframestream.cpp index 492ece6..9c98e82 100644 --- a/mpegaudio/mpegaudioframestream.cpp +++ b/mpegaudio/mpegaudioframestream.cpp @@ -56,10 +56,9 @@ void MpegAudioFrameStream::internalParseHeader(Diagnostics &diag) m_size = xingSize; } } - m_bitrate = frame.isXingFramefieldPresent() - ? ((static_cast(m_size) * 8.0) - / (static_cast(frame.xingFrameCount() * frame.sampleCount()) / static_cast(frame.samplingFrequency())) / 1024.0) - : frame.bitrate(); + m_bitrate = frame.isXingFramefieldPresent() ? ((static_cast(m_size) * 8.0) + / (static_cast(frame.xingFrameCount() * frame.sampleCount()) / static_cast(frame.samplingFrequency())) / 1024.0) + : frame.bitrate(); m_duration = TimeSpan::fromSeconds(static_cast(m_size) / (m_bytesPerSecond = static_cast(m_bitrate * 125))); } diff --git a/ogg/oggcontainer.cpp b/ogg/oggcontainer.cpp index 2a0fca7..d2d6838 100644 --- a/ogg/oggcontainer.cpp +++ b/ogg/oggcontainer.cpp @@ -439,7 +439,7 @@ void OggContainer::internalMakeFile(Diagnostics &diag, AbortableProgressFeedback // prevent making the comment twice if it spreads over multiple pages/segments if (!currentParams->removed && ((m_iterator.currentPageIndex() == currentParams->firstPageIndex - && m_iterator.currentSegmentIndex() == currentParams->firstSegmentIndex))) { + && m_iterator.currentSegmentIndex() == currentParams->firstSegmentIndex))) { makeVorbisCommentSegment(buffer, copyHelper, newSegmentSizes, currentComment, currentParams, diag); } diff --git a/wav/waveaudiostream.cpp b/wav/waveaudiostream.cpp index 73b5089..8b3657e 100644 --- a/wav/waveaudiostream.cpp +++ b/wav/waveaudiostream.cpp @@ -202,10 +202,9 @@ void WaveAudioStream::internalParseHeader(Diagnostics &diag) MpegAudioFrame frame; frame.parseHeader(m_reader, diag); MpegAudioFrameStream::addInfo(frame, *this); - m_bitrate = frame.isXingFramefieldPresent() - ? ((static_cast(m_size) * 8.0) - / (static_cast(frame.xingFrameCount() * frame.sampleCount()) / static_cast(frame.samplingFrequency())) / 1024.0) - : frame.bitrate(); + m_bitrate = frame.isXingFramefieldPresent() ? ((static_cast(m_size) * 8.0) + / (static_cast(frame.xingFrameCount() * frame.sampleCount()) / static_cast(frame.samplingFrequency())) / 1024.0) + : frame.bitrate(); m_bytesPerSecond = static_cast(m_bitrate * 125); m_duration = TimeSpan::fromSeconds(static_cast(m_size) / (m_bitrate * 128.0)); }