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

Unified Diff: runtime/vm/dart_api_message.cc

Issue 139043003: - Address warnings about 64-bit to 32-bit conversions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 11 months 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 | « runtime/vm/dart.cc ('k') | runtime/vm/dart_entry.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_message.cc
===================================================================
--- runtime/vm/dart_api_message.cc (revision 31864)
+++ runtime/vm/dart_api_message.cc (working copy)
@@ -395,16 +395,17 @@
Dart_CObject* ApiMessageReader::ReadObjectRef() {
- int64_t value = Read<int64_t>();
- if ((value & kSmiTagMask) == 0) {
- int64_t untagged_value = value >> kSmiTagShift;
- if (kMinInt32 <= untagged_value && untagged_value <= kMaxInt32) {
- return AllocateDartCObjectInt32(untagged_value);
+ int64_t value64 = Read<int64_t>();
+ if ((value64 & kSmiTagMask) == 0) {
+ int64_t untagged_value = value64 >> kSmiTagShift;
+ if ((kMinInt32 <= untagged_value) && (untagged_value <= kMaxInt32)) {
+ return AllocateDartCObjectInt32(static_cast<int32_t>(untagged_value));
} else {
return AllocateDartCObjectInt64(untagged_value);
}
}
- ASSERT((value <= kIntptrMax) && (value >= kIntptrMin));
+ ASSERT((value64 <= kIntptrMax) && (value64 >= kIntptrMin));
+ intptr_t value = static_cast<intptr_t>(value64);
if (IsVMIsolateObject(value)) {
return ReadVMIsolateObject(value);
}
@@ -512,12 +513,12 @@
return value;
}
case kMintCid: {
- int64_t value = Read<int64_t>();
+ int64_t value64 = Read<int64_t>();
Dart_CObject* object;
- if (kMinInt32 <= value && value <= kMaxInt32) {
- object = AllocateDartCObjectInt32(value);
+ if ((kMinInt32 <= value64) && (value64 <= kMaxInt32)) {
+ object = AllocateDartCObjectInt32(static_cast<int32_t>(value64));
} else {
- object = AllocateDartCObjectInt64(value);
+ object = AllocateDartCObjectInt64(value64);
}
AddBackRef(object_id, object, kIsDeserialized);
return object;
@@ -718,16 +719,17 @@
Dart_CObject* ApiMessageReader::ReadObjectImpl() {
- int64_t value = Read<int64_t>();
- if ((value & kSmiTagMask) == 0) {
- int64_t untagged_value = value >> kSmiTagShift;
- if (kMinInt32 <= untagged_value && untagged_value <= kMaxInt32) {
- return AllocateDartCObjectInt32(untagged_value);
+ int64_t value64 = Read<int64_t>();
+ if ((value64 & kSmiTagMask) == 0) {
+ int64_t untagged_value = value64 >> kSmiTagShift;
+ if ((kMinInt32 <= untagged_value) && (untagged_value <= kMaxInt32)) {
+ return AllocateDartCObjectInt32(static_cast<int32_t>(untagged_value));
} else {
return AllocateDartCObjectInt64(untagged_value);
}
}
- ASSERT((value <= kIntptrMax) && (value >= kIntptrMin));
+ ASSERT((value64 <= kIntptrMax) && (value64 >= kIntptrMin));
+ intptr_t value = static_cast<intptr_t>(value64);
if (IsVMIsolateObject(value)) {
return ReadVMIsolateObject(value);
}
@@ -847,7 +849,7 @@
void ApiMessageWriter::WriteSmi(int64_t value) {
ASSERT(Smi::IsValid64(value));
- Write<RawObject*>(Smi::New(value));
+ Write<RawObject*>(Smi::New(static_cast<intptr_t>(value)));
}
« no previous file with comments | « runtime/vm/dart.cc ('k') | runtime/vm/dart_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698