Skip to content

Commit

Permalink
Updated to use unsafe_checkstring, fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottPJones committed Jul 8, 2015
1 parent 3d48568 commit 4af9f8f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 450 deletions.
8 changes: 2 additions & 6 deletions base/utf8.jl
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,8 @@ convert(::Type{UTF8String}, s::ASCIIString) = UTF8String(s.data)
"
Converts a UTF-8 encoded vector of `UInt8` to a `UTF8String`
### Input Arguments:
* `::Type{UTF8String}`
* `dat::Vector{UInt8}`
### Returns:
* `::UTF8String`
* `UTF8String`
### Throws:
* `UnicodeError`
Expand All @@ -234,7 +230,7 @@ function convert(::Type{UTF8String}, dat::Vector{UInt8})
# handle zero length string quickly
isempty(dat) && return empty_utf8
# get number of bytes to allocate
len, flags, num4byte, num3byte, num2byte = check_string(dat)
len, flags, num4byte, num3byte, num2byte = unsafe_checkstring(dat)
if (flags & (UTF_LONG | UTF_SURROGATE)) == 0
len = sizeof(dat)
@inbounds return UTF8String(copy!(Vector{UInt8}(len), 1, dat, 1, len))
Expand Down
Loading

0 comments on commit 4af9f8f

Please sign in to comment.