@@ -67,7 +67,9 @@ extension String {
67
67
/// An array containing a null-terminated sequence of UTF-8 code units.
68
68
@inlinable
69
69
@_alwaysEmitIntoClient
70
- @available ( swift, deprecated: 6 , message: " Use String(decoding: array, as: UTF8.self) instead " )
70
+ @available ( swift, deprecated: 6 , message:
71
+ " Use String(decoding: array, as: UTF8.self) instead, after truncating the null termination. "
72
+ )
71
73
public init ( cString nullTerminatedUTF8: [ CChar ] ) {
72
74
self = nullTerminatedUTF8. withUnsafeBufferPointer {
73
75
$0. withMemoryRebound ( to: UInt8 . self, String . init ( _checkingCString: ) )
@@ -129,7 +131,9 @@ extension String {
129
131
/// An array containing a null-terminated UTF-8 code unit sequence.
130
132
@inlinable
131
133
@_alwaysEmitIntoClient
132
- @available ( swift, deprecated: 6 , message: " Use String(decoding: array, as: UTF8.self) instead " )
134
+ @available ( swift, deprecated: 6 , message:
135
+ " Use String(decoding: array, as: UTF8.self) instead, after truncating the null termination. "
136
+ )
133
137
public init ( cString nullTerminatedUTF8: [ UInt8 ] ) {
134
138
self = nullTerminatedUTF8. withUnsafeBufferPointer {
135
139
String ( _checkingCString: $0)
@@ -244,7 +248,9 @@ extension String {
244
248
/// An array containing a null-terminated sequence of UTF-8 code units.
245
249
@inlinable
246
250
@_alwaysEmitIntoClient
247
- @available ( swift, deprecated: 6 , message: " Use String(validating: array, as: UTF8.self) instead " )
251
+ @available ( swift, deprecated: 6 , message:
252
+ " Use String(validating: array, as: UTF8.self) instead, after truncating the null termination. "
253
+ )
248
254
public init ? ( validatingCString nullTerminatedUTF8: [ CChar ] ) {
249
255
guard let length = nullTerminatedUTF8. firstIndex ( of: 0 ) else {
250
256
_preconditionFailure (
@@ -272,7 +278,9 @@ extension String {
272
278
/// An array containing a null-terminated sequence of UTF-8 code units.
273
279
@inlinable
274
280
@_alwaysEmitIntoClient
275
- @available ( swift, deprecated: 6 , message: " Use String(validating: array, as: UTF8.self) instead " )
281
+ @available ( swift, deprecated: 6 , message:
282
+ " Use String(validating: array, as: UTF8.self) instead, after truncating the null termination. "
283
+ )
276
284
public init ? ( validatingUTF8 cString: [ CChar ] ) {
277
285
self . init ( validatingCString: cString)
278
286
}
@@ -491,7 +499,9 @@ extension String {
491
499
/// interpreted.
492
500
@inlinable
493
501
@_alwaysEmitIntoClient
494
- @available ( swift, deprecated: 6 , message: " Use String(decoding: array, as: Encoding.self) instead " )
502
+ @available ( swift, deprecated: 6 , message:
503
+ " Use String(decoding: array, as: Encoding.self) instead, after truncating the null termination. "
504
+ )
495
505
public init < Encoding: Unicode . Encoding > (
496
506
decodingCString nullTerminatedCodeUnits: [ Encoding . CodeUnit ] ,
497
507
as encoding: Encoding . Type
0 commit comments