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

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

Issue 8578003: Implement setPosition on File to seek to a byte position. (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
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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); 208 DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0));
209 File* file = reinterpret_cast<File*>(value); 209 File* file = reinterpret_cast<File*>(value);
210 if (file != NULL) { 210 if (file != NULL) {
211 return_value = file->Position(); 211 return_value = file->Position();
212 } 212 }
213 Dart_SetReturnValue(args, Dart_NewInteger(return_value)); 213 Dart_SetReturnValue(args, Dart_NewInteger(return_value));
214 Dart_ExitScope(); 214 Dart_ExitScope();
215 } 215 }
216 216
217 217
218 void FUNCTION_NAME(File_SetPosition)(Dart_NativeArguments args) {
219 Dart_EnterScope();
220 intptr_t return_value = -1;
221 intptr_t value =
222 DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0));
223 File* file = reinterpret_cast<File*>(value);
224 if (file != NULL) {
225 int64_t position =
226 DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 1));
227 return_value = file->SetPosition(position);
228 }
229 Dart_SetReturnValue(args, Dart_NewInteger(return_value));
230 Dart_ExitScope();
231 }
232
233
218 void FUNCTION_NAME(File_Length)(Dart_NativeArguments args) { 234 void FUNCTION_NAME(File_Length)(Dart_NativeArguments args) {
219 Dart_EnterScope(); 235 Dart_EnterScope();
220 intptr_t return_value = -1; 236 intptr_t return_value = -1;
221 intptr_t value = 237 intptr_t value =
222 DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); 238 DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0));
223 File* file = reinterpret_cast<File*>(value); 239 File* file = reinterpret_cast<File*>(value);
224 if (file != NULL) { 240 if (file != NULL) {
225 return_value = file->Length(); 241 return_value = file->Length();
226 } 242 }
227 Dart_SetReturnValue(args, Dart_NewInteger(return_value)); 243 Dart_SetReturnValue(args, Dart_NewInteger(return_value));
(...skipping 30 matching lines...) Expand all
258 Dart_EnterScope(); 274 Dart_EnterScope();
259 const char* str = 275 const char* str =
260 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); 276 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0));
261 char* path = File::GetCanonicalPath(str); 277 char* path = File::GetCanonicalPath(str);
262 if (path != NULL) { 278 if (path != NULL) {
263 Dart_SetReturnValue(args, Dart_NewString(path)); 279 Dart_SetReturnValue(args, Dart_NewString(path));
264 free(path); 280 free(path);
265 } 281 }
266 Dart_ExitScope(); 282 Dart_ExitScope();
267 } 283 }
OLDNEW
« no previous file with comments | « runtime/bin/file.h ('k') | runtime/bin/file.dart » ('j') | runtime/bin/file_impl.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698