deadbeef | f137e97 | 2017-03-23 22:45:49 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 The WebRTC Project Authors. All rights reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Steve Anton | 10542f2 | 2019-01-11 17:11:00 | [diff] [blame] | 11 | #include "rtc_base/crypt_string.h" |
deadbeef | f137e97 | 2017-03-23 22:45:49 | [diff] [blame] | 12 | |
| 13 | namespace rtc { |
| 14 | |
| 15 | size_t EmptyCryptStringImpl::GetLength() const { |
| 16 | return 0; |
| 17 | } |
| 18 | |
| 19 | void EmptyCryptStringImpl::CopyTo(char* dest, bool nullterminate) const { |
| 20 | if (nullterminate) { |
| 21 | *dest = '\0'; |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | std::string EmptyCryptStringImpl::UrlEncode() const { |
| 26 | return ""; |
| 27 | } |
| 28 | |
| 29 | CryptStringImpl* EmptyCryptStringImpl::Copy() const { |
| 30 | return new EmptyCryptStringImpl(); |
| 31 | } |
| 32 | |
| 33 | void EmptyCryptStringImpl::CopyRawTo(std::vector<unsigned char>* dest) const { |
| 34 | dest->clear(); |
| 35 | } |
| 36 | |
Yves Gerey | 665174f | 2018-06-19 13:03:05 | [diff] [blame] | 37 | CryptString::CryptString() : impl_(new EmptyCryptStringImpl()) {} |
deadbeef | f137e97 | 2017-03-23 22:45:49 | [diff] [blame] | 38 | |
| 39 | CryptString::CryptString(const CryptString& other) |
Yves Gerey | 665174f | 2018-06-19 13:03:05 | [diff] [blame] | 40 | : impl_(other.impl_->Copy()) {} |
deadbeef | f137e97 | 2017-03-23 22:45:49 | [diff] [blame] | 41 | |
Yves Gerey | 665174f | 2018-06-19 13:03:05 | [diff] [blame] | 42 | CryptString::CryptString(const CryptStringImpl& impl) : impl_(impl.Copy()) {} |
deadbeef | f137e97 | 2017-03-23 22:45:49 | [diff] [blame] | 43 | |
| 44 | CryptString::~CryptString() = default; |
| 45 | |
Nico Weber | 22f9925 | 2019-02-20 15:13:16 | [diff] [blame] | 46 | } // namespace rtc |