Browse Source

Added a safety check and fixed a couple of warnings.

tags/2021-05-28
jules 11 years ago
parent
commit
48c2f42802
2 changed files with 12 additions and 9 deletions
  1. +2
    -2
      modules/juce_audio_basics/midi/juce_MidiMessage.cpp
  2. +10
    -7
      modules/juce_audio_processors/juce_audio_processors.cpp

+ 2
- 2
modules/juce_audio_basics/midi/juce_MidiMessage.cpp View File

@@ -679,8 +679,8 @@ MidiMessage MidiMessage::textMetaEvent (int type, const StringRef& text)
const size_t headerLen = sizeof (header) - n;
uint8* const dest = result.allocateSpace (headerLen + textSize);
result.size = headerLen + textSize;
uint8* const dest = result.allocateSpace ((int) (headerLen + textSize));
result.size = (int) (headerLen + textSize);
memcpy (dest, header + n, headerLen);
memcpy (dest + headerLen, text.text.getAddress(), textSize);


+ 10
- 7
modules/juce_audio_processors/juce_audio_processors.cpp View File

@@ -119,15 +119,18 @@ struct AutoResizingNSViewComponentWithParent : public AutoResizingNSViewCompone
{
if (NSView* parent = (NSView*) getView())
{
if (NSView* child = [[parent subviews] objectAtIndex: 0])
if ([[parent subviews] count] > 0)
{
NSRect f = [parent frame];
NSSize newSize = [child frame].size;
if (f.size.width != newSize.width || f.size.height != newSize.height)
if (NSView* child = [[parent subviews] objectAtIndex: 0])
{
f.size = newSize;
[parent setFrame: f];
NSRect f = [parent frame];
NSSize newSize = [child frame].size;
if (f.size.width != newSize.width || f.size.height != newSize.height)
{
f.size = newSize;
[parent setFrame: f];
}
}
}
}


Loading…
Cancel
Save