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

Side by Side Diff: webrtc/base/stringencode.cc

Issue 2623313004: Replace RTC_DCHECK(false) with RTC_NOTREACHED(). (Closed)
Patch Set: Created 3 years, 11 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/network.cc ('k') | webrtc/base/timeutils.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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 return bufpos; 112 return bufpos;
113 } 113 }
114 114
115 const char* unsafe_filename_characters() { 115 const char* unsafe_filename_characters() {
116 // It might be better to have a single specification which is the union of 116 // It might be better to have a single specification which is the union of
117 // all operating systems, unless one system is overly restrictive. 117 // all operating systems, unless one system is overly restrictive.
118 #if defined(WEBRTC_WIN) 118 #if defined(WEBRTC_WIN)
119 return "\\/:*?\"<>|"; 119 return "\\/:*?\"<>|";
120 #else // !WEBRTC_WIN 120 #else // !WEBRTC_WIN
121 // TODO(grunell): Should this never be reached? 121 // TODO(grunell): Should this never be reached?
122 RTC_DCHECK(false); 122 RTC_NOTREACHED();
123 return ""; 123 return "";
124 #endif // !WEBRTC_WIN 124 #endif // !WEBRTC_WIN
125 } 125 }
126 126
127 const unsigned char URL_UNSAFE = 0x1; // 0-33 "#$%&+,/:;<=>?@[\]^`{|} 127 127 const unsigned char URL_UNSAFE = 0x1; // 0-33 "#$%&+,/:;<=>?@[\]^`{|} 127
128 const unsigned char XML_UNSAFE = 0x2; // "&'<> 128 const unsigned char XML_UNSAFE = 0x2; // "&'<>
129 const unsigned char HTML_UNSAFE = 0x2; // "&'<> 129 const unsigned char HTML_UNSAFE = 0x2; // "&'<>
130 130
131 // ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 6 5 7 8 9 : ; < = > ? 131 // ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 6 5 7 8 9 : ; < = > ?
132 //@ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ 132 //@ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 srcpos += 1; 267 srcpos += 1;
268 if (ASCII_CLASS[ch] & HTML_UNSAFE) { 268 if (ASCII_CLASS[ch] & HTML_UNSAFE) {
269 const char * escseq = 0; 269 const char * escseq = 0;
270 size_t esclen = 0; 270 size_t esclen = 0;
271 switch (ch) { 271 switch (ch) {
272 case '<': escseq = "&lt;"; esclen = 4; break; 272 case '<': escseq = "&lt;"; esclen = 4; break;
273 case '>': escseq = "&gt;"; esclen = 4; break; 273 case '>': escseq = "&gt;"; esclen = 4; break;
274 case '\'': escseq = "&#39;"; esclen = 5; break; 274 case '\'': escseq = "&#39;"; esclen = 5; break;
275 case '\"': escseq = "&quot;"; esclen = 6; break; 275 case '\"': escseq = "&quot;"; esclen = 6; break;
276 case '&': escseq = "&amp;"; esclen = 5; break; 276 case '&': escseq = "&amp;"; esclen = 5; break;
277 default: RTC_DCHECK(false); 277 default: RTC_NOTREACHED();
278 } 278 }
279 if (bufpos + esclen >= buflen) { 279 if (bufpos + esclen >= buflen) {
280 break; 280 break;
281 } 281 }
282 memcpy(buffer + bufpos, escseq, esclen); 282 memcpy(buffer + bufpos, escseq, esclen);
283 bufpos += esclen; 283 bufpos += esclen;
284 } else { 284 } else {
285 buffer[bufpos++] = ch; 285 buffer[bufpos++] = ch;
286 } 286 }
287 } else { 287 } else {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 unsigned char ch = source[srcpos++]; 324 unsigned char ch = source[srcpos++];
325 if ((ch < 128) && (ASCII_CLASS[ch] & XML_UNSAFE)) { 325 if ((ch < 128) && (ASCII_CLASS[ch] & XML_UNSAFE)) {
326 const char * escseq = 0; 326 const char * escseq = 0;
327 size_t esclen = 0; 327 size_t esclen = 0;
328 switch (ch) { 328 switch (ch) {
329 case '<': escseq = "&lt;"; esclen = 4; break; 329 case '<': escseq = "&lt;"; esclen = 4; break;
330 case '>': escseq = "&gt;"; esclen = 4; break; 330 case '>': escseq = "&gt;"; esclen = 4; break;
331 case '\'': escseq = "&apos;"; esclen = 6; break; 331 case '\'': escseq = "&apos;"; esclen = 6; break;
332 case '\"': escseq = "&quot;"; esclen = 6; break; 332 case '\"': escseq = "&quot;"; esclen = 6; break;
333 case '&': escseq = "&amp;"; esclen = 5; break; 333 case '&': escseq = "&amp;"; esclen = 5; break;
334 default: RTC_DCHECK(false); 334 default: RTC_NOTREACHED();
335 } 335 }
336 if (bufpos + esclen >= buflen) { 336 if (bufpos + esclen >= buflen) {
337 break; 337 break;
338 } 338 }
339 memcpy(buffer + bufpos, escseq, esclen); 339 memcpy(buffer + bufpos, escseq, esclen);
340 bufpos += esclen; 340 bufpos += esclen;
341 } else { 341 } else {
342 buffer[bufpos++] = ch; 342 buffer[bufpos++] = ch;
343 } 343 }
344 } 344 }
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 va_list args; 687 va_list args;
688 va_start(args, format); 688 va_start(args, format);
689 value.assign(buffer, vsprintfn(buffer, maxlen + 1, format, args)); 689 value.assign(buffer, vsprintfn(buffer, maxlen + 1, format, args));
690 va_end(args); 690 va_end(args);
691 } 691 }
692 */ 692 */
693 693
694 ///////////////////////////////////////////////////////////////////////////// 694 /////////////////////////////////////////////////////////////////////////////
695 695
696 } // namespace rtc 696 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/network.cc ('k') | webrtc/base/timeutils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698