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

Unified Diff: runtime/bin/socket.cc

Issue 10052007: Socket.available should never return a negative value. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Move to use OSError. Created 8 years, 8 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 | « no previous file | runtime/bin/socket_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket.cc
diff --git a/runtime/bin/socket.cc b/runtime/bin/socket.cc
index 9507613333ce2575e06e31dd206e63d9cef59be7..596cc5a580bce467566e1a5ce2c4b710d22b1fe4 100644
--- a/runtime/bin/socket.cc
+++ b/runtime/bin/socket.cc
@@ -39,7 +39,11 @@ void FUNCTION_NAME(Socket_Available)(Dart_NativeArguments args) {
int64_t socket = DartUtils::GetIntegerField(Dart_GetNativeArgument(args, 0),
DartUtils::kIdFieldName);
intptr_t available = Socket::Available(socket);
- Dart_SetReturnValue(args, Dart_NewInteger(available));
+ if (available >= 0) {
+ Dart_SetReturnValue(args, Dart_NewInteger(available));
+ } else {
+ Dart_SetReturnValue(args, DartUtils::NewDartOSError());
+ }
Dart_ExitScope();
}
« no previous file with comments | « no previous file | runtime/bin/socket_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698