From 45780ae2b9e87a5466ca5d76108b3a4eedde5f53 Mon Sep 17 00:00:00 2001 From: Brenton Bostick Date: Tue, 29 Oct 2024 08:00:00 -0400 Subject: [PATCH] WIP --- lib/alternate-time-regions.inl | 2 -- lib/expanddeltalist.inl | 4 --- lib/last-found.inl | 4 +-- lib/midi.cpp | 2 -- lib/tablature.cpp | 47 +--------------------------------- lib/tbt.cpp | 8 ------ 6 files changed, 3 insertions(+), 64 deletions(-) diff --git a/lib/alternate-time-regions.inl b/lib/alternate-time-regions.inl index 4381dfc..bff7ae0 100644 --- a/lib/alternate-time-regions.inl +++ b/lib/alternate-time-regions.inl @@ -81,7 +81,6 @@ parseAlternateTimeRegionsMapList( return ret; } -#ifndef NDEBUG rational alternateTimeRegionsCorrection = 0; for (uint16_t space = 0; space < trackSpaceCount; space++) { @@ -97,7 +96,6 @@ parseAlternateTimeRegionsMapList( } ASSERT(rational(out.metadata.tracks[track].spaceCount) == rational(out.body.barLinesSpaceCount) + alternateTimeRegionsCorrection); -#endif // NDEBUG } return OK; diff --git a/lib/expanddeltalist.inl b/lib/expanddeltalist.inl index 00180ab..aa5b982 100644 --- a/lib/expanddeltalist.inl +++ b/lib/expanddeltalist.inl @@ -210,11 +210,7 @@ expandDeltaList( slot = newSlot; } -#ifndef NDEBUG ASSERT(static_cast(unit) == unitCount); -#else - (void)unitCount; -#endif // NDEBUG return OK; } diff --git a/lib/last-found.inl b/lib/last-found.inl index 28965c6..6ced2f6 100644 --- a/lib/last-found.inl +++ b/lib/last-found.inl @@ -28,13 +28,13 @@ // returns m.rend() on failure // template -typename M::const_reverse_iterator last_found(const M& m, const T& val) { +typename M::const_reverse_iterator last_found(const M &m, const T &val) { typename M::const_reverse_iterator first = m.rbegin(); typename M::const_reverse_iterator last = m.rend(); - return std::lower_bound(first, last, val, [](const typename M::value_type& a, const T& b){ return a.first > b; }); + return std::lower_bound(first, last, val, [](const typename M::value_type &a, const T &b){ return a.first > b; }); } diff --git a/lib/midi.cpp b/lib/midi.cpp index b5b039d..c00f982 100644 --- a/lib/midi.cpp +++ b/lib/midi.cpp @@ -2126,7 +2126,6 @@ TconvertToMidi( --actualSpace; -#ifndef NDEBUG ASSERT(tick == tickCount); ASSERT(roundedTick == tickCount); ASSERT(actualSpace == barLinesSpaceCount); @@ -2135,7 +2134,6 @@ TconvertToMidi( ASSERT(r.repeats == 0); } ASSERT(openSpaceSet.empty()); -#endif // NDEBUG // // Emit any final note offs diff --git a/lib/tablature.cpp b/lib/tablature.cpp index 46726fa..c026f32 100644 --- a/lib/tablature.cpp +++ b/lib/tablature.cpp @@ -753,9 +753,7 @@ TtbtFileTablature(const tbt_file_t &t) { std::string trackEffectChanges; std::string bottomLineText; -#ifndef NDEBUG std::string debugText; -#endif // NDEBUG if (trackMetadata.topLineText) { topLineText.reserve(totalWidth); @@ -773,9 +771,7 @@ TtbtFileTablature(const tbt_file_t &t) { bottomLineText.reserve(totalWidth); } -#ifndef NDEBUG debugText.reserve(totalWidth); -#endif // NDEBUG // @@ -842,10 +838,8 @@ TtbtFileTablature(const tbt_file_t &t) { bottomLineText.append(tuningWidth, ' '); } -#ifndef NDEBUG debugText += static_cast(tuningWidth + '0'); debugText.append(tuningWidth - 1, ' '); -#endif // NDEBUG } @@ -900,9 +894,7 @@ TtbtFileTablature(const tbt_file_t &t) { bottomLineText += ' '; } -#ifndef NDEBUG debugText += static_cast(1 + '0'); -#endif // NDEBUG } // @@ -936,9 +928,7 @@ TtbtFileTablature(const tbt_file_t &t) { uint8_t bottomLineTextWidthAcc = 0; -#ifndef NDEBUG uint8_t debugTextWidthAcc = 0; -#endif // NDEBUG auto fillin = [&](uint8_t width) { @@ -976,11 +966,9 @@ TtbtFileTablature(const tbt_file_t &t) { bottomLineTextWidthAcc = 0; } -#ifndef NDEBUG debugText.append(width - debugTextWidthAcc, ' '); debugTextWidthAcc = 0; -#endif // NDEBUG }; @@ -1071,11 +1059,10 @@ TtbtFileTablature(const tbt_file_t &t) { } } -#ifndef NDEBUG debugText += static_cast(repeatsStr.size() + '0'); debugTextWidthAcc += 1; -#endif // NDEBUG + savedClose = false; } else { @@ -1108,11 +1095,9 @@ TtbtFileTablature(const tbt_file_t &t) { } } -#ifndef NDEBUG debugText += static_cast(1 + '0'); debugTextWidthAcc += 1; -#endif // NDEBUG } if ((barLine[0] & CLOSEREPEAT_MASK_GE70) == CLOSEREPEAT_MASK_GE70) { @@ -1313,11 +1298,9 @@ TtbtFileTablature(const tbt_file_t &t) { } } -#ifndef NDEBUG debugText += static_cast(spaceWidth + '0'); debugTextWidthAcc += 1; -#endif // NDEBUG } // note @@ -1428,11 +1411,9 @@ TtbtFileTablature(const tbt_file_t &t) { // nothing to do here // -#ifndef NDEBUG debugText += static_cast(repeatsStr.size() + '0'); debugTextWidthAcc += 1; -#endif // NDEBUG break; } @@ -1489,11 +1470,9 @@ TtbtFileTablature(const tbt_file_t &t) { // nothing to do here // -#ifndef NDEBUG debugText += static_cast(1 + '0'); debugTextWidthAcc += 1; -#endif // NDEBUG break; } @@ -1533,11 +1512,9 @@ TtbtFileTablature(const tbt_file_t &t) { // nothing to do here // -#ifndef NDEBUG debugText += static_cast(1 + '0'); debugTextWidthAcc += 1; -#endif // NDEBUG } while (false); @@ -1591,11 +1568,9 @@ TtbtFileTablature(const tbt_file_t &t) { // nothing to do here // -#ifndef NDEBUG debugText += static_cast(1 + '0'); debugTextWidthAcc += 1; -#endif // NDEBUG break; } @@ -1635,11 +1610,9 @@ TtbtFileTablature(const tbt_file_t &t) { // nothing to do here // -#ifndef NDEBUG debugText += static_cast(1 + '0'); debugTextWidthAcc += 1; -#endif // NDEBUG } while (false); @@ -1729,11 +1702,9 @@ TtbtFileTablature(const tbt_file_t &t) { } } -#ifndef NDEBUG debugText += static_cast(repeatsStr.size() + '0'); debugTextWidthAcc += 1; -#endif // NDEBUG savedClose = false; @@ -1767,11 +1738,9 @@ TtbtFileTablature(const tbt_file_t &t) { } } -#ifndef NDEBUG debugText += static_cast(1 + '0'); debugTextWidthAcc += 1; -#endif // NDEBUG } if ((barLine[0] & CLOSEREPEAT_MASK_GE70) == CLOSEREPEAT_MASK_GE70) { @@ -1846,11 +1815,9 @@ TtbtFileTablature(const tbt_file_t &t) { // nothing to do here // -#ifndef NDEBUG debugText += static_cast(repeatsStr.size() + '0'); debugTextWidthAcc += 1; -#endif // NDEBUG break; } @@ -1898,11 +1865,9 @@ TtbtFileTablature(const tbt_file_t &t) { // nothing to do here // -#ifndef NDEBUG debugText += static_cast(1 + '0'); debugTextWidthAcc += 1; -#endif // NDEBUG break; } @@ -1942,11 +1907,9 @@ TtbtFileTablature(const tbt_file_t &t) { // nothing to do here // -#ifndef NDEBUG debugText += static_cast(1 + '0'); debugTextWidthAcc += 1; -#endif // NDEBUG break; } @@ -1983,9 +1946,7 @@ TtbtFileTablature(const tbt_file_t &t) { ASSERT(bottomLineTextWidthAcc == 0); } -#ifndef NDEBUG ASSERT(debugTextWidthAcc == 0); -#endif // NDEBUG if (trackMetadata.topLineText) { @@ -2004,9 +1965,7 @@ TtbtFileTablature(const tbt_file_t &t) { ASSERT(bottomLineText.size() == totalWidth); } -#ifndef NDEBUG ASSERT(debugText.size() == totalWidth); -#endif // NDEBUG acc += std::string("track ") + std::to_string(track + 1) + ":\n"; @@ -2027,9 +1986,7 @@ TtbtFileTablature(const tbt_file_t &t) { toReserve += (totalWidth + 1); } - #ifndef NDEBUG toReserve += (totalWidth + 1); - #endif // NDEBUG toReserve += 1; @@ -2057,10 +2014,8 @@ TtbtFileTablature(const tbt_file_t &t) { acc += '\n'; } -#ifndef NDEBUG acc += debugText; acc += '\n'; -#endif // NDEBUG acc += '\n'; diff --git a/lib/tbt.cpp b/lib/tbt.cpp index 4d3a659..51a231c 100644 --- a/lib/tbt.cpp +++ b/lib/tbt.cpp @@ -151,31 +151,23 @@ TparseTbtBytes( { if constexpr (0x6e <= VERSION) { -#ifndef NDEBUG uint32_t metadataLen; -#endif // NDEBUG if constexpr (0x71 <= VERSION) { -#ifndef NDEBUG metadataLen = sizeof(tbt_track_metadata71) * out.header.trackCount; -#endif // NDEBUG out.metadata.tracks = std::vector(out.header.trackCount); } else if constexpr (0x70 <= VERSION) { -#ifndef NDEBUG metadataLen = sizeof(tbt_track_metadata70) * out.header.trackCount; -#endif // NDEBUG out.metadata.tracks = std::vector(out.header.trackCount); } else { -#ifndef NDEBUG metadataLen = sizeof(tbt_track_metadata6e) * out.header.trackCount; -#endif // NDEBUG out.metadata.tracks = std::vector(out.header.trackCount); }