diff --git a/LICENSE_THIRD_PARTY b/LICENSE_THIRD_PARTY index 5bf445d97a..28a0c93807 100644 --- a/LICENSE_THIRD_PARTY +++ b/LICENSE_THIRD_PARTY @@ -2,8 +2,6 @@ This source tree contains third party source code which is governed by third party licenses. Paths to the files and associated licenses are collected here. Files governed by third party licenses: -rtc_base/base64.cc -rtc_base/base64.h rtc_base/sigslot.cc rtc_base/sigslot.h common_audio/fft4g.c @@ -22,26 +20,6 @@ modules/audio_device/mac/portaudio/pa_ringbuffer.h Individual licenses for each file: ------------------------------------------------------------------------------- Files: -rtc_base/base64.cc -rtc_base/base64.h - -License: -//********************************************************************* -//* Base64 - a simple base64 encoder and decoder. -//* -//* Copyright (c) 1999, Bob Withers - bwit@pobox.com -//* -//* This code may be freely used for any purpose, either personal -//* or commercial, provided the authors copyright notice remains -//* intact. -//* -//* Enhancements by Stanley Yamane: -//* o reverse lookup table for the decode function -//* o reserve string buffer space in advance -//* -//********************************************************************* -------------------------------------------------------------------------------- -Files: rtc_base/sigslot.cc rtc_base/sigslot.h diff --git a/media/BUILD.gn b/media/BUILD.gn index af72a83941..04c9cc301a 100644 --- a/media/BUILD.gn +++ b/media/BUILD.gn @@ -236,8 +236,8 @@ rtc_static_library("rtc_audio_video") { "../modules/video_coding:video_coding", "../modules/video_coding:video_coding_utility", "../rtc_base:audio_format_to_string", - "../rtc_base:base64", "../rtc_base:checks", + "../rtc_base/third_party/base64", ] sources = [ diff --git a/media/engine/webrtcvoiceengine.cc b/media/engine/webrtcvoiceengine.cc index aca853f805..715d68fc60 100644 --- a/media/engine/webrtcvoiceengine.cc +++ b/media/engine/webrtcvoiceengine.cc @@ -33,7 +33,6 @@ #include "modules/audio_processing/aec_dump/aec_dump_factory.h" #include "modules/audio_processing/include/audio_processing.h" #include "rtc_base/arraysize.h" -#include "rtc_base/base64.h" #include "rtc_base/byteorder.h" #include "rtc_base/constructormagic.h" #include "rtc_base/helpers.h" @@ -42,6 +41,7 @@ #include "rtc_base/stringencode.h" #include "rtc_base/strings/audio_format_to_string.h" #include "rtc_base/stringutils.h" +#include "rtc_base/third_party/base64/base64.h" #include "rtc_base/trace_event.h" #include "system_wrappers/include/field_trial.h" #include "system_wrappers/include/metrics.h" diff --git a/modules/desktop_capture/BUILD.gn b/modules/desktop_capture/BUILD.gn index 869b269ee8..94a3346133 100644 --- a/modules/desktop_capture/BUILD.gn +++ b/modules/desktop_capture/BUILD.gn @@ -53,9 +53,9 @@ if (rtc_include_tests) { ":desktop_capture_mock", ":primitives", ":screen_drawer", - "../../rtc_base:base64", "../../rtc_base:rtc_base", "../../rtc_base:rtc_base_approved", + "../../rtc_base/third_party/base64", "../../system_wrappers", "../../test:test_support", "../../test:video_test_support", diff --git a/modules/desktop_capture/screen_capturer_integration_test.cc b/modules/desktop_capture/screen_capturer_integration_test.cc index fdcf67bf0a..3fe38daabe 100644 --- a/modules/desktop_capture/screen_capturer_integration_test.cc +++ b/modules/desktop_capture/screen_capturer_integration_test.cc @@ -24,10 +24,10 @@ #include "modules/desktop_capture/mock_desktop_capturer_callback.h" #include "modules/desktop_capture/rgba_color.h" #include "modules/desktop_capture/screen_drawer.h" -#include "rtc_base/base64.h" #include "rtc_base/checks.h" #include "rtc_base/constructormagic.h" #include "rtc_base/logging.h" +#include "rtc_base/third_party/base64/base64.h" #include "test/gmock.h" #include "test/gtest.h" diff --git a/modules/video_coding/BUILD.gn b/modules/video_coding/BUILD.gn index 50037996fe..21d8490fff 100644 --- a/modules/video_coding/BUILD.gn +++ b/modules/video_coding/BUILD.gn @@ -163,7 +163,6 @@ rtc_static_library("video_coding") { "../../api/video:video_frame_i420", "../../api/video_codecs:video_codecs_api", "../../common_video", - "../../rtc_base:base64", "../../rtc_base:checks", "../../rtc_base:rtc_base", "../../rtc_base:rtc_base_approved", @@ -172,6 +171,7 @@ rtc_static_library("video_coding") { "../../rtc_base:sequenced_task_checker", "../../rtc_base/experiments:alr_experiment", "../../rtc_base/system:fallthrough", + "../../rtc_base/third_party/base64", "../../rtc_base/time:timestamp_extrapolator", "../../system_wrappers", "../../system_wrappers:field_trial_api", diff --git a/modules/video_coding/h264_sprop_parameter_sets.cc b/modules/video_coding/h264_sprop_parameter_sets.cc index a05a2a7ed1..e858545682 100644 --- a/modules/video_coding/h264_sprop_parameter_sets.cc +++ b/modules/video_coding/h264_sprop_parameter_sets.cc @@ -13,8 +13,8 @@ #include #include -#include "rtc_base/base64.h" #include "rtc_base/logging.h" +#include "rtc_base/third_party/base64/base64.h" namespace { diff --git a/p2p/BUILD.gn b/p2p/BUILD.gn index 4763001f49..e62822c6cb 100644 --- a/p2p/BUILD.gn +++ b/p2p/BUILD.gn @@ -85,11 +85,11 @@ rtc_static_library("rtc_p2p") { "../api:libjingle_peerconnection_api", "../api:ortc_api", "../logging:ice_log", - "../rtc_base:base64", "../rtc_base:checks", "../rtc_base:rtc_base", "../rtc_base:safe_minmax", "../rtc_base:stringutils", + "../rtc_base/third_party/base64", "../system_wrappers:field_trial_api", "../system_wrappers:metrics_api", "//third_party/abseil-cpp/absl/memory", diff --git a/p2p/base/port.cc b/p2p/base/port.cc index 5beb2bfe6e..9ec9dee390 100644 --- a/p2p/base/port.cc +++ b/p2p/base/port.cc @@ -18,7 +18,6 @@ #include "absl/memory/memory.h" #include "p2p/base/portallocator.h" -#include "rtc_base/base64.h" #include "rtc_base/checks.h" #include "rtc_base/crc32.h" #include "rtc_base/helpers.h" @@ -28,6 +27,7 @@ #include "rtc_base/numerics/safe_minmax.h" #include "rtc_base/stringencode.h" #include "rtc_base/stringutils.h" +#include "rtc_base/third_party/base64/base64.h" namespace { diff --git a/pc/BUILD.gn b/pc/BUILD.gn index 329d66730f..5a3329d40a 100644 --- a/pc/BUILD.gn +++ b/pc/BUILD.gn @@ -79,11 +79,11 @@ rtc_static_library("rtc_pc_base") { "../media:rtc_media_base", "../modules/rtp_rtcp:rtp_rtcp_format", "../p2p:rtc_p2p", - "../rtc_base:base64", "../rtc_base:checks", "../rtc_base:rtc_base", "../rtc_base:rtc_task_queue", "../rtc_base:stringutils", + "../rtc_base/third_party/base64", "../system_wrappers:metrics_api", "//third_party/abseil-cpp/absl/memory", "//third_party/abseil-cpp/absl/types:optional", @@ -197,12 +197,12 @@ rtc_static_library("peerconnection") { "../media:rtc_media_base", "../modules/congestion_controller/bbr", "../p2p:rtc_p2p", - "../rtc_base:base64", "../rtc_base:checks", "../rtc_base:rtc_base", "../rtc_base:rtc_base_approved", "../rtc_base:stringutils", "../rtc_base/experiments:congestion_controller_experiment", + "../rtc_base/third_party/base64", "../stats", "../system_wrappers", "../system_wrappers:field_trial_api", @@ -478,9 +478,9 @@ if (rtc_include_tests) { "../api:mock_rtp", "../api/units:time_delta", "../logging:fake_rtc_event_log", - "../rtc_base:base64", "../rtc_base:checks", "../rtc_base:stringutils", + "../rtc_base/third_party/base64", "../test:fileutils", "//third_party/abseil-cpp/absl/memory", ] diff --git a/pc/mediasession.cc b/pc/mediasession.cc index 37354b8beb..23706be6df 100644 --- a/pc/mediasession.cc +++ b/pc/mediasession.cc @@ -27,11 +27,11 @@ #include "pc/channelmanager.h" #include "pc/rtpmediautils.h" #include "pc/srtpfilter.h" -#include "rtc_base/base64.h" #include "rtc_base/checks.h" #include "rtc_base/helpers.h" #include "rtc_base/logging.h" #include "rtc_base/stringutils.h" +#include "rtc_base/third_party/base64/base64.h" namespace { diff --git a/pc/srtpfilter.cc b/pc/srtpfilter.cc index 91142a5aa0..5ffe34212e 100644 --- a/pc/srtpfilter.cc +++ b/pc/srtpfilter.cc @@ -16,11 +16,11 @@ #include "media/base/rtputils.h" #include "pc/srtpsession.h" -#include "rtc_base/base64.h" #include "rtc_base/byteorder.h" #include "rtc_base/checks.h" #include "rtc_base/logging.h" #include "rtc_base/stringencode.h" +#include "rtc_base/third_party/base64/base64.h" #include "rtc_base/timeutils.h" #include "rtc_base/zero_memory.h" diff --git a/pc/srtptransport.cc b/pc/srtptransport.cc index 0c5265ca5a..6fd8be37c2 100644 --- a/pc/srtptransport.cc +++ b/pc/srtptransport.cc @@ -18,9 +18,9 @@ #include "pc/rtptransport.h" #include "pc/srtpsession.h" #include "rtc_base/asyncpacketsocket.h" -#include "rtc_base/base64.h" #include "rtc_base/copyonwritebuffer.h" #include "rtc_base/numerics/safe_conversions.h" +#include "rtc_base/third_party/base64/base64.h" #include "rtc_base/trace_event.h" #include "rtc_base/zero_memory.h" diff --git a/pc/statscollector.cc b/pc/statscollector.cc index 2a5936830c..14a6c77b4a 100644 --- a/pc/statscollector.cc +++ b/pc/statscollector.cc @@ -17,8 +17,8 @@ #include "pc/channel.h" #include "pc/peerconnection.h" -#include "rtc_base/base64.h" #include "rtc_base/checks.h" +#include "rtc_base/third_party/base64/base64.h" namespace webrtc { namespace { diff --git a/pc/statscollector_unittest.cc b/pc/statscollector_unittest.cc index f7e30e4216..2a2a2dc9b6 100644 --- a/pc/statscollector_unittest.cc +++ b/pc/statscollector_unittest.cc @@ -21,8 +21,8 @@ #include "pc/test/fakepeerconnectionforstats.h" #include "pc/test/fakevideotracksource.h" #include "pc/videotrack.h" -#include "rtc_base/base64.h" #include "rtc_base/fakesslidentity.h" +#include "rtc_base/third_party/base64/base64.h" #include "test/gtest.h" using cricket::ConnectionInfo; diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn index 982d5c4beb..bb8af917af 100644 --- a/rtc_base/BUILD.gn +++ b/rtc_base/BUILD.gn @@ -371,7 +371,6 @@ rtc_source_set("rtc_base_approved_generic") { data_deps = [] deps = [ ":atomicops", - ":base64", ":checks", ":criticalsection", ":logging", @@ -390,6 +389,7 @@ rtc_source_set("rtc_base_approved_generic") { ":type_traits", "../:typedefs", "system:arch", + "third_party/base64", ] sources = [ @@ -495,9 +495,11 @@ if (is_mac && !build_with_chromium) { rtc_source_set("base64") { visibility = [ "*" ] sources = [ - "base64.cc", "base64.h", ] + deps = [ + "third_party/base64", + ] } rtc_source_set("rtc_task_queue") { @@ -723,11 +725,11 @@ rtc_static_library("rtc_base_generic") { libs = [] defines = [] deps = [ - ":base64", ":checks", ":stringutils", "..:webrtc_common", "../api:array_view", + "third_party/base64", "//third_party/abseil-cpp/absl/memory", "//third_party/abseil-cpp/absl/types:optional", ] @@ -1160,7 +1162,6 @@ if (rtc_include_tests) { sources += [ "win/windows_version_unittest.cc" ] } deps = [ - ":base64", ":checks", ":rate_limiter", ":rtc_base", @@ -1177,6 +1178,7 @@ if (rtc_include_tests) { "../test:fileutils", "../test:test_support", "memory:unittests", + "third_party/base64", "//third_party/abseil-cpp/absl/memory", ] } diff --git a/rtc_base/base64.h b/rtc_base/base64.h index bfe2fe6a94..56ebfc9431 100644 --- a/rtc_base/base64.h +++ b/rtc_base/base64.h @@ -1,123 +1,14 @@ +/* + * Copyright 2018 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. + */ -//********************************************************************* -//* C_Base64 - a simple base64 encoder and decoder. -//* -//* Copyright (c) 1999, Bob Withers - bwit@pobox.com -//* -//* This code may be freely used for any purpose, either personal -//* or commercial, provided the authors copyright notice remains -//* intact. -//********************************************************************* - -#ifndef RTC_BASE_BASE64_H_ -#define RTC_BASE_BASE64_H_ - -#include -#include - -namespace rtc { - -class Base64 { - public: - enum DecodeOption { - DO_PARSE_STRICT = 1, // Parse only base64 characters - DO_PARSE_WHITE = 2, // Parse only base64 and whitespace characters - DO_PARSE_ANY = 3, // Parse all characters - DO_PARSE_MASK = 3, - - DO_PAD_YES = 4, // Padding is required - DO_PAD_ANY = 8, // Padding is optional - DO_PAD_NO = 12, // Padding is disallowed - DO_PAD_MASK = 12, - - DO_TERM_BUFFER = 16, // Must termiante at end of buffer - DO_TERM_CHAR = 32, // May terminate at any character boundary - DO_TERM_ANY = 48, // May terminate at a sub-character bit offset - DO_TERM_MASK = 48, - - // Strictest interpretation - DO_STRICT = DO_PARSE_STRICT | DO_PAD_YES | DO_TERM_BUFFER, - - DO_LAX = DO_PARSE_ANY | DO_PAD_ANY | DO_TERM_CHAR, - }; - typedef int DecodeFlags; - - static bool IsBase64Char(char ch); - - // Get the char next to the |ch| from the Base64Table. - // If the |ch| is the last one in the Base64Table then returns - // the first one from the table. - // Expects the |ch| be a base64 char. - // The result will be saved in |next_ch|. - // Returns true on success. - static bool GetNextBase64Char(char ch, char* next_ch); - - // Determines whether the given string consists entirely of valid base64 - // encoded characters. - static bool IsBase64Encoded(const std::string& str); - - static void EncodeFromArray(const void* data, - size_t len, - std::string* result); - static bool DecodeFromArray(const char* data, - size_t len, - DecodeFlags flags, - std::string* result, - size_t* data_used); - static bool DecodeFromArray(const char* data, - size_t len, - DecodeFlags flags, - std::vector* result, - size_t* data_used); - static bool DecodeFromArray(const char* data, - size_t len, - DecodeFlags flags, - std::vector* result, - size_t* data_used); - - // Convenience Methods - static inline std::string Encode(const std::string& data) { - std::string result; - EncodeFromArray(data.data(), data.size(), &result); - return result; - } - static inline std::string Decode(const std::string& data, DecodeFlags flags) { - std::string result; - DecodeFromArray(data.data(), data.size(), flags, &result, nullptr); - return result; - } - static inline bool Decode(const std::string& data, - DecodeFlags flags, - std::string* result, - size_t* data_used) { - return DecodeFromArray(data.data(), data.size(), flags, result, data_used); - } - static inline bool Decode(const std::string& data, - DecodeFlags flags, - std::vector* result, - size_t* data_used) { - return DecodeFromArray(data.data(), data.size(), flags, result, data_used); - } - - private: - static const char Base64Table[]; - static const unsigned char DecodeTable[]; - - static size_t GetNextQuantum(DecodeFlags parse_flags, - bool illegal_pads, - const char* data, - size_t len, - size_t* dpos, - unsigned char qbuf[4], - bool* padded); - template - static bool DecodeFromArrayTemplate(const char* data, - size_t len, - DecodeFlags flags, - T* result, - size_t* data_used); -}; - -} // namespace rtc - -#endif // RTC_BASE_BASE64_H_ +// This is a temporary header file to move origin header from this location +// to specified in include. Don't use this header directly, use included one +// instead. +#include "rtc_base/third_party/base64/base64.h" diff --git a/rtc_base/base64_unittest.cc b/rtc_base/base64_unittest.cc index f73b39645a..4b857f1aa9 100644 --- a/rtc_base/base64_unittest.cc +++ b/rtc_base/base64_unittest.cc @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "rtc_base/base64.h" +#include "rtc_base/third_party/base64/base64.h" #include "rtc_base/gunit.h" #include "rtc_base/logging.h" #include "rtc_base/stringutils.h" diff --git a/rtc_base/helpers.cc b/rtc_base/helpers.cc index 02606654bd..b9372b9974 100644 --- a/rtc_base/helpers.cc +++ b/rtc_base/helpers.cc @@ -15,9 +15,9 @@ #include -#include "rtc_base/base64.h" #include "rtc_base/checks.h" #include "rtc_base/logging.h" +#include "rtc_base/third_party/base64/base64.h" #include "rtc_base/timeutils.h" // Protect against max macro inclusion. diff --git a/rtc_base/httpcommon.cc b/rtc_base/httpcommon.cc index 5ac1e42dbb..0e7883d077 100644 --- a/rtc_base/httpcommon.cc +++ b/rtc_base/httpcommon.cc @@ -21,13 +21,13 @@ #include #include "rtc_base/arraysize.h" -#include "rtc_base/base64.h" #include "rtc_base/checks.h" #include "rtc_base/cryptstring.h" #include "rtc_base/httpcommon-inl.h" #include "rtc_base/httpcommon.h" #include "rtc_base/messagedigest.h" #include "rtc_base/socketaddress.h" +#include "rtc_base/third_party/base64/base64.h" #include "rtc_base/zero_memory.h" namespace rtc { diff --git a/rtc_base/sslcertificate.cc b/rtc_base/sslcertificate.cc index d99da60e2a..9a38fc0384 100644 --- a/rtc_base/sslcertificate.cc +++ b/rtc_base/sslcertificate.cc @@ -15,11 +15,11 @@ #include #include "absl/memory/memory.h" -#include "rtc_base/base64.h" #include "rtc_base/checks.h" #include "rtc_base/logging.h" #include "rtc_base/opensslcertificate.h" #include "rtc_base/sslfingerprint.h" +#include "rtc_base/third_party/base64/base64.h" namespace rtc { diff --git a/rtc_base/sslidentity.cc b/rtc_base/sslidentity.cc index 94944f9662..f286884f9f 100644 --- a/rtc_base/sslidentity.cc +++ b/rtc_base/sslidentity.cc @@ -16,11 +16,11 @@ #include #include "absl/memory/memory.h" -#include "rtc_base/base64.h" #include "rtc_base/checks.h" #include "rtc_base/logging.h" #include "rtc_base/opensslidentity.h" #include "rtc_base/sslfingerprint.h" +#include "rtc_base/third_party/base64/base64.h" namespace rtc { diff --git a/rtc_base/third_party/base64/BUILD.gn b/rtc_base/third_party/base64/BUILD.gn new file mode 100644 index 0000000000..dca47e02b7 --- /dev/null +++ b/rtc_base/third_party/base64/BUILD.gn @@ -0,0 +1,17 @@ +# Copyright (c) 2018 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. + +import("../../../webrtc.gni") + +rtc_source_set("base64") { + visibility = [ "*" ] + sources = [ + "base64.cc", + "base64.h", + ] +} diff --git a/rtc_base/third_party/base64/LICENSE b/rtc_base/third_party/base64/LICENSE new file mode 100644 index 0000000000..4ad21d1b71 --- /dev/null +++ b/rtc_base/third_party/base64/LICENSE @@ -0,0 +1,14 @@ +//********************************************************************* +//* Base64 - a simple base64 encoder and decoder. +//* +//* Copyright (c) 1999, Bob Withers - bwit@pobox.com +//* +//* This code may be freely used for any purpose, either personal +//* or commercial, provided the authors copyright notice remains +//* intact. +//* +//* Enhancements by Stanley Yamane: +//* o reverse lookup table for the decode function +//* o reserve string buffer space in advance +//* +//********************************************************************* diff --git a/rtc_base/third_party/base64/README.chromium b/rtc_base/third_party/base64/README.chromium new file mode 100644 index 0000000000..92ba0d36d7 --- /dev/null +++ b/rtc_base/third_party/base64/README.chromium @@ -0,0 +1,11 @@ +Name: A simple base64 encoder and decoder +Short Name: base64 +URL: +Version: 0 +Date: 2018-06-20 +License: Custom license +License File: LICENSE +Security Critical: yes + +Description: +A simple base64 encoder and decoder diff --git a/rtc_base/base64.cc b/rtc_base/third_party/base64/base64.cc similarity index 99% rename from rtc_base/base64.cc rename to rtc_base/third_party/base64/base64.cc index 6add993fa1..53ff6b9d54 100644 --- a/rtc_base/base64.cc +++ b/rtc_base/third_party/base64/base64.cc @@ -14,10 +14,10 @@ //* //********************************************************************* -#include "rtc_base/base64.h" +#include "rtc_base/third_party/base64/base64.h" -#include #include +#include using std::vector; diff --git a/rtc_base/third_party/base64/base64.h b/rtc_base/third_party/base64/base64.h new file mode 100644 index 0000000000..bfe2fe6a94 --- /dev/null +++ b/rtc_base/third_party/base64/base64.h @@ -0,0 +1,123 @@ + +//********************************************************************* +//* C_Base64 - a simple base64 encoder and decoder. +//* +//* Copyright (c) 1999, Bob Withers - bwit@pobox.com +//* +//* This code may be freely used for any purpose, either personal +//* or commercial, provided the authors copyright notice remains +//* intact. +//********************************************************************* + +#ifndef RTC_BASE_BASE64_H_ +#define RTC_BASE_BASE64_H_ + +#include +#include + +namespace rtc { + +class Base64 { + public: + enum DecodeOption { + DO_PARSE_STRICT = 1, // Parse only base64 characters + DO_PARSE_WHITE = 2, // Parse only base64 and whitespace characters + DO_PARSE_ANY = 3, // Parse all characters + DO_PARSE_MASK = 3, + + DO_PAD_YES = 4, // Padding is required + DO_PAD_ANY = 8, // Padding is optional + DO_PAD_NO = 12, // Padding is disallowed + DO_PAD_MASK = 12, + + DO_TERM_BUFFER = 16, // Must termiante at end of buffer + DO_TERM_CHAR = 32, // May terminate at any character boundary + DO_TERM_ANY = 48, // May terminate at a sub-character bit offset + DO_TERM_MASK = 48, + + // Strictest interpretation + DO_STRICT = DO_PARSE_STRICT | DO_PAD_YES | DO_TERM_BUFFER, + + DO_LAX = DO_PARSE_ANY | DO_PAD_ANY | DO_TERM_CHAR, + }; + typedef int DecodeFlags; + + static bool IsBase64Char(char ch); + + // Get the char next to the |ch| from the Base64Table. + // If the |ch| is the last one in the Base64Table then returns + // the first one from the table. + // Expects the |ch| be a base64 char. + // The result will be saved in |next_ch|. + // Returns true on success. + static bool GetNextBase64Char(char ch, char* next_ch); + + // Determines whether the given string consists entirely of valid base64 + // encoded characters. + static bool IsBase64Encoded(const std::string& str); + + static void EncodeFromArray(const void* data, + size_t len, + std::string* result); + static bool DecodeFromArray(const char* data, + size_t len, + DecodeFlags flags, + std::string* result, + size_t* data_used); + static bool DecodeFromArray(const char* data, + size_t len, + DecodeFlags flags, + std::vector* result, + size_t* data_used); + static bool DecodeFromArray(const char* data, + size_t len, + DecodeFlags flags, + std::vector* result, + size_t* data_used); + + // Convenience Methods + static inline std::string Encode(const std::string& data) { + std::string result; + EncodeFromArray(data.data(), data.size(), &result); + return result; + } + static inline std::string Decode(const std::string& data, DecodeFlags flags) { + std::string result; + DecodeFromArray(data.data(), data.size(), flags, &result, nullptr); + return result; + } + static inline bool Decode(const std::string& data, + DecodeFlags flags, + std::string* result, + size_t* data_used) { + return DecodeFromArray(data.data(), data.size(), flags, result, data_used); + } + static inline bool Decode(const std::string& data, + DecodeFlags flags, + std::vector* result, + size_t* data_used) { + return DecodeFromArray(data.data(), data.size(), flags, result, data_used); + } + + private: + static const char Base64Table[]; + static const unsigned char DecodeTable[]; + + static size_t GetNextQuantum(DecodeFlags parse_flags, + bool illegal_pads, + const char* data, + size_t len, + size_t* dpos, + unsigned char qbuf[4], + bool* padded); + template + static bool DecodeFromArrayTemplate(const char* data, + size_t len, + DecodeFlags flags, + T* result, + size_t* data_used); +}; + +} // namespace rtc + +#endif // RTC_BASE_BASE64_H_ diff --git a/tools_webrtc/libs/generate_licenses.py b/tools_webrtc/libs/generate_licenses.py index aefcaf4ad8..77064f1d2c 100755 --- a/tools_webrtc/libs/generate_licenses.py +++ b/tools_webrtc/libs/generate_licenses.py @@ -47,6 +47,7 @@ LIB_TO_LICENSES_DICT = { 'usrsctp': ['third_party/usrsctp/LICENSE'], 'webrtc': ['LICENSE', 'LICENSE_THIRD_PARTY'], 'zlib': ['third_party/zlib/LICENSE'], + 'base64': ['rtc_base/third_party/base64/LICENSE'], # Compile time dependencies, no license needed: 'yasm': [],