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

Unified Diff: net/base/escape.cc

Issue 8890055: linux: Remove all 40 static initializers from escape.cc. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: mappy pkasting Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/escape.cc
diff --git a/net/base/escape.cc b/net/base/escape.cc
index 8c488d11b98ac280b166785d6220b28651ba97d6..f206e9898a29871dacfebfca7c72ca506f6bc6ff 100644
--- a/net/base/escape.cc
+++ b/net/base/escape.cc
@@ -28,20 +28,12 @@ inline char IntToHex(int i) {
//
// Internally stores 256 bits in an array of 8 ints.
// Does quick bit-flicking to lookup needed characters.
-class Charmap {
- public:
- Charmap(uint32 b0, uint32 b1, uint32 b2, uint32 b3,
- uint32 b4, uint32 b5, uint32 b6, uint32 b7) {
- map_[0] = b0; map_[1] = b1; map_[2] = b2; map_[3] = b3;
- map_[4] = b4; map_[5] = b5; map_[6] = b6; map_[7] = b7;
- }
-
+struct Charmap {
bool Contains(unsigned char c) const {
- return (map_[c >> 5] & (1 << (c & 31))) ? true : false;
+ return (map[c >> 5] & (1 << (c & 31))) ? true : false;
}
- private:
- uint32 map_[8];
+ uint32 map[8];
};
// Given text to escape and a Charmap defining which values to escape,
@@ -223,31 +215,35 @@ str EscapeForHTMLImpl(const str& input) {
// Everything except alphanumerics and !'()*-._~
// See RFC 2396 for the list of reserved characters.
-static const Charmap kQueryCharmap(
+static const Charmap kQueryCharmap = {{
0xffffffffL, 0xfc00987dL, 0x78000001L, 0xb8000001L,
- 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL);
+ 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL
+}};
// non-printable, non-7bit, and (including space) "#%:<>?[\]^`{|}
-static const Charmap kPathCharmap(
+static const Charmap kPathCharmap = {{
0xffffffffL, 0xd400002dL, 0x78000000L, 0xb8000001L,
- 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL);
+ 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL
+}};
// non-printable, non-7bit, and (including space) ?>=<;+'&%$#"![\]^`{|}
-static const Charmap kUrlEscape(
+static const Charmap kUrlEscape = {{
0xffffffffL, 0xf80008fdL, 0x78000001L, 0xb8000001L,
0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL
-);
+}};
// non-7bit
-static const Charmap kNonASCIICharmap(
+static const Charmap kNonASCIICharmap = {{
0x00000000L, 0x00000000L, 0x00000000L, 0x00000000L,
- 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL);
+ 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL
+}};
// Everything except alphanumerics, the reserved characters(;/?:@&=+$,) and
// !'()*-._~%
-static const Charmap kExternalHandlerCharmap(
+static const Charmap kExternalHandlerCharmap = {{
0xffffffffL, 0x5000080dL, 0x68000000L, 0xb8000001L,
- 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL);
+ 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL
+}};
} // namespace
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698