You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// FIXME: This is a hook for bypassing a conditional conformance implementation to apply a strategy (see SR-5206). Remove this once conditional conformance is available.
break /* fall back to default implementation below; this would recurse */
1936
-
1937
-
default:
1938
-
// _JSONDecoder has a hook for Datas; this won't recurse since we're not going to defer back to Data in _JSONDecoder.
1939
-
self=try singleValueContainer.decode(Data.self)
1940
-
return
1941
-
}
1942
-
}
1943
-
}catch{ /* fall back to default implementation below */ }
1944
-
1945
1929
varcontainer=try decoder.unkeyedContainer()
1946
1930
1947
1931
// It's more efficient to pre-allocate the buffer if we can.
1948
1932
iflet count = container.count {
1949
-
self=Data(count: count)
1933
+
self.init(count: count)
1950
1934
1951
1935
// Loop only until count, not while !container.isAtEnd, in case count is underestimated (this is misbehavior) and we haven't allocated enough space.
1952
1936
// We don't want to write past the end of what we allocated.
@@ -1955,7 +1939,7 @@ extension Data : Codable {
1955
1939
self[i]= byte
1956
1940
}
1957
1941
}else{
1958
-
self=Data()
1942
+
self.init()
1959
1943
}
1960
1944
1961
1945
while !container.isAtEnd {
@@ -1965,21 +1949,6 @@ extension Data : Codable {
1965
1949
}
1966
1950
1967
1951
publicfunc encode(to encoder:Encoder)throws{
1968
-
// FIXME: This is a hook for bypassing a conditional conformance implementation to apply a strategy (see SR-5206). Remove this once conditional conformance is available.
1969
-
// We are allowed to request this container as long as we don't encode anything through it when we need the unkeyed container below.
0 commit comments