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

Side by Side Diff: util/file/file_io.h

Issue 1023943003: crashpad_database_util: Accept --new-report=- to read a new report from standard input (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@crashpad_database_util_new_report
Patch Set: Fix Windows Created 5 years, 4 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
« no previous file with comments | « tools/crashpad_database_util.cc ('k') | util/file/file_reader.h » ('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 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,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 #ifndef CRASHPAD_UTIL_FILE_FILE_IO_H_ 15 #ifndef CRASHPAD_UTIL_FILE_FILE_IO_H_
16 #define CRASHPAD_UTIL_FILE_FILE_IO_H_ 16 #define CRASHPAD_UTIL_FILE_FILE_IO_H_
17 17
18 #include <sys/types.h> 18 #include <sys/types.h>
19 19
20 #include "build/build_config.h" 20 #include "build/build_config.h"
21 21
22 #if defined(OS_POSIX) 22 #if defined(OS_POSIX)
23 #include "base/files/scoped_file.h" 23 #include "base/files/scoped_file.h"
24 #elif defined(OS_WIN) 24 #elif defined(OS_WIN)
25 #include <windows.h> 25 #include <windows.h>
26 #include "util/win/scoped_handle.h" 26 #include "util/win/scoped_handle.h"
27 #endif 27 #endif
28 28
29 //! \file
30
31 #if defined(OS_POSIX) || DOXYGEN
32
33 //! \brief A `PLOG()` macro usable for standard input/output error conditions.
34 //!
35 //! The `PLOG()` macro uses `errno` on POSIX and is appropriate to report
36 //! errors from standard input/output functions. On Windows, `PLOG()` uses
37 //! `GetLastError()`, and cannot be used to report errors from standard
38 //! input/output functions. This macro uses `PLOG()` when appropriate for
39 //! standard I/O functions, and `LOG()` otherwise.
40 #define STDIO_PLOG(x) PLOG(x)
41
42 #else
43
44 #define STDIO_PLOG(x) LOG(x)
45 #define fseeko(file, offset, whence) _fseeki64(file, offset, whence)
46 #define ftello(file) _ftelli64(file)
47
48 #endif
49
29 namespace base { 50 namespace base {
30 class FilePath; 51 class FilePath;
31 } // namespace base 52 } // namespace base
32 53
33 namespace crashpad { 54 namespace crashpad {
34 55
35 #if defined(OS_POSIX) || DOXYGEN 56 #if defined(OS_POSIX) || DOXYGEN
36 57
37 //! \brief Platform-specific alias for a low-level file handle. 58 //! \brief Platform-specific alias for a low-level file handle.
38 using FileHandle = int; 59 using FileHandle = int;
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 296
276 //! \brief Wraps `close()` or `CloseHandle()`, ensuring that it succeeds. 297 //! \brief Wraps `close()` or `CloseHandle()`, ensuring that it succeeds.
277 //! 298 //!
278 //! If the underlying function fails, this function causes execution to 299 //! If the underlying function fails, this function causes execution to
279 //! terminate without returning. 300 //! terminate without returning.
280 void CheckedCloseFile(FileHandle file); 301 void CheckedCloseFile(FileHandle file);
281 302
282 } // namespace crashpad 303 } // namespace crashpad
283 304
284 #endif // CRASHPAD_UTIL_FILE_FILE_IO_H_ 305 #endif // CRASHPAD_UTIL_FILE_FILE_IO_H_
OLDNEW
« no previous file with comments | « tools/crashpad_database_util.cc ('k') | util/file/file_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698