File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ internal enum _Normalization {
32
32
// musical notes). This expansion is capped by the maximum expansion factor of
33
33
// the normal form. For NFC, that is 3x.
34
34
internal static let _maxNFCExpansionFactor = 3
35
+ internal static let _maxUTF16toUTF8ExpansionFactor = 3
35
36
}
36
37
37
38
extension Unicode . Scalar {
@@ -117,9 +118,10 @@ internal enum NormalizationResult {
117
118
}
118
119
119
120
static func bufferTooSmall( count: Int ) -> NormalizationResult {
120
- let outputBufferSize = count * 9
121
+ let outputBufferSize =
122
+ count * _Normalization. _maxNFCExpansionFactor * _Normalization. _maxUTF16toUTF8ExpansionFactor
121
123
let icuInputBufferSize = count
122
- let icuOutputBufferSize = count * 3
124
+ let icuOutputBufferSize = count * _Normalization . _maxNFCExpansionFactor
123
125
let resizeRequest = BufferResizeRequest (
124
126
outputBufferSize: outputBufferSize,
125
127
icuInputBufferSize: icuInputBufferSize,
You can’t perform that action at this time.
0 commit comments