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

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: Rebase Created 5 years, 8 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
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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 273
253 //! \brief Wraps `close()` or `CloseHandle()`, ensuring that it succeeds. 274 //! \brief Wraps `close()` or `CloseHandle()`, ensuring that it succeeds.
254 //! 275 //!
255 //! If the underlying function fails, this function causes execution to 276 //! If the underlying function fails, this function causes execution to
256 //! terminate without returning. 277 //! terminate without returning.
257 void CheckedCloseFile(FileHandle file); 278 void CheckedCloseFile(FileHandle file);
258 279
259 } // namespace crashpad 280 } // namespace crashpad
260 281
261 #endif // CRASHPAD_UTIL_FILE_FILE_IO_H_ 282 #endif // CRASHPAD_UTIL_FILE_FILE_IO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698