@@ -1707,7 +1707,7 @@ - (void)buildDataTransferItems:(std::vector<DataTransferItem> &)dataTransferItem
1707
1707
for (NSString *file in fileNames) {
1708
1708
NSURL *fileURL = [NSURL fileURLWithPath: file];
1709
1709
BOOL isDir = NO ;
1710
- BOOL isValid = (! [[NSFileManager defaultManager ] fileExistsAtPath: fileURL.path isDirectory: &isDir] || isDir) ? NO : YES ;
1710
+ BOOL isValid = [[NSFileManager defaultManager ] fileExistsAtPath: fileURL.path isDirectory: &isDir] && ! isDir;
1711
1711
if (isValid) {
1712
1712
1713
1713
NSString *MIMETypeString = nil ;
@@ -1727,14 +1727,6 @@ - (void)buildDataTransferItems:(std::vector<DataTransferItem> &)dataTransferItem
1727
1727
forKey: NSURLFileSizeKey
1728
1728
error: &fileSizeError];
1729
1729
1730
- NSNumber *width = nil ;
1731
- NSNumber *height = nil ;
1732
- if ([MIMETypeString hasPrefix: @" image/" ]) {
1733
- NSImage *image = [[NSImage alloc ] initWithContentsOfURL: fileURL];
1734
- width = @(image.size .width );
1735
- height = @(image.size .height );
1736
- }
1737
-
1738
1730
DataTransferItem transferItem = {
1739
1731
.name = fileURL.lastPathComponent .UTF8String ,
1740
1732
.kind = " file" ,
@@ -1746,12 +1738,10 @@ - (void)buildDataTransferItems:(std::vector<DataTransferItem> &)dataTransferItem
1746
1738
transferItem.size = fileSizeValue.intValue ;
1747
1739
}
1748
1740
1749
- if (width != nil ) {
1750
- transferItem.width = width.intValue ;
1751
- }
1752
-
1753
- if (height != nil ) {
1754
- transferItem.height = height.intValue ;
1741
+ if ([MIMETypeString hasPrefix: @" image/" ]) {
1742
+ NSImage *image = [[NSImage alloc ] initWithContentsOfURL: fileURL];
1743
+ transferItem.width = static_cast <int >(image.size .width );
1744
+ transferItem.height = static_cast <int >(image.size .height );
1755
1745
}
1756
1746
1757
1747
dataTransferItems.push_back (transferItem);
@@ -1768,9 +1758,9 @@ - (void)buildDataTransferItems:(std::vector<DataTransferItem> &)dataTransferItem
1768
1758
.kind = " image" ,
1769
1759
.type = MIMETypeString.UTF8String ,
1770
1760
.uri = RCTDataURL (MIMETypeString, imageData).absoluteString .UTF8String ,
1771
- .size = imageData.length ,
1772
- .width = image.size .width ,
1773
- .height = image.size .height ,
1761
+ .size = static_cast < int >( imageData.length ) ,
1762
+ .width = static_cast < int >( image.size .width ) ,
1763
+ .height = static_cast < int >( image.size .height ) ,
1774
1764
};
1775
1765
1776
1766
dataTransferItems.push_back (transferItem);
0 commit comments