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

Unified Diff: src/api.cc

Issue 390004: Fix warnings on Win64. (Closed)
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 | « src/allocation.cc ('k') | src/assembler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 0ffa680c6f9e5047c49adffc183ff6eb0f681032..55233a7a212d332cb7f4ce30d0fc6f46505e7955 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -37,6 +37,7 @@
#include "platform.h"
#include "serialize.h"
#include "snapshot.h"
+#include "utils.h"
#include "v8threads.h"
#include "version.h"
@@ -2046,11 +2047,11 @@ Local<String> v8::Object::ObjectProtoToString() {
Local<String> str = Utils::ToLocal(class_name);
const char* postfix = "]";
- size_t prefix_len = strlen(prefix);
- size_t str_len = str->Length();
- size_t postfix_len = strlen(postfix);
+ int prefix_len = i::StrLength(prefix);
+ int str_len = str->Length();
+ int postfix_len = i::StrLength(postfix);
- size_t buf_len = prefix_len + str_len + postfix_len;
+ int buf_len = static_cast<int>(prefix_len + str_len + postfix_len);
Lasse Reichstein 2009/11/10 16:37:41 Woops, cast no longer necessary. Will remove.
char* buf = i::NewArray<char>(buf_len);
// Write prefix.
@@ -2965,7 +2966,7 @@ Local<String> v8::String::New(const char* data, int length) {
LOG_API("String::New(char)");
if (length == 0) return Empty();
ENTER_V8;
- if (length == -1) length = strlen(data);
+ if (length == -1) length = i::StrLength(data);
i::Handle<i::String> result =
i::Factory::NewStringFromUtf8(i::Vector<const char>(data, length));
return Utils::ToLocal(result);
@@ -2988,7 +2989,7 @@ Local<String> v8::String::NewUndetectable(const char* data, int length) {
EnsureInitialized("v8::String::NewUndetectable()");
LOG_API("String::NewUndetectable(char)");
ENTER_V8;
- if (length == -1) length = strlen(data);
+ if (length == -1) length = i::StrLength(data);
i::Handle<i::String> result =
i::Factory::NewStringFromUtf8(i::Vector<const char>(data, length));
result->MarkAsUndetectable();
@@ -3056,7 +3057,8 @@ static void DisposeExternalString(v8::Persistent<v8::Value> obj,
v8::String::ExternalStringResource* resource =
reinterpret_cast<v8::String::ExternalStringResource*>(parameter);
if (resource != NULL) {
- const size_t total_size = resource->length() * sizeof(*resource->data());
+ const int total_size =
+ static_cast<int>(resource->length() * sizeof(*resource->data()));
i::Counters::total_external_string_memory.Decrement(total_size);
// The object will continue to live in the JavaScript heap until the
@@ -3086,7 +3088,8 @@ static void DisposeExternalAsciiString(v8::Persistent<v8::Value> obj,
v8::String::ExternalAsciiStringResource* resource =
reinterpret_cast<v8::String::ExternalAsciiStringResource*>(parameter);
if (resource != NULL) {
- const size_t total_size = resource->length() * sizeof(*resource->data());
+ const int total_size =
+ static_cast<int>(resource->length() * sizeof(*resource->data()));
i::Counters::total_external_string_memory.Decrement(total_size);
// The object will continue to live in the JavaScript heap until the
@@ -3108,7 +3111,8 @@ Local<String> v8::String::NewExternal(
EnsureInitialized("v8::String::NewExternal()");
LOG_API("String::NewExternal");
ENTER_V8;
- const size_t total_size = resource->length() * sizeof(*resource->data());
+ const int total_size =
+ static_cast<int>(resource->length() * sizeof(*resource->data()));
i::Counters::total_external_string_memory.Increment(total_size);
i::Handle<i::String> result = NewExternalStringHandle(resource);
i::Handle<i::Object> handle = i::GlobalHandles::Create(*result);
@@ -3143,7 +3147,8 @@ Local<String> v8::String::NewExternal(
EnsureInitialized("v8::String::NewExternal()");
LOG_API("String::NewExternal");
ENTER_V8;
- const size_t total_size = resource->length() * sizeof(*resource->data());
+ const int total_size =
+ static_cast<int>(resource->length() * sizeof(*resource->data()));
i::Counters::total_external_string_memory.Increment(total_size);
i::Handle<i::String> result = NewExternalAsciiStringHandle(resource);
i::Handle<i::Object> handle = i::GlobalHandles::Create(*result);
@@ -3265,7 +3270,7 @@ Local<String> v8::String::NewSymbol(const char* data, int length) {
EnsureInitialized("v8::String::NewSymbol()");
LOG_API("String::NewSymbol(char)");
ENTER_V8;
- if (length == -1) length = strlen(data);
+ if (length == -1) length = i::StrLength(data);
i::Handle<i::String> result =
i::Factory::LookupSymbol(i::Vector<const char>(data, length));
return Utils::ToLocal(result);
« no previous file with comments | « src/allocation.cc ('k') | src/assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698