diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn index 74881be990..57aea4eebf 100644 --- a/rtc_base/BUILD.gn +++ b/rtc_base/BUILD.gn @@ -1284,7 +1284,6 @@ rtc_library("socket_adapters") { ":buffer", ":byte_buffer", ":checks", - ":crypt_string", ":logging", ":stringutils", ":zero_memory", @@ -1599,13 +1598,6 @@ rtc_library("ssl") { } } -rtc_library("crypt_string") { - sources = [ - "crypt_string.cc", - "crypt_string.h", - ] -} - rtc_source_set("gtest_prod") { sources = [ "gtest_prod_util.h" ] } diff --git a/rtc_base/crypt_string.cc b/rtc_base/crypt_string.cc deleted file mode 100644 index cf38a5bbaa..0000000000 --- a/rtc_base/crypt_string.cc +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2015 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#include "rtc_base/crypt_string.h" - -namespace rtc { - -size_t EmptyCryptStringImpl::GetLength() const { - return 0; -} - -void EmptyCryptStringImpl::CopyTo(char* dest, bool nullterminate) const { - if (nullterminate) { - *dest = '\0'; - } -} - -std::string EmptyCryptStringImpl::UrlEncode() const { - return ""; -} - -CryptStringImpl* EmptyCryptStringImpl::Copy() const { - return new EmptyCryptStringImpl(); -} - -void EmptyCryptStringImpl::CopyRawTo(std::vector* dest) const { - dest->clear(); -} - -CryptString::CryptString() : impl_(new EmptyCryptStringImpl()) {} - -CryptString::CryptString(const CryptString& other) - : impl_(other.impl_->Copy()) {} - -CryptString::CryptString(const CryptStringImpl& impl) : impl_(impl.Copy()) {} - -CryptString::~CryptString() = default; - -} // namespace rtc diff --git a/rtc_base/crypt_string.h b/rtc_base/crypt_string.h deleted file mode 100644 index 470bd00c42..0000000000 --- a/rtc_base/crypt_string.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef RTC_BASE_CRYPT_STRING_H_ -#define RTC_BASE_CRYPT_STRING_H_ - -#include - -#include -#include -#include - -namespace rtc { - -class CryptStringImpl { - public: - virtual ~CryptStringImpl() {} - virtual size_t GetLength() const = 0; - virtual void CopyTo(char* dest, bool nullterminate) const = 0; - virtual std::string UrlEncode() const = 0; - virtual CryptStringImpl* Copy() const = 0; - virtual void CopyRawTo(std::vector* dest) const = 0; -}; - -class EmptyCryptStringImpl : public CryptStringImpl { - public: - ~EmptyCryptStringImpl() override {} - size_t GetLength() const override; - void CopyTo(char* dest, bool nullterminate) const override; - std::string UrlEncode() const override; - CryptStringImpl* Copy() const override; - void CopyRawTo(std::vector* dest) const override; -}; - -class CryptString { - public: - CryptString(); - size_t GetLength() const { return impl_->GetLength(); } - void CopyTo(char* dest, bool nullterminate) const { - impl_->CopyTo(dest, nullterminate); - } - CryptString(const CryptString& other); - explicit CryptString(const CryptStringImpl& impl); - ~CryptString(); - CryptString& operator=(const CryptString& other) { - if (this != &other) { - impl_.reset(other.impl_->Copy()); - } - return *this; - } - void Clear() { impl_.reset(new EmptyCryptStringImpl()); } - std::string UrlEncode() const { return impl_->UrlEncode(); } - void CopyRawTo(std::vector* dest) const { - return impl_->CopyRawTo(dest); - } - - private: - std::unique_ptr impl_; -}; - -} // namespace rtc - -#endif // RTC_BASE_CRYPT_STRING_H_ diff --git a/rtc_base/socket_adapters.h b/rtc_base/socket_adapters.h index 33ae94ebe8..c41b4a8655 100644 --- a/rtc_base/socket_adapters.h +++ b/rtc_base/socket_adapters.h @@ -16,7 +16,6 @@ #include "absl/strings/string_view.h" #include "api/array_view.h" #include "rtc_base/async_socket.h" -#include "rtc_base/crypt_string.h" namespace rtc {