diff options
Diffstat (limited to 'WebCore/platform/text/CString.cpp')
-rw-r--r-- | WebCore/platform/text/CString.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/WebCore/platform/text/CString.cpp b/WebCore/platform/text/CString.cpp index f1434ad..4300b29 100644 --- a/WebCore/platform/text/CString.cpp +++ b/WebCore/platform/text/CString.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,8 +26,7 @@ #include "config.h" #include "CString.h" - -using std::min; +#include "DeprecatedCString.h" namespace WebCore { @@ -41,12 +40,17 @@ CString::CString(const char* str, unsigned length) init(str, length); } +CString::CString(const DeprecatedCString& str) +{ + init(str.data(), str.length()); +} + void CString::init(const char* str, unsigned length) { if (!str) return; - m_buffer = CStringBuffer::create(length + 1); + m_buffer = new CStringBuffer(length + 1); memcpy(m_buffer->data(), str, length); m_buffer->data()[length] = '\0'; } @@ -68,11 +72,16 @@ unsigned CString::length() const { return m_buffer ? m_buffer->length() - 1 : 0; } + +DeprecatedCString CString::deprecatedCString() const +{ + return DeprecatedCString(data(), length() + 1); +} CString CString::newUninitialized(size_t length, char*& characterBuffer) { CString result; - result.m_buffer = CStringBuffer::create(length + 1); + result.m_buffer = new CStringBuffer(length + 1); char* bytes = result.m_buffer->data(); bytes[length] = '\0'; characterBuffer = bytes; @@ -86,7 +95,7 @@ void CString::copyBufferIfNeeded() int len = m_buffer->length(); RefPtr<CStringBuffer> m_temp = m_buffer; - m_buffer = CStringBuffer::create(len); + m_buffer = new CStringBuffer(len); memcpy(m_buffer->data(), m_temp->data(), len); } |