Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Side by Side Diff: webrtc/base/base64.h

Issue 2539153002: Add vector<uint8_t> to Base64 decoded data types. (Closed)
Patch Set: Resolve template usage style nits. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/base/base64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 //********************************************************************* 2 //*********************************************************************
3 //* C_Base64 - a simple base64 encoder and decoder. 3 //* C_Base64 - a simple base64 encoder and decoder.
4 //* 4 //*
5 //* Copyright (c) 1999, Bob Withers - bwit@pobox.com 5 //* Copyright (c) 1999, Bob Withers - bwit@pobox.com
6 //* 6 //*
7 //* This code may be freely used for any purpose, either personal 7 //* This code may be freely used for any purpose, either personal
8 //* or commercial, provided the authors copyright notice remains 8 //* or commercial, provided the authors copyright notice remains
9 //* intact. 9 //* intact.
10 //********************************************************************* 10 //*********************************************************************
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // Determines whether the given string consists entirely of valid base64 56 // Determines whether the given string consists entirely of valid base64
57 // encoded characters. 57 // encoded characters.
58 static bool IsBase64Encoded(const std::string& str); 58 static bool IsBase64Encoded(const std::string& str);
59 59
60 static void EncodeFromArray(const void* data, size_t len, 60 static void EncodeFromArray(const void* data, size_t len,
61 std::string* result); 61 std::string* result);
62 static bool DecodeFromArray(const char* data, size_t len, DecodeFlags flags, 62 static bool DecodeFromArray(const char* data, size_t len, DecodeFlags flags,
63 std::string* result, size_t* data_used); 63 std::string* result, size_t* data_used);
64 static bool DecodeFromArray(const char* data, size_t len, DecodeFlags flags, 64 static bool DecodeFromArray(const char* data, size_t len, DecodeFlags flags,
65 std::vector<char>* result, size_t* data_used); 65 std::vector<char>* result, size_t* data_used);
66 static bool DecodeFromArray(const char* data,
67 size_t len,
68 DecodeFlags flags,
69 std::vector<uint8_t>* result,
70 size_t* data_used);
66 71
67 // Convenience Methods 72 // Convenience Methods
68 static inline std::string Encode(const std::string& data) { 73 static inline std::string Encode(const std::string& data) {
69 std::string result; 74 std::string result;
70 EncodeFromArray(data.data(), data.size(), &result); 75 EncodeFromArray(data.data(), data.size(), &result);
71 return result; 76 return result;
72 } 77 }
73 static inline std::string Decode(const std::string& data, DecodeFlags flags) { 78 static inline std::string Decode(const std::string& data, DecodeFlags flags) {
74 std::string result; 79 std::string result;
75 DecodeFromArray(data.data(), data.size(), flags, &result, NULL); 80 DecodeFromArray(data.data(), data.size(), flags, &result, NULL);
(...skipping 19 matching lines...) Expand all
95 unsigned char qbuf[4], bool* padded); 100 unsigned char qbuf[4], bool* padded);
96 template<typename T> 101 template<typename T>
97 static bool DecodeFromArrayTemplate(const char* data, size_t len, 102 static bool DecodeFromArrayTemplate(const char* data, size_t len,
98 DecodeFlags flags, T* result, 103 DecodeFlags flags, T* result,
99 size_t* data_used); 104 size_t* data_used);
100 }; 105 };
101 106
102 } // namespace rtc 107 } // namespace rtc
103 108
104 #endif // WEBRTC_BASE_BASE64_H__ 109 #endif // WEBRTC_BASE_BASE64_H__
OLDNEW
« no previous file with comments | « no previous file | webrtc/base/base64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698