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

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

Issue 139043003: - Address warnings about 64-bit to 32-bit conversions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/eventhandler_macos.cc ('k') | runtime/bin/file.cc » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <string.h> 9 #include <string.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // the whole buffer has been transferred or an error occurs. If an error 83 // the whole buffer has been transferred or an error occurs. If an error
84 // occurred the result will be set to false. 84 // occurred the result will be set to false.
85 bool ReadFully(void* buffer, int64_t num_bytes); 85 bool ReadFully(void* buffer, int64_t num_bytes);
86 bool WriteFully(const void* buffer, int64_t num_bytes); 86 bool WriteFully(const void* buffer, int64_t num_bytes);
87 bool WriteByte(uint8_t byte) { 87 bool WriteByte(uint8_t byte) {
88 return WriteFully(&byte, 1); 88 return WriteFully(&byte, 1);
89 } 89 }
90 90
91 // Get the length of the file. Returns a negative value if the length cannot 91 // Get the length of the file. Returns a negative value if the length cannot
92 // be determined (e.g. not seekable device). 92 // be determined (e.g. not seekable device).
93 off64_t Length(); 93 int64_t Length();
94 94
95 // Get the current position in the file. 95 // Get the current position in the file.
96 // Returns a negative value if position cannot be determined. 96 // Returns a negative value if position cannot be determined.
97 off64_t Position(); 97 int64_t Position();
98 98
99 // Set the byte position in the file. 99 // Set the byte position in the file.
100 bool SetPosition(off64_t position); 100 bool SetPosition(int64_t position);
101 101
102 // Truncate (or extend) the file to the given length in bytes. 102 // Truncate (or extend) the file to the given length in bytes.
103 bool Truncate(off64_t length); 103 bool Truncate(int64_t length);
104 104
105 // Flush contents of file. 105 // Flush contents of file.
106 bool Flush(); 106 bool Flush();
107 107
108 // Returns whether the file has been closed. 108 // Returns whether the file has been closed.
109 bool IsClosed(); 109 bool IsClosed();
110 110
111 // Open the file with the given path. The file is always opened for 111 // Open the file with the given path. The file is always opened for
112 // reading. If mode contains kWrite the file is opened for both 112 // reading. If mode contains kWrite the file is opened for both
113 // reading and writing. If mode contains kWrite and the file does 113 // reading and writing. If mode contains kWrite and the file does
114 // not exist the file is created. The file is truncated to length 0 if 114 // not exist the file is created. The file is truncated to length 0 if
115 // mode contains kTruncate. 115 // mode contains kTruncate.
116 static File* Open(const char* path, FileOpenMode mode); 116 static File* Open(const char* path, FileOpenMode mode);
117 117
118 // Create a file object for the specified stdio file descriptor 118 // Create a file object for the specified stdio file descriptor
119 // (stdin, stout or stderr). 119 // (stdin, stout or stderr).
120 static File* OpenStdio(int fd); 120 static File* OpenStdio(int fd);
121 121
122 static bool Exists(const char* path); 122 static bool Exists(const char* path);
123 static bool Create(const char* path); 123 static bool Create(const char* path);
124 static bool CreateLink(const char* path, const char* target); 124 static bool CreateLink(const char* path, const char* target);
125 static bool Delete(const char* path); 125 static bool Delete(const char* path);
126 static bool DeleteLink(const char* path); 126 static bool DeleteLink(const char* path);
127 static bool Rename(const char* old_path, const char* new_path); 127 static bool Rename(const char* old_path, const char* new_path);
128 static bool RenameLink(const char* old_path, const char* new_path); 128 static bool RenameLink(const char* old_path, const char* new_path);
129 static bool Copy(const char* old_path, const char* new_path); 129 static bool Copy(const char* old_path, const char* new_path);
130 static off64_t LengthFromPath(const char* path); 130 static int64_t LengthFromPath(const char* path);
131 static void Stat(const char* path, int64_t* data); 131 static void Stat(const char* path, int64_t* data);
132 static time_t LastModified(const char* path); 132 static time_t LastModified(const char* path);
133 static char* LinkTarget(const char* pathname); 133 static char* LinkTarget(const char* pathname);
134 static bool IsAbsolutePath(const char* path); 134 static bool IsAbsolutePath(const char* path);
135 static char* GetCanonicalPath(const char* path); 135 static char* GetCanonicalPath(const char* path);
136 static const char* PathSeparator(); 136 static const char* PathSeparator();
137 static const char* StringEscapedPathSeparator(); 137 static const char* StringEscapedPathSeparator();
138 static Type GetType(const char* path, bool follow_links); 138 static Type GetType(const char* path, bool follow_links);
139 static Identical AreIdentical(const char* file_1, const char* file_2); 139 static Identical AreIdentical(const char* file_1, const char* file_2);
140 static StdioHandleType GetStdioHandleType(int fd); 140 static StdioHandleType GetStdioHandleType(int fd);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // FileHandle is an OS specific class which stores data about the file. 178 // FileHandle is an OS specific class which stores data about the file.
179 FileHandle* handle_; // OS specific handle for the file. 179 FileHandle* handle_; // OS specific handle for the file.
180 180
181 DISALLOW_COPY_AND_ASSIGN(File); 181 DISALLOW_COPY_AND_ASSIGN(File);
182 }; 182 };
183 183
184 } // namespace bin 184 } // namespace bin
185 } // namespace dart 185 } // namespace dart
186 186
187 #endif // BIN_FILE_H_ 187 #endif // BIN_FILE_H_
OLDNEW
« no previous file with comments | « runtime/bin/eventhandler_macos.cc ('k') | runtime/bin/file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698