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

Side by Side Diff: runtime/bin/socket_win.cc

Issue 312343002: - Fix truncation in Socket calls. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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/socket_macos.cc ('k') | no next file » | 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 "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_WINDOWS) 6 #if defined(TARGET_OS_WINDOWS)
7 7
8 #include "bin/builtin.h" 8 #include "bin/builtin.h"
9 #include "bin/eventhandler.h" 9 #include "bin/eventhandler.h"
10 #include "bin/file.h" 10 #include "bin/file.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 return client_socket->Available(); 69 return client_socket->Available();
70 } 70 }
71 71
72 72
73 intptr_t Socket::Read(intptr_t fd, void* buffer, intptr_t num_bytes) { 73 intptr_t Socket::Read(intptr_t fd, void* buffer, intptr_t num_bytes) {
74 Handle* handle = reinterpret_cast<Handle*>(fd); 74 Handle* handle = reinterpret_cast<Handle*>(fd);
75 return handle->Read(buffer, num_bytes); 75 return handle->Read(buffer, num_bytes);
76 } 76 }
77 77
78 78
79 int Socket::RecvFrom(intptr_t fd, void* buffer, intptr_t num_bytes, 79 intptr_t Socket::RecvFrom(intptr_t fd, void* buffer, intptr_t num_bytes,
80 RawAddr* addr) { 80 RawAddr* addr) {
81 Handle* handle = reinterpret_cast<Handle*>(fd); 81 Handle* handle = reinterpret_cast<Handle*>(fd);
82 socklen_t addr_len = sizeof(addr->ss); 82 socklen_t addr_len = sizeof(addr->ss);
83 return handle->RecvFrom(buffer, num_bytes, &addr->addr, addr_len); 83 return handle->RecvFrom(buffer, num_bytes, &addr->addr, addr_len);
84 } 84 }
85 85
86 86
87 intptr_t Socket::Write(intptr_t fd, const void* buffer, intptr_t num_bytes) { 87 intptr_t Socket::Write(intptr_t fd, const void* buffer, intptr_t num_bytes) {
88 Handle* handle = reinterpret_cast<Handle*>(fd); 88 Handle* handle = reinterpret_cast<Handle*>(fd);
89 return handle->Write(buffer, num_bytes); 89 return handle->Write(buffer, num_bytes);
90 } 90 }
91 91
92 92
93 int Socket::SendTo( 93 intptr_t Socket::SendTo(
94 intptr_t fd, const void* buffer, intptr_t num_bytes, RawAddr addr) { 94 intptr_t fd, const void* buffer, intptr_t num_bytes, RawAddr addr) {
95 Handle* handle = reinterpret_cast<Handle*>(fd); 95 Handle* handle = reinterpret_cast<Handle*>(fd);
96 return handle->SendTo( 96 return handle->SendTo(
97 buffer, num_bytes, &addr.addr, SocketAddress::GetAddrLength(&addr)); 97 buffer, num_bytes, &addr.addr, SocketAddress::GetAddrLength(&addr));
98 } 98 }
99 99
100 100
101 intptr_t Socket::GetPort(intptr_t fd) { 101 intptr_t Socket::GetPort(intptr_t fd) {
102 ASSERT(reinterpret_cast<Handle*>(fd)->is_socket()); 102 ASSERT(reinterpret_cast<Handle*>(fd)->is_socket());
103 SocketHandle* socket_handle = reinterpret_cast<SocketHandle*>(fd); 103 SocketHandle* socket_handle = reinterpret_cast<SocketHandle*>(fd);
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 proto, 700 proto,
701 MCAST_LEAVE_GROUP, 701 MCAST_LEAVE_GROUP,
702 reinterpret_cast<char *>(&mreq), 702 reinterpret_cast<char *>(&mreq),
703 sizeof(mreq)) == 0; 703 sizeof(mreq)) == 0;
704 } 704 }
705 705
706 } // namespace bin 706 } // namespace bin
707 } // namespace dart 707 } // namespace dart
708 708
709 #endif // defined(TARGET_OS_WINDOWS) 709 #endif // defined(TARGET_OS_WINDOWS)
OLDNEW
« no previous file with comments | « runtime/bin/socket_macos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698