@@ -91,7 +91,7 @@ public final class _DataStorage {
91
91
num -= pages
92
92
}
93
93
if num > 0 {
94
- memmove ( dest, source, num)
94
+ memmove ( dest, source! , num)
95
95
}
96
96
}
97
97
@@ -500,7 +500,7 @@ public final class _DataStorage {
500
500
}
501
501
if replacementLength != 0 {
502
502
if replacementBytes != nil {
503
- memmove ( mutableBytes! + start, replacementBytes, replacementLength)
503
+ memmove ( mutableBytes! + start, replacementBytes! , replacementLength)
504
504
} else {
505
505
memset ( mutableBytes! + start, 0 , replacementLength)
506
506
}
@@ -822,7 +822,10 @@ public final class _DataStorage {
822
822
if lhs. bytes == rhs. bytes {
823
823
return true
824
824
}
825
- return memcmp ( lhs. _bytes, rhs. _bytes, length1) == 0
825
+ if length1 > 0 {
826
+ return memcmp ( lhs. _bytes!, rhs. _bytes!, length1) == 0
827
+ }
828
+ return true
826
829
}
827
830
}
828
831
@@ -932,15 +935,15 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
932
935
/// A custom deallocator.
933
936
case custom( ( UnsafeMutableRawPointer , Int ) -> Void )
934
937
935
- fileprivate var _deallocator : ( ( UnsafeMutableRawPointer , Int ) -> Void ) ? {
938
+ fileprivate var _deallocator : ( ( UnsafeMutableRawPointer , Int ) -> Void ) {
936
939
#if DEPLOYMENT_RUNTIME_SWIFT
937
940
switch self {
938
941
case . unmap:
939
942
return { __NSDataInvokeDeallocatorUnmap ( $0, $1) }
940
943
case . free:
941
944
return { __NSDataInvokeDeallocatorFree ( $0, $1) }
942
945
case . none:
943
- return nil
946
+ return { _ , _ in }
944
947
case . custom( let b) :
945
948
return { ( ptr, len) in
946
949
b ( ptr, len)
@@ -955,7 +958,7 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
955
958
case . free:
956
959
return { __NSDataInvokeDeallocatorFree ( $0, $1) }
957
960
case . none:
958
- return nil
961
+ return { _ , _ in }
959
962
case . custom( let b) :
960
963
return { ( ptr, len) in
961
964
b ( ptr, len)
@@ -1639,7 +1642,10 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
1639
1642
if backing1. bytes == backing2. bytes {
1640
1643
return true
1641
1644
}
1642
- return memcmp ( backing1. bytes, backing2. bytes, length1) == 0
1645
+ if length1 > 0 {
1646
+ return memcmp ( backing1. bytes!, backing2. bytes!, length1) == 0
1647
+ }
1648
+ return true
1643
1649
}
1644
1650
}
1645
1651
0 commit comments