diff options
author | mmentovai@google.com <mmentovai@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-27 01:44:26 +0000 |
---|---|---|
committer | mmentovai@google.com <mmentovai@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-27 01:44:26 +0000 |
commit | 7459794d5e6251014e322a4042d68c4f3f19a5f3 (patch) | |
tree | 17350cabf510a82426631cb3504b2f60f1718de1 /base/string_util.cc | |
parent | 33d5d07a4b2639ff025bd83c49ff73a77c7e7cea (diff) | |
download | chromium_src-7459794d5e6251014e322a4042d68c4f3f19a5f3.zip chromium_src-7459794d5e6251014e322a4042d68c4f3f19a5f3.tar.gz chromium_src-7459794d5e6251014e322a4042d68c4f3f19a5f3.tar.bz2 |
Use COMPILE_ASSERT instead of DCHECK for compile-time constant checks
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1418 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/string_util.cc')
-rw-r--r-- | base/string_util.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/base/string_util.cc b/base/string_util.cc index 851d3ab..2f39104 100644 --- a/base/string_util.cc +++ b/base/string_util.cc @@ -1315,13 +1315,13 @@ bool MatchPattern(const std::string& eval, const std::string& pattern) { // are on our target platforms. bool StringToInt(const std::string& input, int* output) { - DCHECK(sizeof(int) == sizeof(long)); + COMPILE_ASSERT(sizeof(int) == sizeof(long), cannot_strtol_to_int); return StringToNumber<StringToLongTraits>(input, reinterpret_cast<long*>(output)); } bool StringToInt(const std::wstring& input, int* output) { - DCHECK(sizeof(int) == sizeof(long)); + COMPILE_ASSERT(sizeof(int) == sizeof(long), cannot_wcstol_to_int); return StringToNumber<WStringToLongTraits>(input, reinterpret_cast<long*>(output)); } @@ -1335,13 +1335,13 @@ bool StringToInt64(const std::wstring& input, int64* output) { } bool HexStringToInt(const std::string& input, int* output) { - DCHECK(sizeof(int) == sizeof(long)); + COMPILE_ASSERT(sizeof(int) == sizeof(long), cannot_strtol_to_int); return StringToNumber<HexStringToLongTraits>(input, reinterpret_cast<long*>(output)); } bool HexStringToInt(const std::wstring& input, int* output) { - DCHECK(sizeof(int) == sizeof(long)); + COMPILE_ASSERT(sizeof(int) == sizeof(long), cannot_wcstol_to_int); return StringToNumber<HexWStringToLongTraits>( input, reinterpret_cast<long*>(output)); } |