Menu

#1630 Identical condition

None
closed
lilypond (43)
5
2022-12-27
2022-04-24
No

src/document/io/LilyPondSegmentsContext.cpp line 803

Code:

if (m_GSSSegIterator->synchronous &&
    (m_GSSSegIterator->segment != m_GSSSegment) &&
    (m_GSSSegIterator->segment->getStartTime() == m_GSSSegment->getStartTime()) &&
    (m_GSSSegIterator->segment != m_GSSSegment)) {  // <- identical 
    return &(*m_GSSSegIterator);
}

Same holds for line 828

Discussion

  • Yves Guillemot

    Yves Guillemot - 2022-04-24

    Thanks to find this one.
    Probably it only is a copy/paste done a bit too quickly.
    I'm currently working on the LilyPond exporter. So I'll have a look at it and then fix it in the next days.

     
  • Yves Guillemot

    Yves Guillemot - 2022-04-24
    • assigned_to: Yves Guillemot
     
  • Ted Felix

    Ted Felix - 2022-04-29
    • labels: --> lilypond
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,10 +1,14 @@
     src/document/io/LilyPondSegmentsContext.cpp line 803
    +
     Code:
    +
    +~~~C++
     if (m_GSSSegIterator-&gt;synchronous &amp;&amp;
    
    -        (m_GSSSegIterator-&gt;segment != m_GSSSegment) &amp;&amp;
    -        (m_GSSSegIterator-&gt;segment-&gt;getStartTime() == m_GSSSegment-&gt;getStartTime()) &amp;&amp;
    -        (m_GSSSegIterator-&gt;segment != m_GSSSegment)) {  // &lt;- identical 
    -            return &amp;(*m_GSSSegIterator);
    -    }
    +    (m_GSSSegIterator-&gt;segment != m_GSSSegment) &amp;&amp;
    +    (m_GSSSegIterator-&gt;segment-&gt;getStartTime() == m_GSSSegment-&gt;getStartTime()) &amp;&amp;
    +    (m_GSSSegIterator-&gt;segment != m_GSSSegment)) {  // &lt;- identical 
    +    return &amp;(*m_GSSSegIterator);
    +}
    +~~~
    
    
    -   same holds for line 828
    +Same holds for line 828
    
     
  • Philip Leishman

    Philip Leishman - 2022-05-01

    I now have bug 1632 - taking care of all the cppcheck warnings so that will cover this one too.
    I suggest closing this bug

     
  • Yves Guillemot

    Yves Guillemot - 2022-05-01

    Thanks Philip, but I wrote this code years ago and I understand what happened.
    The identical condition was a placeholder where I should have written a missing condition, but I presumably ran some preliminary tests then forgot to complete the code.

    This completed code should be:

    if (m_GSSSegIterator->synchronous &&
        (m_GSSSegIterator->segment != m_GSSSegment) &&
        (m_GSSSegIterator->segment->getStartTime() == m_GSSSegment->getStartTime()) &&
        (m_GSSSegIterator->segment->getEndMarkerTime() == m_GSSSegment->getEndMarkerTime())) {
        return &(*m_GSSSegIterator);
    }
    

    The funny thing is that I can't find any combination of segments giving a failure with the uncompleted code. The synchronous segments this code erroneously find are eliminated at some next step and everything works fine.
    It should only be a bit faster after the correction, but this will not be discernible as the number of segments in a composition is never really huge.

    Anyway, the bug is now fixed in branch Fix1630.

     
  • Philip Leishman

    Philip Leishman - 2022-05-02

    OK. Great !!
    I will get the update from a merge.
    Thanks

     
  • Ted Felix

    Ted Felix - 2022-06-20
    • status: open --> feedback
     
  • Ted Felix

    Ted Felix - 2022-06-20

    Merged as [80ce48]. Please test latest git.

     

    Related

    Commit: [80ce48]

  • Ted Felix

    Ted Felix - 2022-12-27
    • status: feedback --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB