Fix a bunch of implicit casts detected by the Win64 compiler

Review URL: https://chromiumcodereview.appspot.com/10536202

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11862 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 3e6b01df
// Copyright 2011 the V8 project authors. All rights reserved. // Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
...@@ -202,7 +202,7 @@ void fail(v8::PreParserData* data, const char* message, ...) { ...@@ -202,7 +202,7 @@ void fail(v8::PreParserData* data, const char* message, ...) {
fflush(stderr); fflush(stderr);
if (data != NULL) { if (data != NULL) {
// Print preparser data to stdout. // Print preparser data to stdout.
uint32_t size = data->size(); uint32_t size = static_cast<uint32_t>(data->size());
fprintf(stderr, "LOG: data size: %u\n", size); fprintf(stderr, "LOG: data size: %u\n", size);
if (!WriteBuffer(stdout, data->data(), size)) { if (!WriteBuffer(stdout, data->data(), size)) {
perror("ERROR: Writing data"); perror("ERROR: Writing data");
...@@ -232,7 +232,7 @@ struct ExceptionExpectation { ...@@ -232,7 +232,7 @@ struct ExceptionExpectation {
void CheckException(v8::PreParserData* data, void CheckException(v8::PreParserData* data,
ExceptionExpectation* expects) { ExceptionExpectation* expects) {
PreparseDataInterpreter reader(data->data(), data->size()); PreparseDataInterpreter reader(data->data(), static_cast<int>(data->size()));
if (expects->throws) { if (expects->throws) {
if (!reader.throws()) { if (!reader.throws()) {
if (expects->type == NULL) { if (expects->type == NULL) {
......
...@@ -347,7 +347,7 @@ v8::Handle<v8::String> ReadFile(const char* name) { ...@@ -347,7 +347,7 @@ v8::Handle<v8::String> ReadFile(const char* name) {
char* chars = new char[size + 1]; char* chars = new char[size + 1];
chars[size] = '\0'; chars[size] = '\0';
for (int i = 0; i < size;) { for (int i = 0; i < size;) {
int read = fread(&chars[i], 1, size - i, file); int read = static_cast<int>(fread(&chars[i], 1, size - i, file));
i += read; i += read;
} }
fclose(file); fclose(file);
......
// Copyright 2008 the V8 project authors. All rights reserved. // Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
...@@ -351,7 +351,7 @@ Handle<Value> JsHttpRequestProcessor::MapGet(Local<String> name, ...@@ -351,7 +351,7 @@ Handle<Value> JsHttpRequestProcessor::MapGet(Local<String> name,
// Otherwise fetch the value and wrap it in a JavaScript string // Otherwise fetch the value and wrap it in a JavaScript string
const string& value = (*iter).second; const string& value = (*iter).second;
return String::New(value.c_str(), value.length()); return String::New(value.c_str(), static_cast<int>(value.length()));
} }
...@@ -443,7 +443,7 @@ Handle<Value> JsHttpRequestProcessor::GetPath(Local<String> name, ...@@ -443,7 +443,7 @@ Handle<Value> JsHttpRequestProcessor::GetPath(Local<String> name,
const string& path = request->Path(); const string& path = request->Path();
// Wrap the result in a JavaScript string and return it. // Wrap the result in a JavaScript string and return it.
return String::New(path.c_str(), path.length()); return String::New(path.c_str(), static_cast<int>(path.length()));
} }
...@@ -451,7 +451,7 @@ Handle<Value> JsHttpRequestProcessor::GetReferrer(Local<String> name, ...@@ -451,7 +451,7 @@ Handle<Value> JsHttpRequestProcessor::GetReferrer(Local<String> name,
const AccessorInfo& info) { const AccessorInfo& info) {
HttpRequest* request = UnwrapRequest(info.Holder()); HttpRequest* request = UnwrapRequest(info.Holder());
const string& path = request->Referrer(); const string& path = request->Referrer();
return String::New(path.c_str(), path.length()); return String::New(path.c_str(), static_cast<int>(path.length()));
} }
...@@ -459,7 +459,7 @@ Handle<Value> JsHttpRequestProcessor::GetHost(Local<String> name, ...@@ -459,7 +459,7 @@ Handle<Value> JsHttpRequestProcessor::GetHost(Local<String> name,
const AccessorInfo& info) { const AccessorInfo& info) {
HttpRequest* request = UnwrapRequest(info.Holder()); HttpRequest* request = UnwrapRequest(info.Holder());
const string& path = request->Host(); const string& path = request->Host();
return String::New(path.c_str(), path.length()); return String::New(path.c_str(), static_cast<int>(path.length()));
} }
...@@ -467,7 +467,7 @@ Handle<Value> JsHttpRequestProcessor::GetUserAgent(Local<String> name, ...@@ -467,7 +467,7 @@ Handle<Value> JsHttpRequestProcessor::GetUserAgent(Local<String> name,
const AccessorInfo& info) { const AccessorInfo& info) {
HttpRequest* request = UnwrapRequest(info.Holder()); HttpRequest* request = UnwrapRequest(info.Holder());
const string& path = request->UserAgent(); const string& path = request->UserAgent();
return String::New(path.c_str(), path.length()); return String::New(path.c_str(), static_cast<int>(path.length()));
} }
...@@ -557,7 +557,7 @@ Handle<String> ReadFile(const string& name) { ...@@ -557,7 +557,7 @@ Handle<String> ReadFile(const string& name) {
char* chars = new char[size + 1]; char* chars = new char[size + 1];
chars[size] = '\0'; chars[size] = '\0';
for (int i = 0; i < size;) { for (int i = 0; i < size;) {
int read = fread(&chars[i], 1, size - i, file); int read = static_cast<int>(fread(&chars[i], 1, size - i, file));
i += read; i += read;
} }
fclose(file); fclose(file);
......
...@@ -205,7 +205,7 @@ v8::Handle<v8::String> ReadFile(const char* name) { ...@@ -205,7 +205,7 @@ v8::Handle<v8::String> ReadFile(const char* name) {
char* chars = new char[size + 1]; char* chars = new char[size + 1];
chars[size] = '\0'; chars[size] = '\0';
for (int i = 0; i < size;) { for (int i = 0; i < size;) {
int read = fread(&chars[i], 1, size - i, file); int read = static_cast<int>(fread(&chars[i], 1, size - i, file));
i += read; i += read;
} }
fclose(file); fclose(file);
......
...@@ -363,7 +363,7 @@ void RelocInfoWriter::Write(const RelocInfo* rinfo) { ...@@ -363,7 +363,7 @@ void RelocInfoWriter::Write(const RelocInfo* rinfo) {
ASSERT(begin_pos - pos_ >= RelocInfo::kMinRelocCommentSize); ASSERT(begin_pos - pos_ >= RelocInfo::kMinRelocCommentSize);
} else if (RelocInfo::IsConstPool(rmode)) { } else if (RelocInfo::IsConstPool(rmode)) {
WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag);
WriteExtraTaggedConstPoolData(rinfo->data()); WriteExtraTaggedConstPoolData(static_cast<int>(rinfo->data()));
} else { } else {
ASSERT(rmode > RelocInfo::LAST_COMPACT_ENUM); ASSERT(rmode > RelocInfo::LAST_COMPACT_ENUM);
int saved_mode = rmode - RelocInfo::LAST_COMPACT_ENUM; int saved_mode = rmode - RelocInfo::LAST_COMPACT_ENUM;
......
...@@ -284,9 +284,9 @@ Handle<Value> Shell::Load(const Arguments& args) { ...@@ -284,9 +284,9 @@ Handle<Value> Shell::Load(const Arguments& args) {
return Undefined(); return Undefined();
} }
static size_t convertToUint(Local<Value> value_in, TryCatch* try_catch) { static int32_t convertToUint(Local<Value> value_in, TryCatch* try_catch) {
if (value_in->IsUint32()) { if (value_in->IsInt32()) {
return value_in->Uint32Value(); return value_in->Int32Value();
} }
Local<Value> number = value_in->ToNumber(); Local<Value> number = value_in->ToNumber();
...@@ -312,7 +312,7 @@ static size_t convertToUint(Local<Value> value_in, TryCatch* try_catch) { ...@@ -312,7 +312,7 @@ static size_t convertToUint(Local<Value> value_in, TryCatch* try_catch) {
ThrowException( ThrowException(
String::New("Array length exceeds maximum length.")); String::New("Array length exceeds maximum length."));
} }
return static_cast<size_t>(raw_value); return raw_value;
} }
......
...@@ -1876,7 +1876,7 @@ static void RedirectActivationsToRecompiledCodeOnThread( ...@@ -1876,7 +1876,7 @@ static void RedirectActivationsToRecompiledCodeOnThread(
for (RelocIterator it(*frame_code, constpool_mask); !it.done(); it.next()) { for (RelocIterator it(*frame_code, constpool_mask); !it.done(); it.next()) {
RelocInfo* info = it.rinfo(); RelocInfo* info = it.rinfo();
if (info->pc() >= frame->pc()) break; if (info->pc() >= frame->pc()) break;
frame_const_pool_size += info->data(); frame_const_pool_size += static_cast<int>(info->data());
} }
intptr_t frame_offset = intptr_t frame_offset =
frame->pc() - frame_code->instruction_start() - frame_const_pool_size; frame->pc() - frame_code->instruction_start() - frame_const_pool_size;
...@@ -1902,7 +1902,7 @@ static void RedirectActivationsToRecompiledCodeOnThread( ...@@ -1902,7 +1902,7 @@ static void RedirectActivationsToRecompiledCodeOnThread(
} else { } else {
ASSERT(RelocInfo::IsConstPool(info->rmode())); ASSERT(RelocInfo::IsConstPool(info->rmode()));
// The size of the constant pool is encoded in the data. // The size of the constant pool is encoded in the data.
new_code_const_pool_size += info->data(); new_code_const_pool_size += static_cast<int>(info->data());
} }
} }
......
...@@ -725,7 +725,7 @@ Handle<String> Factory::EmergencyNewError(const char* type, ...@@ -725,7 +725,7 @@ Handle<String> Factory::EmergencyNewError(const char* type,
MaybeObject* maybe_arg = args->GetElement(i); MaybeObject* maybe_arg = args->GetElement(i);
Handle<String> arg_str(reinterpret_cast<String*>(maybe_arg)); Handle<String> arg_str(reinterpret_cast<String*>(maybe_arg));
const char* arg = *arg_str->ToCString(); const char* arg = *arg_str->ToCString();
Vector<char> v2(p, space); Vector<char> v2(p, static_cast<int>(space));
OS::StrNCpy(v2, arg, space); OS::StrNCpy(v2, arg, space);
space -= Min(space, strlen(arg)); space -= Min(space, strlen(arg));
p = &buffer[kBufferSize] - space; p = &buffer[kBufferSize] - space;
......
...@@ -100,7 +100,7 @@ void* ZoneObject::operator new(size_t size, Zone* zone) { ...@@ -100,7 +100,7 @@ void* ZoneObject::operator new(size_t size, Zone* zone) {
inline void* ZoneAllocationPolicy::New(size_t size) { inline void* ZoneAllocationPolicy::New(size_t size) {
ASSERT(zone_); ASSERT(zone_);
return zone_->New(size); return zone_->New(static_cast<int>(size));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment