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 "debugconsole.h"
|
||||
#import "debugcommandhistory.h"
|
||||
#import "debugview.h"
|
||||
|
||||
|
@ -153,7 +153,7 @@
|
||||
// set default state
|
||||
[devicesView expandItem:root expandChildren:YES];
|
||||
[window makeFirstResponder:devicesView];
|
||||
[window setTitle:[NSString stringWithFormat:@"All Devices"]];
|
||||
[window setTitle:@"All Devices"];
|
||||
|
||||
// calculate the optimal size for everything
|
||||
NSSize const desired = [NSScrollView frameSizeForContentSize:NSMakeSize(480, 320)
|
||||
|
@ -793,13 +793,13 @@ static void UpdateChangeCountCallback(void *userData,
|
||||
newEffectMenu = [[NSMenu allocWithZone:[NSMenu zone]] initWithTitle:@"New"];
|
||||
[menu setSubmenu:newEffectMenu forItem:item];
|
||||
[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]];
|
||||
|
||||
item = [menu addItemWithTitle:@"Close" action:@selector(performClose:) keyEquivalent:@"w"];
|
||||
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:@"Revert to Saved" action:@selector(revertDocumentToSaved:) keyEquivalent:@"u"];
|
||||
}
|
||||
|
@ -28,51 +28,37 @@
|
||||
|
||||
char *osd_get_clipboard_text(void)
|
||||
{
|
||||
char *result = NULL; /* core expects a malloced C string of uft8 data */
|
||||
OSStatus err;
|
||||
|
||||
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);
|
||||
if (err)
|
||||
return NULL;
|
||||
|
||||
if (!err)
|
||||
{
|
||||
sync_flags = PasteboardSynchronize( pasteboard_ref );
|
||||
PasteboardSynchronize(pasteboard_ref);
|
||||
|
||||
ItemCount item_count;
|
||||
err = PasteboardGetItemCount(pasteboard_ref, &item_count);
|
||||
|
||||
for (item_index=1; item_index<=item_count; item_index++)
|
||||
char *result = NULL; // core expects a malloced C string of uft8 data
|
||||
for (UInt32 item_index = 1; (item_index <= item_count) && !result; item_index++)
|
||||
{
|
||||
PasteboardItemID item_id;
|
||||
err = PasteboardGetItemIdentifier(pasteboard_ref, item_index, &item_id);
|
||||
if (err)
|
||||
continue;
|
||||
|
||||
if (!err)
|
||||
{
|
||||
CFArrayRef flavor_type_array;
|
||||
err = PasteboardCopyItemFlavors(pasteboard_ref, item_id, &flavor_type_array);
|
||||
if (err)
|
||||
continue;
|
||||
|
||||
if (!err)
|
||||
CFIndex const flavor_count = CFArrayGetCount(flavor_type_array);
|
||||
for (CFIndex flavor_index = 0; (flavor_index < flavor_count) && !result; flavor_index++)
|
||||
{
|
||||
flavor_count = CFArrayGetCount(flavor_type_array);
|
||||
CFStringRef const flavor_type = (CFStringRef)CFArrayGetValueAtIndex(flavor_type_array, flavor_index);
|
||||
|
||||
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))
|
||||
@ -82,41 +68,34 @@ char *osd_get_clipboard_text(void)
|
||||
else
|
||||
continue;
|
||||
|
||||
CFDataRef flavor_data;
|
||||
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, '?');
|
||||
CFStringRef string_ref = CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, flavor_data, encoding);
|
||||
CFDataRef data_ref = CFStringCreateExternalRepresentation (kCFAllocatorDefault, string_ref, kCFStringEncodingUTF8, '?');
|
||||
CFRelease(string_ref);
|
||||
CFRelease(flavor_data);
|
||||
|
||||
length = CFDataGetLength (data_ref);
|
||||
range = CFRangeMake (0,length);
|
||||
CFIndex const length = CFDataGetLength(data_ref);
|
||||
CFRange const range = CFRangeMake(0, length);
|
||||
|
||||
result = (char *)osd_malloc_array (length+1);
|
||||
if (result != NULL)
|
||||
result = reinterpret_cast<char *>(osd_malloc_array(length + 1));
|
||||
if (result)
|
||||
{
|
||||
CFDataGetBytes (data_ref, range, (unsigned char *)result);
|
||||
CFDataGetBytes(data_ref, range, reinterpret_cast<unsigned char *>(result));
|
||||
result[length] = 0;
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
|
||||
CFRelease(data_ref);
|
||||
CFRelease(string_ref);
|
||||
CFRelease(flavor_data);
|
||||
}
|
||||
}
|
||||
|
||||
CFRelease(flavor_type_array);
|
||||
}
|
||||
}
|
||||
|
||||
if (success)
|
||||
break;
|
||||
}
|
||||
|
||||
CFRelease(pasteboard_ref);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user