Commit 635a9f72 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Fixed win64 compiler warnings for D8 (static type casting).

Review URL: http://codereview.chromium.org/7470014

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8741 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 40220891
...@@ -199,7 +199,7 @@ Handle<Value> Shell::Write(const Arguments& args) { ...@@ -199,7 +199,7 @@ Handle<Value> Shell::Write(const Arguments& args) {
printf(" "); printf(" ");
} }
v8::String::Utf8Value str(args[i]); v8::String::Utf8Value str(args[i]);
int n = fwrite(*str, sizeof(**str), str.length(), stdout); int n = static_cast<int>(fwrite(*str, sizeof(**str), str.length(), stdout));
if (n != str.length()) { if (n != str.length()) {
printf("Error in fwrite\n"); printf("Error in fwrite\n");
exit(1); exit(1);
...@@ -231,7 +231,7 @@ Handle<Value> Shell::ReadLine(const Arguments& args) { ...@@ -231,7 +231,7 @@ Handle<Value> Shell::ReadLine(const Arguments& args) {
do { // Repeat if the line ends with an escape '\'. do { // Repeat if the line ends with an escape '\'.
// fgets got an error. Just give up. // fgets got an error. Just give up.
if (fgets(buffer, kBufferSize, stdin) == NULL) return Null(); if (fgets(buffer, kBufferSize, stdin) == NULL) return Null();
length = strlen(buffer); length = static_cast<int>(strlen(buffer));
linebreak = (length > 1 && buffer[length-2] == '\\'); linebreak = (length > 1 && buffer[length-2] == '\\');
if (linebreak) buffer[length-2] = '\n'; if (linebreak) buffer[length-2] = '\n';
accumulator = String::Concat(accumulator, String::New(buffer, length-1)); accumulator = String::Concat(accumulator, String::New(buffer, length-1));
...@@ -299,9 +299,12 @@ Handle<Value> Shell::CreateExternalArray(const Arguments& args, ...@@ -299,9 +299,12 @@ Handle<Value> Shell::CreateExternalArray(const Arguments& args,
Persistent<Object> persistent_array = Persistent<Object>::New(array); Persistent<Object> persistent_array = Persistent<Object>::New(array);
persistent_array.MakeWeak(data, ExternalArrayWeakCallback); persistent_array.MakeWeak(data, ExternalArrayWeakCallback);
persistent_array.MarkIndependent(); persistent_array.MarkIndependent();
array->SetIndexedPropertiesToExternalArrayData(data, type, length); array->SetIndexedPropertiesToExternalArrayData(data, type,
array->Set(String::New("length"), Int32::New(length), ReadOnly); static_cast<int>(length));
array->Set(String::New("BYTES_PER_ELEMENT"), Int32::New(element_size)); array->Set(String::New("length"),
Int32::New(static_cast<int32_t>(length)), ReadOnly);
array->Set(String::New("BYTES_PER_ELEMENT"),
Int32::New(static_cast<int32_t>(element_size)));
return array; return array;
} }
...@@ -790,7 +793,7 @@ static char* ReadChars(const char* name, int* size_out) { ...@@ -790,7 +793,7 @@ static char* ReadChars(const char* name, int* size_out) {
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);
...@@ -981,7 +984,7 @@ Handle<String> SourceGroup::ReadFile(const char* name) { ...@@ -981,7 +984,7 @@ Handle<String> SourceGroup::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);
......
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