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

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

Issue 8400038: Use strict equality when comparing with null, especially when null is a default value. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/socket_impl.dart ('k') | runtime/bin/string_stream.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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 class SocketInputStream implements InputStream { 5 class SocketInputStream implements InputStream {
6 SocketInputStream(Socket socket) { 6 SocketInputStream(Socket socket) {
7 _socket = socket; 7 _socket = socket;
8 } 8 }
9 9
10 List<int> read([int len]) { 10 List<int> read([int len]) {
(...skipping 11 matching lines...) Expand all
22 if (bytesRead < bytesToRead) { 22 if (bytesRead < bytesToRead) {
23 List<int> newBuffer = new List<int>(bytesRead); 23 List<int> newBuffer = new List<int>(bytesRead);
24 newBuffer.copyFrom(buffer, 0, 0, bytesRead); 24 newBuffer.copyFrom(buffer, 0, 0, bytesRead);
25 return newBuffer; 25 return newBuffer;
26 } else { 26 } else {
27 return buffer; 27 return buffer;
28 } 28 }
29 } 29 }
30 30
31 int readInto(List<int> buffer, int offset, int len) { 31 int readInto(List<int> buffer, int offset, int len) {
32 if (offset == null) offset = 0; 32 if (offset === null) offset = 0;
33 if (len == null) len = buffer.length; 33 if (len === null) len = buffer.length;
34 if (offset < 0) throw new StreamException("Illegal offset $offset"); 34 if (offset < 0) throw new StreamException("Illegal offset $offset");
35 if (len < 0) throw new StreamException("Illegal length $len"); 35 if (len < 0) throw new StreamException("Illegal length $len");
36 return _socket.readList(buffer, offset, len); 36 return _socket.readList(buffer, offset, len);
37 } 37 }
38 38
39 int available() { 39 int available() {
40 return _socket.available(); 40 return _socket.available();
41 } 41 }
42 42
43 void set dataHandler(void callback()) { 43 void set dataHandler(void callback()) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 if (bytesWritten == len) { 78 if (bytesWritten == len) {
79 return true; 79 return true;
80 } 80 }
81 _socket.setWriteHandler(finishWrite); 81 _socket.setWriteHandler(finishWrite);
82 return false; 82 return false;
83 } 83 }
84 84
85 Socket _socket; 85 Socket _socket;
86 } 86 }
OLDNEW
« no previous file with comments | « runtime/bin/socket_impl.dart ('k') | runtime/bin/string_stream.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698