OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "net/base/net_util.h" | 9 #include "net/base/net_util.h" |
10 #include "net/tools/dump_cache/url_to_filename_encoder.h" | 10 #include "net/tools/dump_cache/url_to_filename_encoder.h" |
11 | 11 |
12 using std::string; | 12 using std::string; |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 // Returns 1 if buf is prefixed by "num_digits" of hex digits | 16 // Returns 1 if buf is prefixed by "num_digits" of hex digits |
17 // Teturns 0 otherwise. | 17 // Teturns 0 otherwise. |
18 // The function checks for '\0' for string termination. | 18 // The function checks for '\0' for string termination. |
19 int HexDigitsPrefix(const char* buf, int num_digits) { | 19 int HexDigitsPrefix(const char* buf, int num_digits) { |
20 for (int i = 0; i < num_digits; i++) { | 20 for (int i = 0; i < num_digits; i++) { |
21 if (!IsHexDigit(buf[i])) | 21 if (!base::IsHexDigit(buf[i])) |
22 return 0; // This also detects end of string as '\0' is not xdigit. | 22 return 0; // This also detects end of string as '\0' is not xdigit. |
23 } | 23 } |
24 return 1; | 24 return 1; |
25 } | 25 } |
26 | 26 |
27 #ifdef WIN32 | 27 #ifdef WIN32 |
28 #define strtoull _strtoui64 | 28 #define strtoull _strtoui64 |
29 #endif | 29 #endif |
30 | 30 |
31 // A simple parser for long long values. Returns the parsed value if a | 31 // A simple parser for long long values. Returns the parsed value if a |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 char slash = '/'; | 283 char slash = '/'; |
284 #endif | 284 #endif |
285 output.append(&slash, 1); | 285 output.append(&slash, 1); |
286 last_slash = index; | 286 last_slash = index; |
287 } | 287 } |
288 } | 288 } |
289 return output; | 289 return output; |
290 } | 290 } |
291 | 291 |
292 } // namespace net | 292 } // namespace net |
OLD | NEW |