Browse Source

fix for an integer overflow condition in IntegerElementComparator

tags/2021-05-28
jules 17 years ago
parent
commit
c6ee58f41e
4 changed files with 6 additions and 14 deletions
  1. +1
    -3
      juce_amalgamated.cpp
  2. +2
    -4
      juce_amalgamated.h
  3. +1
    -3
      src/juce_appframework/audio/midi/juce_MidiMessageSequence.cpp
  4. +2
    -4
      src/juce_core/containers/juce_ElementComparator.h

+ 1
- 3
juce_amalgamated.cpp View File

@@ -26243,9 +26243,7 @@ int MidiMessageSequence::compareElements (const MidiMessageSequence::MidiEventHo
const double diff = first->message.getTimeStamp()
- second->message.getTimeStamp();

return (diff == 0) ? 0
: ((diff > 0) ? 1
: -1);
return (diff > 0) - (diff < 0);
}

void MidiMessageSequence::sort()


+ 2
- 4
juce_amalgamated.h View File

@@ -3088,7 +3088,7 @@ public:
static int compareElements (const ElementType first,
const ElementType second) throw()
{
return first - second;
return (first > second) - (second < first);
}
};

@@ -3114,9 +3114,7 @@ public:
static int compareElements (const ElementType first,
const ElementType second) throw()
{
return (first < second) ? -1
: ((first == second) ? 0
: 1);
return (first > second) - (second < first);
}
};



+ 1
- 3
src/juce_appframework/audio/midi/juce_MidiMessageSequence.cpp View File

@@ -202,9 +202,7 @@ int MidiMessageSequence::compareElements (const MidiMessageSequence::MidiEventHo
const double diff = first->message.getTimeStamp()
- second->message.getTimeStamp();
return (diff == 0) ? 0
: ((diff > 0) ? 1
: -1);
return (diff > 0) - (diff < 0);
}
void MidiMessageSequence::sort()


+ 2
- 4
src/juce_core/containers/juce_ElementComparator.h View File

@@ -284,7 +284,7 @@ public:
static int compareElements (const ElementType first,
const ElementType second) throw()
{
return first - second;
return (first > second) - (second < first);
}
};
@@ -312,9 +312,7 @@ public:
static int compareElements (const ElementType first,
const ElementType second) throw()
{
return (first < second) ? -1
: ((first == second) ? 0
: 1);
return (first > second) - (second < first);
}
};


Loading…
Cancel
Save