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

Side by Side Diff: net/base/escape.cc

Issue 1158923005: Use the exact-width integer types defined in <stdint.h> rather than (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweak comments. Exclude mime_sniffer*. Rebase. Created 5 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/base/escape.h" 5 #include "net/base/escape.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 15 matching lines...) Expand all
26 26
27 // A fast bit-vector map for ascii characters. 27 // A fast bit-vector map for ascii characters.
28 // 28 //
29 // Internally stores 256 bits in an array of 8 ints. 29 // Internally stores 256 bits in an array of 8 ints.
30 // Does quick bit-flicking to lookup needed characters. 30 // Does quick bit-flicking to lookup needed characters.
31 struct Charmap { 31 struct Charmap {
32 bool Contains(unsigned char c) const { 32 bool Contains(unsigned char c) const {
33 return ((map[c >> 5] & (1 << (c & 31))) != 0); 33 return ((map[c >> 5] & (1 << (c & 31))) != 0);
34 } 34 }
35 35
36 uint32 map[8]; 36 uint32_t map[8];
37 }; 37 };
38 38
39 // Given text to escape and a Charmap defining which values to escape, 39 // Given text to escape and a Charmap defining which values to escape,
40 // return an escaped string. If use_plus is true, spaces are converted 40 // return an escaped string. If use_plus is true, spaces are converted
41 // to +, otherwise, if spaces are in the charmap, they are converted to 41 // to +, otherwise, if spaces are in the charmap, they are converted to
42 // %20. And if keep_escaped is true, %XX will be kept as it is, otherwise, if 42 // %20. And if keep_escaped is true, %XX will be kept as it is, otherwise, if
43 // '%' is in the charmap, it is converted to %25. 43 // '%' is in the charmap, it is converted to %25.
44 std::string Escape(const std::string& text, 44 std::string Escape(const std::string& text,
45 const Charmap& charmap, 45 const Charmap& charmap,
46 bool use_plus, 46 bool use_plus,
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 1, kEscapeToChars[i].replacement); 454 1, kEscapeToChars[i].replacement);
455 break; 455 break;
456 } 456 }
457 } 457 }
458 } 458 }
459 } 459 }
460 return text; 460 return text;
461 } 461 }
462 462
463 } // namespace net 463 } // namespace net
OLDNEW
« no previous file with comments | « net/base/escape.h ('k') | net/base/file_stream.h » ('j') | net/cert/crl_set_storage.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698