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

Unified Diff: base/string_util.cc

Issue 360034: Add 64bit support. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 | « base/atomicops_internals_x86_msvc.h ('k') | base/waitable_event_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/string_util.cc
===================================================================
--- base/string_util.cc (revision 31316)
+++ base/string_util.cc (working copy)
@@ -40,12 +40,12 @@
// 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 @@
// 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 @@
// 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 @@
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 @@
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 @@
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) ||
« no previous file with comments | « base/atomicops_internals_x86_msvc.h ('k') | base/waitable_event_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698