Remove unused rtc_base crypt_string

BUG=None

Change-Id: I6a3e34a9d086699912b7f11f3f5d01e84669eb2d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/350144
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@meta.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42331}
This commit is contained in:
Philipp Hancke 2024-05-07 13:18:54 -07:00 committed by WebRTC LUCI CQ
parent bad99ab253
commit 4b8cfc4f13
4 changed files with 0 additions and 125 deletions

View File

@ -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" ]
}

View File

@ -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<unsigned char>* 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

View File

@ -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 <string.h>
#include <memory>
#include <string>
#include <vector>
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<unsigned char>* 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<unsigned char>* 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<unsigned char>* dest) const {
return impl_->CopyRawTo(dest);
}
private:
std::unique_ptr<const CryptStringImpl> impl_;
};
} // namespace rtc
#endif // RTC_BASE_CRYPT_STRING_H_

View File

@ -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 {