From 635a9f72ef7e0e38f3fe2a2ee498d50ed129f731 Mon Sep 17 00:00:00 2001 From: "yangguo@chromium.org" Date: Tue, 26 Jul 2011 08:15:49 +0000 Subject: [PATCH] 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 --- src/d8.cc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/d8.cc b/src/d8.cc index 4917f7d..ac20374 100644 --- a/src/d8.cc +++ b/src/d8.cc @@ -199,7 +199,7 @@ Handle Shell::Write(const Arguments& args) { printf(" "); } v8::String::Utf8Value str(args[i]); - int n = fwrite(*str, sizeof(**str), str.length(), stdout); + int n = static_cast(fwrite(*str, sizeof(**str), str.length(), stdout)); if (n != str.length()) { printf("Error in fwrite\n"); exit(1); @@ -231,7 +231,7 @@ Handle Shell::ReadLine(const Arguments& args) { do { // Repeat if the line ends with an escape '\'. // fgets got an error. Just give up. if (fgets(buffer, kBufferSize, stdin) == NULL) return Null(); - length = strlen(buffer); + length = static_cast(strlen(buffer)); linebreak = (length > 1 && buffer[length-2] == '\\'); if (linebreak) buffer[length-2] = '\n'; accumulator = String::Concat(accumulator, String::New(buffer, length-1)); @@ -299,9 +299,12 @@ Handle Shell::CreateExternalArray(const Arguments& args, Persistent persistent_array = Persistent::New(array); persistent_array.MakeWeak(data, ExternalArrayWeakCallback); persistent_array.MarkIndependent(); - array->SetIndexedPropertiesToExternalArrayData(data, type, length); - array->Set(String::New("length"), Int32::New(length), ReadOnly); - array->Set(String::New("BYTES_PER_ELEMENT"), Int32::New(element_size)); + array->SetIndexedPropertiesToExternalArrayData(data, type, + static_cast(length)); + array->Set(String::New("length"), + Int32::New(static_cast(length)), ReadOnly); + array->Set(String::New("BYTES_PER_ELEMENT"), + Int32::New(static_cast(element_size))); return array; } @@ -790,7 +793,7 @@ static char* ReadChars(const char* name, int* size_out) { char* chars = new char[size + 1]; chars[size] = '\0'; for (int i = 0; i < size;) { - int read = fread(&chars[i], 1, size - i, file); + int read = static_cast(fread(&chars[i], 1, size - i, file)); i += read; } fclose(file); @@ -981,7 +984,7 @@ Handle SourceGroup::ReadFile(const char* name) { char* chars = new char[size + 1]; chars[size] = '\0'; for (int i = 0; i < size;) { - int read = fread(&chars[i], 1, size - i, file); + int read = static_cast(fread(&chars[i], 1, size - i, file)); i += read; } fclose(file); -- 2.7.4