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

Side by Side Diff: runtime/bin/socket.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/filter.cc ('k') | runtime/include/dart_native_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "bin/io_buffer.h" 5 #include "bin/io_buffer.h"
6 #include "bin/isolate_data.h" 6 #include "bin/isolate_data.h"
7 #include "bin/socket.h" 7 #include "bin/socket.h"
8 #include "bin/dartutils.h" 8 #include "bin/dartutils.h"
9 #include "bin/thread.h" 9 #include "bin/thread.h"
10 #include "bin/utils.h" 10 #include "bin/utils.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 Dart_SetReturnValue(args, SocketAddress::ToTypedData(&raw)); 46 Dart_SetReturnValue(args, SocketAddress::ToTypedData(&raw));
47 } 47 }
48 } 48 }
49 49
50 50
51 void FUNCTION_NAME(Socket_CreateConnect)(Dart_NativeArguments args) { 51 void FUNCTION_NAME(Socket_CreateConnect)(Dart_NativeArguments args) {
52 RawAddr addr; 52 RawAddr addr;
53 SocketAddress::GetSockAddr(Dart_GetNativeArgument(args, 1), &addr); 53 SocketAddress::GetSockAddr(Dart_GetNativeArgument(args, 1), &addr);
54 Dart_Handle port_arg = Dart_GetNativeArgument(args, 2); 54 Dart_Handle port_arg = Dart_GetNativeArgument(args, 2);
55 int64_t port = DartUtils::GetInt64ValueCheckRange(port_arg, 0, 65535); 55 int64_t port = DartUtils::GetInt64ValueCheckRange(port_arg, 0, 65535);
56 intptr_t socket = Socket::CreateConnect(addr, port); 56 intptr_t socket = Socket::CreateConnect(addr, static_cast<intptr_t>(port));
57 OSError error; 57 OSError error;
58 if (socket >= 0) { 58 if (socket >= 0) {
59 Socket::SetSocketIdNativeField(Dart_GetNativeArgument(args, 0), socket); 59 Socket::SetSocketIdNativeField(Dart_GetNativeArgument(args, 0), socket);
60 Dart_SetReturnValue(args, Dart_True()); 60 Dart_SetReturnValue(args, Dart_True());
61 } else { 61 } else {
62 Dart_SetReturnValue(args, DartUtils::NewDartOSError(&error)); 62 Dart_SetReturnValue(args, DartUtils::NewDartOSError(&error));
63 } 63 }
64 } 64 }
65 65
66 66
67 void FUNCTION_NAME(Socket_CreateBindDatagram)(Dart_NativeArguments args) { 67 void FUNCTION_NAME(Socket_CreateBindDatagram)(Dart_NativeArguments args) {
68 RawAddr addr; 68 RawAddr addr;
69 SocketAddress::GetSockAddr(Dart_GetNativeArgument(args, 1), &addr); 69 SocketAddress::GetSockAddr(Dart_GetNativeArgument(args, 1), &addr);
70 Dart_Handle port_arg = Dart_GetNativeArgument(args, 2); 70 Dart_Handle port_arg = Dart_GetNativeArgument(args, 2);
71 int64_t port = DartUtils::GetInt64ValueCheckRange(port_arg, 0, 65535); 71 int64_t port = DartUtils::GetInt64ValueCheckRange(port_arg, 0, 65535);
72 bool reuse_addr = DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 3)); 72 bool reuse_addr = DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 3));
73 intptr_t socket = Socket::CreateBindDatagram(&addr, port, reuse_addr); 73 intptr_t socket = Socket::CreateBindDatagram(&addr,
74 static_cast<intptr_t>(port),
75 reuse_addr);
74 if (socket >= 0) { 76 if (socket >= 0) {
75 Socket::SetSocketIdNativeField(Dart_GetNativeArgument(args, 0), socket); 77 Socket::SetSocketIdNativeField(Dart_GetNativeArgument(args, 0), socket);
76 Dart_SetReturnValue(args, Dart_True()); 78 Dart_SetReturnValue(args, Dart_True());
77 } else { 79 } else {
78 OSError error; 80 OSError error;
79 Dart_SetReturnValue(args, DartUtils::NewDartOSError(&error)); 81 Dart_SetReturnValue(args, DartUtils::NewDartOSError(&error));
80 } 82 }
81 } 83 }
82 84
83 85
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 intptr_t Socket::GetSocketIdNativeField(Dart_Handle socket_obj) { 690 intptr_t Socket::GetSocketIdNativeField(Dart_Handle socket_obj) {
689 intptr_t socket = 0; 691 intptr_t socket = 0;
690 Dart_Handle err = 692 Dart_Handle err =
691 Dart_GetNativeInstanceField(socket_obj, kSocketIdNativeField, &socket); 693 Dart_GetNativeInstanceField(socket_obj, kSocketIdNativeField, &socket);
692 if (Dart_IsError(err)) Dart_PropagateError(err); 694 if (Dart_IsError(err)) Dart_PropagateError(err);
693 return socket; 695 return socket;
694 } 696 }
695 697
696 } // namespace bin 698 } // namespace bin
697 } // namespace dart 699 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/filter.cc ('k') | runtime/include/dart_native_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698