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

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

Issue 8575004: Test for immutable Lists in ListSet API methods. (Closed) Base URL: https://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 | « no previous file | runtime/bin/socket.cc » ('j') | runtime/bin/socket.cc » ('J')
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 #include "bin/file.h" 5 #include "bin/file.h"
6 6
7 #include "bin/builtin.h" 7 #include "bin/builtin.h"
8 #include "bin/dartutils.h" 8 #include "bin/dartutils.h"
9 9
10 #include "include/dart_api.h" 10 #include "include/dart_api.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 ASSERT((offset + length) <= array_len); 152 ASSERT((offset + length) <= array_len);
153 uint8_t* buffer = new uint8_t[length]; 153 uint8_t* buffer = new uint8_t[length];
154 int total_bytes_read = 154 int total_bytes_read =
155 file->Read(reinterpret_cast<void*>(buffer), length); 155 file->Read(reinterpret_cast<void*>(buffer), length);
156 /* 156 /*
157 * Reading 0 indicates end of file. 157 * Reading 0 indicates end of file.
158 */ 158 */
159 if (total_bytes_read >= 0) { 159 if (total_bytes_read >= 0) {
160 result = 160 result =
161 Dart_ListSetAsBytes(buffer_obj, offset, buffer, total_bytes_read); 161 Dart_ListSetAsBytes(buffer_obj, offset, buffer, total_bytes_read);
162 ASSERT(!Dart_IsError(result)); 162 if (!Dart_IsError(result)) {
163 return_value = total_bytes_read; 163 return_value = total_bytes_read;
turnidge 2011/11/16 18:50:18 There's probably some good diagnostic information
164 }
164 } 165 }
165 delete[] buffer; 166 delete[] buffer;
166 } 167 }
167 Dart_SetReturnValue(args, Dart_NewInteger(return_value)); 168 Dart_SetReturnValue(args, Dart_NewInteger(return_value));
168 Dart_ExitScope(); 169 Dart_ExitScope();
169 } 170 }
170 171
171 172
172 void FUNCTION_NAME(File_WriteList)(Dart_NativeArguments args) { 173 void FUNCTION_NAME(File_WriteList)(Dart_NativeArguments args) {
173 Dart_EnterScope(); 174 Dart_EnterScope();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 Dart_EnterScope(); 259 Dart_EnterScope();
259 const char* str = 260 const char* str =
260 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); 261 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0));
261 char* path = File::GetCanonicalPath(str); 262 char* path = File::GetCanonicalPath(str);
262 if (path != NULL) { 263 if (path != NULL) {
263 Dart_SetReturnValue(args, Dart_NewString(path)); 264 Dart_SetReturnValue(args, Dart_NewString(path));
264 free(path); 265 free(path);
265 } 266 }
266 Dart_ExitScope(); 267 Dart_ExitScope();
267 } 268 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/socket.cc » ('j') | runtime/bin/socket.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698