Skip to content

Commit bc78697

Browse files
committed
Fixes
1 parent 0a19832 commit bc78697

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
lines changed

REQUIRE

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
julia 0.6 2-
22
MurmurHash3 0.1.5
3-
ModuleInterfaceTools 0.1.6
3+
ModuleInterfaceTools 0.1.7
44
StrAPI 0.1.8
55
CharSetEncodings 0.1.8
6-
ChrBase 0.1.6
6+
ChrBase 0.1.8

src/casefold.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ function uppercase(str::MaybeSub{S}) where {C<:Union{UCS2_CSEs,UTF32_CSEs},S<:St
359359
pnt = beg = pointer(str)
360360
fin = beg + sizeof(str)
361361
while pnt < fin
362-
_can_upper_ch(get_codeunit(pnt)) && return _upper(C, beg, pnt-beg, ncodeunits(str))
362+
_wide_lower_ch(get_codeunit(pnt)) && return _upper(C, beg, pnt-beg, ncodeunits(str))
363363
pnt += sizeof(CU)
364364
end
365365
str

src/utf16case.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ function uppercase(str::UTF16Str)
9797
prv = pnt
9898
(ch > 0xd7ff # May be surrogate pair
9999
? _islower_u(ch > 0xdfff ? ch%UInt32 : get_supplementary(ch, get_codeunit(pnt += 2)))
100-
: _can_upper_ch(ch)) &&
100+
: _wide_lower_ch(ch)) &&
101101
return _upper(UTF16Str, beg, prv-beg, ncodeunits(str))
102102
pnt += 2
103103
end

src/utf8case.jl

+14-10
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,22 @@ function _upper_utf8(beg, off, len)
9191
out += 1
9292
elseif ch < 0xc4
9393
ch = (ch << 6) | (get_codeunit(pnt += 1) & 0x3f)
94-
if _can_upper_l(ch)
95-
c16 = (ch - 0x20)%UInt16
96-
elseif ch == 0xb5
97-
c16 = 0x39c
98-
elseif ch == 0xff
99-
c16 = 0x178
100-
elseif !V6_COMPAT && ch == 0xdf
101-
c16 = 0x1e9e
94+
if !V6_COMPAT && ch == 0xdf
95+
# Increasing from 2 to 3 bytes, check to see if we need to resize
96+
diff = (outend - out - 3) - (fin - pnt - 1)
97+
if diff < 0
98+
outend -= diff
99+
resize!(buf, outend - out)
100+
out = pointer(buf)
101+
outend = out + sizeof(buf)
102+
end
103+
out = output_utf8_3byte!(out, 0x1e9e)
102104
else
103-
c16 = ch%UInt16
105+
out = output_utf8_2byte!(out, _can_upper_l(ch) ? (ch - 0x20)%UInt16
106+
: ch == 0xb5 ? 0x39c
107+
: ch == 0xff ? 0x178
108+
: ch%UInt16)
104109
end
105-
out = output_utf8_2byte!(out, c16)
106110
elseif ch < 0xe0
107111
# 2 byte
108112
c16 = get_utf8_2byte(pnt += 1, ch)

0 commit comments

Comments
 (0)