diff options
author | Tor Lillqvist <tml@collabora.com> | 2021-11-19 13:16:58 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2021-11-19 13:46:08 +0200 |
commit | c5a72ac64ff11d245f80bee2e743548d10319e04 (patch) | |
tree | 8255a6bd1131e0c3efd3cdf3f23e3c44d801fc7d /vcl/workben | |
parent | c705a5a65c88f11c197af19a6586175dc7ddc3c6 (diff) |
Upgrade to un-deprecated API and fix a crash in the pasteboard.mm helper tool
Change-Id: Ic0b839df686fb93c64ef844848028ded39225ced
Diffstat (limited to 'vcl/workben')
-rw-r--r-- | vcl/workben/pasteboard.mm | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/vcl/workben/pasteboard.mm b/vcl/workben/pasteboard.mm index 6a28430831b4..4123f8eae022 100644 --- a/vcl/workben/pasteboard.mm +++ b/vcl/workben/pasteboard.mm @@ -10,12 +10,13 @@ // List the contents of the macOS pasteboard -// Build with: clang++ -Wall -o pasteboard vcl/workben/pasteboard.mm -framework AppKit +// Build with: clang++ -g -Wall -o pasteboard pasteboard.mm -framework AppKit -framework UniformTypeIdentifiers #import <unistd.h> #import <iostream> #import <AppKit/AppKit.h> +#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h> static void usage() { @@ -31,7 +32,7 @@ static void usage() int main(int argc, char** argv) { - NSString* requestedType; + NSString* requestedType = @""; int ch; @@ -108,14 +109,14 @@ int main(int argc, char** argv) NSArray<NSPasteboardType>* types = [items[i] types]; for (unsigned j = 0; j < [types count]; j++) { - std::cout << " " << j << ": " << [types[j] UTF8String]; - - if ([types[j] isEqualToString:(NSString*)kUTTypePlainText] || - [types[j] isEqualToString:(NSString*)kUTTypeUTF8PlainText] || - [types[j] isEqualToString:(NSString*)kUTTypeText] || - [types[j] isEqualToString:(NSString*)kUTTypeHTML] || - [types[j] isEqualToString:(NSString*)kUTTypeRTF] || - [types[j] isEqualToString:(NSString*)kUTTypeUTF16ExternalPlainText]) + std::cout << " " << j << ": " << [types[j] UTF8String] << std::flush; + + if ([types[j] isEqualToString:[UTTypePlainText identifier]] || + [types[j] isEqualToString:[UTTypeUTF8PlainText identifier]] || + [types[j] isEqualToString:[UTTypeText identifier]] || + [types[j] isEqualToString:[UTTypeHTML identifier]] || + [types[j] isEqualToString:[UTTypeRTF identifier]] || + [types[j] isEqualToString:[UTTypeUTF16ExternalPlainText identifier]]) { NSString* string = [items[i] stringForType:NSPasteboardTypeString]; if ([string length] > 500) |