| OLD | NEW |
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 using FileHandle = HANDLE; | 72 using FileHandle = HANDLE; |
| 73 using FileOffset = LONGLONG; | 73 using FileOffset = LONGLONG; |
| 74 using ScopedFileHandle = ScopedFileHANDLE; | 74 using ScopedFileHandle = ScopedFileHANDLE; |
| 75 | 75 |
| 76 const FileHandle kInvalidFileHandle = INVALID_HANDLE_VALUE; | 76 const FileHandle kInvalidFileHandle = INVALID_HANDLE_VALUE; |
| 77 | 77 |
| 78 #endif | 78 #endif |
| 79 | 79 |
| 80 //! \brief Determines the mode that LoggingOpenFileForWrite() uses. | 80 //! \brief Determines the mode that LoggingOpenFileForWrite() uses. |
| 81 enum class FileWriteMode { | 81 enum class FileWriteMode { |
| 82 //! \brief Opens the file if it exists, or fails if it does not. |
| 83 kReuseOrFail, |
| 84 |
| 82 //! \brief Opens the file if it exists, or creates a new file. | 85 //! \brief Opens the file if it exists, or creates a new file. |
| 83 kReuseOrCreate, | 86 kReuseOrCreate, |
| 84 | 87 |
| 85 //! \brief Creates a new file. If the file already exists, it will be | 88 //! \brief Creates a new file. If the file already exists, it will be |
| 86 //! overwritten. | 89 //! overwritten. |
| 87 kTruncateOrCreate, | 90 kTruncateOrCreate, |
| 88 | 91 |
| 89 //! \brief Creates a new file. If the file already exists, the open will fail. | 92 //! \brief Creates a new file. If the file already exists, the open will fail. |
| 90 kCreateOrFail, | 93 kCreateOrFail, |
| 91 }; | 94 }; |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 | 299 |
| 297 //! \brief Wraps `close()` or `CloseHandle()`, ensuring that it succeeds. | 300 //! \brief Wraps `close()` or `CloseHandle()`, ensuring that it succeeds. |
| 298 //! | 301 //! |
| 299 //! If the underlying function fails, this function causes execution to | 302 //! If the underlying function fails, this function causes execution to |
| 300 //! terminate without returning. | 303 //! terminate without returning. |
| 301 void CheckedCloseFile(FileHandle file); | 304 void CheckedCloseFile(FileHandle file); |
| 302 | 305 |
| 303 } // namespace crashpad | 306 } // namespace crashpad |
| 304 | 307 |
| 305 #endif // CRASHPAD_UTIL_FILE_FILE_IO_H_ | 308 #endif // CRASHPAD_UTIL_FILE_FILE_IO_H_ |
| OLD | NEW |