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

Side by Side Diff: runtime/bin/socket_patch.dart

Issue 101913008: Add argument checking to InternetAddress constructor (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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 | « no previous file | tests/standalone/io/internet_address_test.dart » ('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 patch class RawServerSocket { 5 patch class RawServerSocket {
6 /* patch */ static Future<RawServerSocket> bind(address, 6 /* patch */ static Future<RawServerSocket> bind(address,
7 int port, 7 int port,
8 {int backlog: 0, 8 {int backlog: 0,
9 bool v6Only: false}) { 9 bool v6Only: false}) {
10 return _RawServerSocket.bind(address, port, backlog, v6Only); 10 return _RawServerSocket.bind(address, port, backlog, v6Only);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 } 121 }
122 } 122 }
123 123
124 Future<InternetAddress> reverse() => _NativeSocket.reverseLookup(this); 124 Future<InternetAddress> reverse() => _NativeSocket.reverseLookup(this);
125 125
126 _InternetAddress(String this.address, 126 _InternetAddress(String this.address,
127 String this._host, 127 String this._host,
128 List<int> this._in_addr); 128 List<int> this._in_addr);
129 129
130 factory _InternetAddress.parse(String address) { 130 factory _InternetAddress.parse(String address) {
131 if (address is !String) {
132 throw new ArgumentError("Invalid internet address $address");
133 }
131 var in_addr = _parse(address); 134 var in_addr = _parse(address);
132 if (in_addr == null) { 135 if (in_addr == null) {
133 throw new ArgumentError("Invalid internet address $address"); 136 throw new ArgumentError("Invalid internet address $address");
134 } 137 }
135 return new _InternetAddress(address, null, in_addr); 138 return new _InternetAddress(address, null, in_addr);
136 } 139 }
137 140
138 factory _InternetAddress.fixed(int id) { 141 factory _InternetAddress.fixed(int id) {
139 switch (id) { 142 switch (id) {
140 case _ADDRESS_LOOPBACK_IP_V4: 143 case _ADDRESS_LOOPBACK_IP_V4:
(...skipping 1404 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 1548
1546 Datagram _makeDatagram(List<int> data, 1549 Datagram _makeDatagram(List<int> data,
1547 String address, 1550 String address,
1548 List<int> in_addr, 1551 List<int> in_addr,
1549 int port) { 1552 int port) {
1550 return new Datagram( 1553 return new Datagram(
1551 data, 1554 data,
1552 new _InternetAddress(address, null, in_addr), 1555 new _InternetAddress(address, null, in_addr),
1553 port); 1556 port);
1554 } 1557 }
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/io/internet_address_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698