mirror of
https://github.com/holub/mame
synced 2025-10-04 08:28:39 +03:00
Clean up some stuff that upsets GCC5
This commit is contained in:
parent
cdbb940930
commit
fca1106249
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#import "debugwindowhandler.h"
|
#import "debugwindowhandler.h"
|
||||||
|
|
||||||
|
#import "debugconsole.h"
|
||||||
#import "debugcommandhistory.h"
|
#import "debugcommandhistory.h"
|
||||||
#import "debugview.h"
|
#import "debugview.h"
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@
|
|||||||
// set default state
|
// set default state
|
||||||
[devicesView expandItem:root expandChildren:YES];
|
[devicesView expandItem:root expandChildren:YES];
|
||||||
[window makeFirstResponder:devicesView];
|
[window makeFirstResponder:devicesView];
|
||||||
[window setTitle:[NSString stringWithFormat:@"All Devices"]];
|
[window setTitle:@"All Devices"];
|
||||||
|
|
||||||
// calculate the optimal size for everything
|
// calculate the optimal size for everything
|
||||||
NSSize const desired = [NSScrollView frameSizeForContentSize:NSMakeSize(480, 320)
|
NSSize const desired = [NSScrollView frameSizeForContentSize:NSMakeSize(480, 320)
|
||||||
|
@ -793,13 +793,13 @@ static void UpdateChangeCountCallback(void *userData,
|
|||||||
newEffectMenu = [[NSMenu allocWithZone:[NSMenu zone]] initWithTitle:@"New"];
|
newEffectMenu = [[NSMenu allocWithZone:[NSMenu zone]] initWithTitle:@"New"];
|
||||||
[menu setSubmenu:newEffectMenu forItem:item];
|
[menu setSubmenu:newEffectMenu forItem:item];
|
||||||
[newEffectMenu release];
|
[newEffectMenu release];
|
||||||
item = [menu addItemWithTitle:@"Open…" action:@selector(openDocument:) keyEquivalent:@"o"];
|
item = [menu addItemWithTitle:[NSString stringWithFormat:@"Open%C", (unichar)0x2026] action:@selector(openDocument:) keyEquivalent:@"o"];
|
||||||
|
|
||||||
[menu addItem:[NSMenuItem separatorItem]];
|
[menu addItem:[NSMenuItem separatorItem]];
|
||||||
|
|
||||||
item = [menu addItemWithTitle:@"Close" action:@selector(performClose:) keyEquivalent:@"w"];
|
item = [menu addItemWithTitle:@"Close" action:@selector(performClose:) keyEquivalent:@"w"];
|
||||||
item = [menu addItemWithTitle:@"Save" action:@selector(saveDocument:) keyEquivalent:@"s"];
|
item = [menu addItemWithTitle:@"Save" action:@selector(saveDocument:) keyEquivalent:@"s"];
|
||||||
item = [menu addItemWithTitle:@"Save As…" action:@selector(saveDocumentAs:) keyEquivalent:@"S"];
|
item = [menu addItemWithTitle:[NSString stringWithFormat:@"Save As%C", (unichar)0x2026] action:@selector(saveDocumentAs:) keyEquivalent:@"S"];
|
||||||
item = [menu addItemWithTitle:@"Save All" action:@selector(saveAllDocuments:) keyEquivalent:@""];
|
item = [menu addItemWithTitle:@"Save All" action:@selector(saveAllDocuments:) keyEquivalent:@""];
|
||||||
item = [menu addItemWithTitle:@"Revert to Saved" action:@selector(revertDocumentToSaved:) keyEquivalent:@"u"];
|
item = [menu addItemWithTitle:@"Revert to Saved" action:@selector(revertDocumentToSaved:) keyEquivalent:@"u"];
|
||||||
}
|
}
|
||||||
|
@ -28,95 +28,74 @@
|
|||||||
|
|
||||||
char *osd_get_clipboard_text(void)
|
char *osd_get_clipboard_text(void)
|
||||||
{
|
{
|
||||||
char *result = NULL; /* core expects a malloced C string of uft8 data */
|
OSStatus err;
|
||||||
|
|
||||||
PasteboardRef pasteboard_ref;
|
PasteboardRef pasteboard_ref;
|
||||||
OSStatus err;
|
|
||||||
PasteboardSyncFlags sync_flags;
|
|
||||||
PasteboardItemID item_id;
|
|
||||||
CFIndex flavor_count;
|
|
||||||
CFArrayRef flavor_type_array;
|
|
||||||
CFIndex flavor_index;
|
|
||||||
ItemCount item_count;
|
|
||||||
UInt32 item_index;
|
|
||||||
Boolean success = false;
|
|
||||||
|
|
||||||
err = PasteboardCreate(kPasteboardClipboard, &pasteboard_ref);
|
err = PasteboardCreate(kPasteboardClipboard, &pasteboard_ref);
|
||||||
|
if (err)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (!err)
|
PasteboardSynchronize(pasteboard_ref);
|
||||||
|
|
||||||
|
ItemCount item_count;
|
||||||
|
err = PasteboardGetItemCount(pasteboard_ref, &item_count);
|
||||||
|
|
||||||
|
char *result = NULL; // core expects a malloced C string of uft8 data
|
||||||
|
for (UInt32 item_index = 1; (item_index <= item_count) && !result; item_index++)
|
||||||
{
|
{
|
||||||
sync_flags = PasteboardSynchronize( pasteboard_ref );
|
PasteboardItemID item_id;
|
||||||
|
err = PasteboardGetItemIdentifier(pasteboard_ref, item_index, &item_id);
|
||||||
|
if (err)
|
||||||
|
continue;
|
||||||
|
|
||||||
err = PasteboardGetItemCount(pasteboard_ref, &item_count );
|
CFArrayRef flavor_type_array;
|
||||||
|
err = PasteboardCopyItemFlavors(pasteboard_ref, item_id, &flavor_type_array);
|
||||||
|
if (err)
|
||||||
|
continue;
|
||||||
|
|
||||||
for (item_index=1; item_index<=item_count; item_index++)
|
CFIndex const flavor_count = CFArrayGetCount(flavor_type_array);
|
||||||
|
for (CFIndex flavor_index = 0; (flavor_index < flavor_count) && !result; flavor_index++)
|
||||||
{
|
{
|
||||||
err = PasteboardGetItemIdentifier(pasteboard_ref, item_index, &item_id);
|
CFStringRef const flavor_type = (CFStringRef)CFArrayGetValueAtIndex(flavor_type_array, flavor_index);
|
||||||
|
|
||||||
|
CFStringEncoding encoding;
|
||||||
|
if (UTTypeConformsTo(flavor_type, kUTTypeUTF16PlainText))
|
||||||
|
encoding = kCFStringEncodingUTF16;
|
||||||
|
else if (UTTypeConformsTo (flavor_type, kUTTypeUTF8PlainText))
|
||||||
|
encoding = kCFStringEncodingUTF8;
|
||||||
|
else if (UTTypeConformsTo (flavor_type, kUTTypePlainText))
|
||||||
|
encoding = kCFStringEncodingMacRoman;
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
|
||||||
|
CFDataRef flavor_data;
|
||||||
|
err = PasteboardCopyItemFlavorData(pasteboard_ref, item_id, flavor_type, &flavor_data);
|
||||||
|
|
||||||
if (!err)
|
if (!err)
|
||||||
{
|
{
|
||||||
err = PasteboardCopyItemFlavors(pasteboard_ref, item_id, &flavor_type_array);
|
CFStringRef string_ref = CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, flavor_data, encoding);
|
||||||
|
CFDataRef data_ref = CFStringCreateExternalRepresentation (kCFAllocatorDefault, string_ref, kCFStringEncodingUTF8, '?');
|
||||||
|
CFRelease(string_ref);
|
||||||
|
CFRelease(flavor_data);
|
||||||
|
|
||||||
if (!err)
|
CFIndex const length = CFDataGetLength(data_ref);
|
||||||
|
CFRange const range = CFRangeMake(0, length);
|
||||||
|
|
||||||
|
result = reinterpret_cast<char *>(osd_malloc_array(length + 1));
|
||||||
|
if (result)
|
||||||
{
|
{
|
||||||
flavor_count = CFArrayGetCount(flavor_type_array);
|
CFDataGetBytes(data_ref, range, reinterpret_cast<unsigned char *>(result));
|
||||||
|
result[length] = 0;
|
||||||
for (flavor_index = 0; flavor_index < flavor_count; flavor_index++)
|
|
||||||
{
|
|
||||||
CFStringRef flavor_type;
|
|
||||||
CFDataRef flavor_data;
|
|
||||||
CFStringEncoding encoding;
|
|
||||||
CFStringRef string_ref;
|
|
||||||
CFDataRef data_ref;
|
|
||||||
CFIndex length;
|
|
||||||
CFRange range;
|
|
||||||
|
|
||||||
flavor_type = (CFStringRef)CFArrayGetValueAtIndex(flavor_type_array, flavor_index);
|
|
||||||
|
|
||||||
if (UTTypeConformsTo (flavor_type, kUTTypeUTF16PlainText))
|
|
||||||
encoding = kCFStringEncodingUTF16;
|
|
||||||
else if (UTTypeConformsTo (flavor_type, kUTTypeUTF8PlainText))
|
|
||||||
encoding = kCFStringEncodingUTF8;
|
|
||||||
else if (UTTypeConformsTo (flavor_type, kUTTypePlainText))
|
|
||||||
encoding = kCFStringEncodingMacRoman;
|
|
||||||
else
|
|
||||||
continue;
|
|
||||||
|
|
||||||
err = PasteboardCopyItemFlavorData(pasteboard_ref, item_id, flavor_type, &flavor_data);
|
|
||||||
|
|
||||||
if( !err )
|
|
||||||
{
|
|
||||||
string_ref = CFStringCreateFromExternalRepresentation (kCFAllocatorDefault, flavor_data, encoding);
|
|
||||||
data_ref = CFStringCreateExternalRepresentation (kCFAllocatorDefault, string_ref, kCFStringEncodingUTF8, '?');
|
|
||||||
|
|
||||||
length = CFDataGetLength (data_ref);
|
|
||||||
range = CFRangeMake (0,length);
|
|
||||||
|
|
||||||
result = (char *)osd_malloc_array (length+1);
|
|
||||||
if (result != NULL)
|
|
||||||
{
|
|
||||||
CFDataGetBytes (data_ref, range, (unsigned char *)result);
|
|
||||||
result[length] = 0;
|
|
||||||
success = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
CFRelease(data_ref);
|
|
||||||
CFRelease(string_ref);
|
|
||||||
CFRelease(flavor_data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CFRelease(flavor_type_array);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (success)
|
CFRelease(data_ref);
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CFRelease(pasteboard_ref);
|
CFRelease(flavor_type_array);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CFRelease(pasteboard_ref);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user