void ThreadableWebSocketChannelClientWrapper::setExtensions(const String& extensions)
{
    unsigned length = extensions.length();
    m_extensions.resize(length);
    if (length)
        memcpy(m_extensions.data(), extensions.deprecatedCharacters(), sizeof(UChar) * length);
}
void ThreadableWebSocketChannelClientWrapper::setSubprotocol(const String& subprotocol)
{
    unsigned length = subprotocol.length();
    m_subprotocol.resize(length);
    if (length)
        memcpy(m_subprotocol.data(), subprotocol.deprecatedCharacters(), sizeof(UChar) * length);
}
Example #3
0
std::unique_ptr<Length[]> newCoordsArray(const String& string, int& len)
{
    unsigned length = string.length();
    const UChar* data = string.deprecatedCharacters();
    StringBuffer<UChar> spacified(length);
    for (unsigned i = 0; i < length; i++) {
        UChar cc = data[i];
        if (cc > '9' || (cc < '0' && cc != '-' && cc != '*' && cc != '.'))
            spacified[i] = ' ';
        else
            spacified[i] = cc;
    }
    RefPtr<StringImpl> str = StringImpl::adopt(spacified);

    str = str->simplifyWhiteSpace();

    len = countCharacter(str->deprecatedCharacters(), str->length(), ' ') + 1;
    auto r = std::make_unique<Length[]>(len);

    int i = 0;
    unsigned pos = 0;
    size_t pos2;

    while ((pos2 = str->find(' ', pos)) != notFound) {
        r[i++] = parseLength(str->deprecatedCharacters() + pos, pos2 - pos);
        pos = pos2+1;
    }
    r[i] = parseLength(str->deprecatedCharacters() + pos, str->length() - pos);

    ASSERT(i == len - 1);

    return r;
}
Example #4
0
 explicit IDBKeyPathLexer(const String& s)
     : m_string(s)
     , m_ptr(s.deprecatedCharacters())
     , m_end(s.deprecatedCharacters() + s.length())
     , m_currentTokenType(TokenError)
 {
 }
Example #5
0
void SVGLengthList::parse(const String& value, SVGLengthMode mode)
{
    clear();
    ExceptionCode ec = 0;

    const UChar* ptr = value.deprecatedCharacters();
    const UChar* end = ptr + value.length();
    while (ptr < end) {
        const UChar* start = ptr;
        while (ptr < end && *ptr != ',' && !isSVGSpace(*ptr))
            ptr++;
        if (ptr == start)
            break;

        SVGLength length(mode);
        String valueString(start, ptr - start);
        if (valueString.isEmpty())
            return;
        length.setValueAsString(valueString, ec);
        if (ec)
            return;
        append(length);
        skipOptionalSVGSpacesOrDelimiter(ptr, end);
    }
}