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

Side by Side Diff: base/strings/string_util.h

Issue 596103002: Fix more disabled MSVC warnings, base/ edition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comment Created 6 years, 2 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 | « base/strings/string_number_conversions.cc ('k') | base/strings/utf_string_conversion_utils.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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // This file defines utility functions for working with strings. 5 // This file defines utility functions for working with strings.
6 6
7 #ifndef BASE_STRINGS_STRING_UTIL_H_ 7 #ifndef BASE_STRINGS_STRING_UTIL_H_
8 #define BASE_STRINGS_STRING_UTIL_H_ 8 #define BASE_STRINGS_STRING_UTIL_H_
9 9
10 #include <ctype.h> 10 #include <ctype.h>
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 } 351 }
352 352
353 template <typename Char> 353 template <typename Char>
354 inline bool IsHexDigit(Char c) { 354 inline bool IsHexDigit(Char c) {
355 return (c >= '0' && c <= '9') || 355 return (c >= '0' && c <= '9') ||
356 (c >= 'A' && c <= 'F') || 356 (c >= 'A' && c <= 'F') ||
357 (c >= 'a' && c <= 'f'); 357 (c >= 'a' && c <= 'f');
358 } 358 }
359 359
360 template <typename Char> 360 template <typename Char>
361 inline Char HexDigitToInt(Char c) { 361 inline char HexDigitToInt(Char c) {
362 DCHECK(IsHexDigit(c)); 362 DCHECK(IsHexDigit(c));
363 if (c >= '0' && c <= '9') 363 if (c >= '0' && c <= '9')
364 return c - '0'; 364 return static_cast<char>(c - '0');
365 if (c >= 'A' && c <= 'F') 365 if (c >= 'A' && c <= 'F')
366 return c - 'A' + 10; 366 return static_cast<char>(c - 'A' + 10);
367 if (c >= 'a' && c <= 'f') 367 if (c >= 'a' && c <= 'f')
368 return c - 'a' + 10; 368 return static_cast<char>(c - 'a' + 10);
369 return 0; 369 return 0;
370 } 370 }
371 371
372 // Returns true if it's a whitespace character. 372 // Returns true if it's a whitespace character.
373 inline bool IsWhitespace(wchar_t c) { 373 inline bool IsWhitespace(wchar_t c) {
374 return wcschr(base::kWhitespaceWide, c) != NULL; 374 return wcschr(base::kWhitespaceWide, c) != NULL;
375 } 375 }
376 376
377 // Return a byte string in human-readable format with a unit suffix. Not 377 // Return a byte string in human-readable format with a unit suffix. Not
378 // appropriate for use in any UI; use of FormatBytes and friends in ui/base is 378 // appropriate for use in any UI; use of FormatBytes and friends in ui/base is
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 #elif defined(WCHAR_T_IS_UTF32) 520 #elif defined(WCHAR_T_IS_UTF32)
521 typedef uint32 Unsigned; 521 typedef uint32 Unsigned;
522 #endif 522 #endif
523 }; 523 };
524 template<> 524 template<>
525 struct ToUnsigned<short> { 525 struct ToUnsigned<short> {
526 typedef unsigned short Unsigned; 526 typedef unsigned short Unsigned;
527 }; 527 };
528 528
529 #endif // BASE_STRINGS_STRING_UTIL_H_ 529 #endif // BASE_STRINGS_STRING_UTIL_H_
OLDNEW
« no previous file with comments | « base/strings/string_number_conversions.cc ('k') | base/strings/utf_string_conversion_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698