|
1 | 1 | #= |
2 | 2 | LatinStr/_LatinStr type (ISO Latin1 8-bit subset of Unicode) |
3 | 3 |
|
4 | | -Copyright 2017 Gandalf Software, Inc., Scott P. Jones, and other contributors to the Julia language |
| 4 | +Copyright 2017-2022 Gandalf Software, Inc., Scott P. Jones, |
| 5 | +and other contributors to the Julia language |
5 | 6 | Licensed under MIT License, see LICENSE.md |
6 | 7 | Based in part on code for ASCIIString that used to be in Julia |
7 | 8 | =# |
@@ -50,7 +51,7 @@ const LatinSubStr = SubString{<:Str{LatinCSE}} |
50 | 51 | const _LatinSubStr = SubString{<:Str{_LatinCSE}} |
51 | 52 |
|
52 | 53 | _cpyconvert(::Type{C}, str) where {C} = Str(C, _copysub(str))::Str{C,Nothing,Nothing,Nothing} |
53 | | -_cpysubset(::Type{_LatinCSE}, str) = Str(is_ascii(s) ? ASCIICSE : _LatinCSE, _copysub(s)) |
| 54 | +_cpysubset(::Type{_LatinCSE}, str) = Str(is_ascii(str) ? ASCIICSE : _LatinCSE, _copysub(str)) |
54 | 55 |
|
55 | 56 | convert(::Type{<:Str{LatinCSE}}, s::Str{LatinCSE}) = s |
56 | 57 | convert(::Type{<:Str{LatinCSE}}, s::Str{ASCIICSE}) = _cpyconvert(LatinCSE, s) |
|
167 | 168 |
|
168 | 169 | function convert(::Type{<:Str{C}}, vec::Vector{CU}) where {C<:Latin_CSEs,CU<:CodeUnitTypes} |
169 | 170 | # handle zero length string quickly |
170 | | - (len = length(vec)) == 0 && return _empty_str(C) |
| 171 | + (len = length(vec)) == 0 && return empty_str(C) |
171 | 172 | @preserve vec begin |
172 | 173 | pnt = pointer(vec) |
173 | 174 | # get number of bytes to allocate |
|
0 commit comments