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

Unified Diff: webrtc/base/stringencode.cc

Issue 1344143002: Catching more errors when parsing ICE server URLs. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Merging with master. Created 5 years, 3 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/stringencode.h ('k') | webrtc/base/stringencode_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/stringencode.cc
diff --git a/webrtc/base/stringencode.cc b/webrtc/base/stringencode.cc
index 2930e5776c9015b1a70a5ef7246182e77f03a95d..01b41a633a2d70abeabb9c2a8e69af91b21f142a 100644
--- a/webrtc/base/stringencode.cc
+++ b/webrtc/base/stringencode.cc
@@ -556,7 +556,6 @@ std::string s_transform(const std::string& source, Transform t) {
size_t tokenize(const std::string& source, char delimiter,
std::vector<std::string>* fields) {
- RTC_DCHECK(fields);
fields->clear();
size_t last = 0;
for (size_t i = 0; i < source.length(); ++i) {
@@ -573,6 +572,21 @@ size_t tokenize(const std::string& source, char delimiter,
return fields->size();
}
+size_t tokenize_with_empty_tokens(const std::string& source,
+ char delimiter,
+ std::vector<std::string>* fields) {
+ fields->clear();
+ size_t last = 0;
+ for (size_t i = 0; i < source.length(); ++i) {
+ if (source[i] == delimiter) {
+ fields->push_back(source.substr(last, i - last));
+ last = i + 1;
+ }
+ }
+ fields->push_back(source.substr(last, source.length() - last));
+ return fields->size();
+}
+
size_t tokenize_append(const std::string& source, char delimiter,
std::vector<std::string>* fields) {
if (!fields) return 0;
« no previous file with comments | « webrtc/base/stringencode.h ('k') | webrtc/base/stringencode_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698