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

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

Issue 2718663005: Replace NULL with nullptr or null in webrtc/base/. (Closed)
Patch Set: Fixing Windows and formatting issues. Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « webrtc/base/stringencode_unittest.cc ('k') | webrtc/base/stringutils_unittest.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 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // STL string type 129 // STL string type
130 //typedef XXX string; 130 //typedef XXX string;
131 // Null-terminated string 131 // Null-terminated string
132 //inline static const CTYPE* empty_str(); 132 //inline static const CTYPE* empty_str();
133 }; 133 };
134 134
135 /////////////////////////////////////////////////////////////////////////////// 135 ///////////////////////////////////////////////////////////////////////////////
136 // String utilities which work with char or wchar_t 136 // String utilities which work with char or wchar_t
137 /////////////////////////////////////////////////////////////////////////////// 137 ///////////////////////////////////////////////////////////////////////////////
138 138
139 template<class CTYPE> 139 template <class CTYPE>
140 inline const CTYPE* nonnull(const CTYPE* str, const CTYPE* def_str = NULL) { 140 inline const CTYPE* nonnull(const CTYPE* str, const CTYPE* def_str = nullptr) {
141 return str ? str : (def_str ? def_str : Traits<CTYPE>::empty_str()); 141 return str ? str : (def_str ? def_str : Traits<CTYPE>::empty_str());
142 } 142 }
143 143
144 template<class CTYPE> 144 template<class CTYPE>
145 const CTYPE* strchr(const CTYPE* str, const CTYPE* chs) { 145 const CTYPE* strchr(const CTYPE* str, const CTYPE* chs) {
146 for (size_t i=0; str[i]; ++i) { 146 for (size_t i=0; str[i]; ++i) {
147 for (size_t j=0; chs[j]; ++j) { 147 for (size_t j=0; chs[j]; ++j) {
148 if (str[i] == chs[j]) { 148 if (str[i] == chs[j]) {
149 return str + i; 149 return str + i;
150 } 150 }
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 307
308 // True iff s1 ends with s2. 308 // True iff s1 ends with s2.
309 bool ends_with(const char *s1, const char *s2); 309 bool ends_with(const char *s1, const char *s2);
310 310
311 // Remove leading and trailing whitespaces. 311 // Remove leading and trailing whitespaces.
312 std::string string_trim(const std::string& s); 312 std::string string_trim(const std::string& s);
313 313
314 } // namespace rtc 314 } // namespace rtc
315 315
316 #endif // WEBRTC_BASE_STRINGUTILS_H__ 316 #endif // WEBRTC_BASE_STRINGUTILS_H__
OLDNEW
« no previous file with comments | « webrtc/base/stringencode_unittest.cc ('k') | webrtc/base/stringutils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698