You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.2 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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. #include "rtc_base/crypt_string.h"
  11. namespace rtc {
  12. size_t EmptyCryptStringImpl::GetLength() const {
  13. return 0;
  14. }
  15. void EmptyCryptStringImpl::CopyTo(char* dest, bool nullterminate) const {
  16. if (nullterminate) {
  17. *dest = '\0';
  18. }
  19. }
  20. std::string EmptyCryptStringImpl::UrlEncode() const {
  21. return "";
  22. }
  23. CryptStringImpl* EmptyCryptStringImpl::Copy() const {
  24. return new EmptyCryptStringImpl();
  25. }
  26. void EmptyCryptStringImpl::CopyRawTo(std::vector<unsigned char>* dest) const {
  27. dest->clear();
  28. }
  29. CryptString::CryptString() : impl_(new EmptyCryptStringImpl()) {}
  30. CryptString::CryptString(const CryptString& other)
  31. : impl_(other.impl_->Copy()) {}
  32. CryptString::CryptString(const CryptStringImpl& impl) : impl_(impl.Copy()) {}
  33. CryptString::~CryptString() = default;
  34. } // namespace rtc