diff options
author | gregoryd@google.com <gregoryd@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-06 23:24:09 +0000 |
---|---|---|
committer | gregoryd@google.com <gregoryd@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-06 23:24:09 +0000 |
commit | 81a7e67a0dbb0133f5c016d3eb04ed1116ba6717 (patch) | |
tree | 364fc864b112b61557576df2981fb31215425344 /base/string_util.cc | |
parent | 51383375ef135f7f2f3b87ab58b28272e7e9d807 (diff) | |
download | chromium_src-81a7e67a0dbb0133f5c016d3eb04ed1116ba6717.zip chromium_src-81a7e67a0dbb0133f5c016d3eb04ed1116ba6717.tar.gz chromium_src-81a7e67a0dbb0133f5c016d3eb04ed1116ba6717.tar.bz2 |
Add 64bit support
This CL is part of a larger effort to add support for Native Client on 64-bit Windows.
Review URL: http://codereview.chromium.org/360034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31321 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/string_util.cc')
-rw-r--r-- | base/string_util.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/base/string_util.cc b/base/string_util.cc index 11ac623..5a45f27 100644 --- a/base/string_util.cc +++ b/base/string_util.cc @@ -40,12 +40,12 @@ struct EmptyStrings { // Used by ReplaceStringPlaceholders to track the position in the string of // replaced parameters. struct ReplacementOffset { - ReplacementOffset(int parameter, size_t offset) + ReplacementOffset(uintptr_t parameter, size_t offset) : parameter(parameter), offset(offset) {} // Index of the parameter. - int parameter; + uintptr_t parameter; // Starting position in the string. size_t offset; @@ -640,7 +640,7 @@ static inline bool IsInUTF8Sequence(int c) { // originally been UTF-8, but has been converted to wide characters because // that's what we (and Windows) use internally. template<typename CHAR> -static bool IsStringUTF8T(const CHAR* str, int length) { +static bool IsStringUTF8T(const CHAR* str, size_t length) { bool overlong = false; bool surrogate = false; bool nonchar = false; @@ -655,7 +655,7 @@ static bool IsStringUTF8T(const CHAR* str, int length) { // are left in the sequence int positions_left = 0; - for (int i = 0; i < length; i++) { + for (uintptr_t i = 0; i < length; i++) { // This whole function assume an unsigned value so force its conversion to // an unsigned value. typename ToUnsigned<CHAR>::Unsigned c = str[i]; @@ -1431,10 +1431,10 @@ void SplitStringAlongWhitespace(const std::string& str, template<class FormatStringType, class OutStringType> OutStringType DoReplaceStringPlaceholders(const FormatStringType& format_string, const std::vector<OutStringType>& subst, std::vector<size_t>* offsets) { - int substitutions = subst.size(); + size_t substitutions = subst.size(); DCHECK(substitutions < 10); - int sub_length = 0; + size_t sub_length = 0; for (typename std::vector<OutStringType>::const_iterator iter = subst.begin(); iter != subst.end(); ++iter) { sub_length += (*iter).length(); @@ -1453,7 +1453,7 @@ OutStringType DoReplaceStringPlaceholders(const FormatStringType& format_string, if ('$' == *i) { formatted.push_back('$'); } else { - int index = *i - '1'; + uintptr_t index = *i - '1'; if (offsets) { ReplacementOffset r_offset(index, static_cast<int>(formatted.size())); @@ -1656,10 +1656,10 @@ bool HexDigitToIntT(const CHAR digit, uint8* val) { template<typename STR> bool HexStringToBytesT(const STR& input, std::vector<uint8>* output) { DCHECK(output->size() == 0); - int count = input.size(); + size_t count = input.size(); if (count == 0 || (count % 2) != 0) return false; - for (int i = 0; i < count / 2; ++i) { + for (uintptr_t i = 0; i < count / 2; ++i) { uint8 msb = 0; // most significant 4 bits uint8 lsb = 0; // least significant 4 bits if (!HexDigitToIntT(input[i * 2], &msb) || |