@@ -1716,7 +1716,7 @@ - (void)buildDataTransferItems:(std::vector<DataTransferItem> &)dataTransferItem
1716
1716
for (NSString *file in fileNames) {
1717
1717
NSURL *fileURL = [NSURL fileURLWithPath: file];
1718
1718
BOOL isDir = NO ;
1719
- BOOL isValid = (! [[NSFileManager defaultManager ] fileExistsAtPath: fileURL.path isDirectory: &isDir] || isDir) ? NO : YES ;
1719
+ BOOL isValid = [[NSFileManager defaultManager ] fileExistsAtPath: fileURL.path isDirectory: &isDir] && ! isDir;
1720
1720
if (isValid) {
1721
1721
1722
1722
NSString *MIMETypeString = nil ;
@@ -1736,14 +1736,6 @@ - (void)buildDataTransferItems:(std::vector<DataTransferItem> &)dataTransferItem
1736
1736
forKey: NSURLFileSizeKey
1737
1737
error: &fileSizeError];
1738
1738
1739
- NSNumber *width = nil ;
1740
- NSNumber *height = nil ;
1741
- if ([MIMETypeString hasPrefix: @" image/" ]) {
1742
- NSImage *image = [[NSImage alloc ] initWithContentsOfURL: fileURL];
1743
- width = @(image.size .width );
1744
- height = @(image.size .height );
1745
- }
1746
-
1747
1739
DataTransferItem transferItem = {
1748
1740
.name = fileURL.lastPathComponent .UTF8String ,
1749
1741
.kind = " file" ,
@@ -1755,12 +1747,10 @@ - (void)buildDataTransferItems:(std::vector<DataTransferItem> &)dataTransferItem
1755
1747
transferItem.size = fileSizeValue.intValue ;
1756
1748
}
1757
1749
1758
- if (width != nil ) {
1759
- transferItem.width = width.intValue ;
1760
- }
1761
-
1762
- if (height != nil ) {
1763
- transferItem.height = height.intValue ;
1750
+ if ([MIMETypeString hasPrefix: @" image/" ]) {
1751
+ NSImage *image = [[NSImage alloc ] initWithContentsOfURL: fileURL];
1752
+ transferItem.width = static_cast <int >(image.size .width );
1753
+ transferItem.height = static_cast <int >(image.size .height );
1764
1754
}
1765
1755
1766
1756
dataTransferItems.push_back (transferItem);
@@ -1777,9 +1767,9 @@ - (void)buildDataTransferItems:(std::vector<DataTransferItem> &)dataTransferItem
1777
1767
.kind = " image" ,
1778
1768
.type = MIMETypeString.UTF8String ,
1779
1769
.uri = RCTDataURL (MIMETypeString, imageData).absoluteString .UTF8String ,
1780
- .size = imageData.length ,
1781
- .width = image.size .width ,
1782
- .height = image.size .height ,
1770
+ .size = static_cast < int >( imageData.length ) ,
1771
+ .width = static_cast < int >( image.size .width ) ,
1772
+ .height = static_cast < int >( image.size .height ) ,
1783
1773
};
1784
1774
1785
1775
dataTransferItems.push_back (transferItem);
0 commit comments