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 Jun 22, 2015
1 parent a24dfac commit 6e4087e
Showing 1 changed file with 2 additions and 6 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

0 comments on commit 6e4087e

Please sign in to comment.