Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #ifndef BIN_FILE_H_ | 5 #ifndef BIN_FILE_H_ |
| 6 #define BIN_FILE_H_ | 6 #define BIN_FILE_H_ |
| 7 | 7 |
| 8 #if defined(_WIN32) | 8 #if defined(_WIN32) |
| 9 typedef signed __int64 int64_t; | 9 typedef signed __int64 int64_t; |
| 10 typedef unsigned __int8 uint8_t; | 10 typedef unsigned __int8 uint8_t; |
| 11 #else | 11 #else |
| 12 #include <stdint.h> | 12 #include <stdint.h> |
| 13 #endif | 13 #endif |
| 14 | 14 |
| 15 #include <stdlib.h> | 15 #include <stdlib.h> |
| 16 #include <string.h> | 16 #include <string.h> |
| 17 #include <stdio.h> | 17 #include <stdio.h> |
| 18 #include <sys/types.h> | 18 #include <sys/types.h> |
| 19 | 19 |
| 20 #include "bin/builtin.h" | 20 #include "bin/builtin.h" |
| 21 #include "bin/dartutils.h" | 21 #include "bin/dartutils.h" |
| 22 #include "bin/utils.h" | |
| 22 #include "platform/globals.h" | 23 #include "platform/globals.h" |
| 23 #include "platform/thread.h" | 24 #include "platform/thread.h" |
| 24 | 25 |
| 25 // Forward declaration. | 26 // Forward declaration. |
| 26 class FileHandle; | 27 class FileHandle; |
| 27 | 28 |
| 28 class File { | 29 class File { |
| 29 public: | 30 public: |
| 30 enum FileOpenMode { | 31 enum FileOpenMode { |
| 31 kRead = 0, | 32 kRead = 0, |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 // Flush contents of file. | 105 // Flush contents of file. |
| 105 void Flush(); | 106 void Flush(); |
| 106 | 107 |
| 107 const char* name() const { return name_; } | 108 const char* name() const { return name_; } |
| 108 | 109 |
| 109 // Open the file with the given name. The file is always opened for | 110 // Open the file with the given name. The file is always opened for |
| 110 // reading. If mode contains kWrite the file is opened for both | 111 // reading. If mode contains kWrite the file is opened for both |
| 111 // reading and writing. If mode contains kWrite and the file does | 112 // reading and writing. If mode contains kWrite and the file does |
| 112 // not exist the file is created. The file is truncated to length 0 if | 113 // not exist the file is created. The file is truncated to length 0 if |
| 113 // mode contains kTruncate. | 114 // mode contains kTruncate. |
| 114 static File* Open(const char* name, FileOpenMode mode); | 115 static File* Open(const char* name, |
| 116 FileOpenMode mode, | |
| 117 OSError* os_error = NULL); | |
|
Mads Ager (google)
2012/03/09 09:40:13
I think we have avoided default arguments in the C
Søren Gjesse
2012/03/13 08:25:55
I removed the OSError argument. The OS error is no
| |
| 115 | 118 |
| 116 // Create a file object for the specified stdio file descriptor | 119 // Create a file object for the specified stdio file descriptor |
| 117 // (stdin, stout or stderr). | 120 // (stdin, stout or stderr). |
| 118 static File* OpenStdio(int fd); | 121 static File* OpenStdio(int fd); |
| 119 | 122 |
| 120 static bool Exists(const char* name); | 123 static bool Exists(const char* name); |
| 121 static bool Create(const char* name); | 124 static bool Create(const char* name); |
| 122 static bool Delete(const char* name); | 125 static bool Delete(const char* name); |
| 123 static bool IsAbsolutePath(const char* pathname); | 126 static bool IsAbsolutePath(const char* pathname); |
| 124 static char* GetCanonicalPath(const char* name); | 127 static char* GetCanonicalPath(const char* name); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 146 File(const File&); | 149 File(const File&); |
| 147 void operator=(const File&); | 150 void operator=(const File&); |
| 148 | 151 |
| 149 static dart::Mutex mutex_; | 152 static dart::Mutex mutex_; |
| 150 static int service_ports_size_; | 153 static int service_ports_size_; |
| 151 static Dart_Port* service_ports_; | 154 static Dart_Port* service_ports_; |
| 152 static int service_ports_index_; | 155 static int service_ports_index_; |
| 153 }; | 156 }; |
| 154 | 157 |
| 155 #endif // BIN_FILE_H_ | 158 #endif // BIN_FILE_H_ |
| OLD | NEW |