1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Added a safety check and fixed a couple of warnings.

This commit is contained in:
jules 2014-02-21 16:00:39 +00:00
parent a34496588c
commit 48c2f42802
2 changed files with 12 additions and 9 deletions

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);

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];
}
}
}
}