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

Unified Diff: util/file/file_io_posix.cc

Issue 1419673007: Remove usage of compat from client (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « util/file/file_io.h ('k') | util/file/file_io_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/file/file_io_posix.cc
diff --git a/util/file/file_io_posix.cc b/util/file/file_io_posix.cc
index c0969dcfcdb5e135f30dc87e7c1b16f557d73fa0..866b1ab1d1e5f602af54b2a0465e515376ebb3c1 100644
--- a/util/file/file_io_posix.cc
+++ b/util/file/file_io_posix.cc
@@ -28,7 +28,9 @@ namespace {
struct ReadTraits {
using VoidBufferType = void*;
using CharBufferType = char*;
- static ssize_t Operate(int fd, CharBufferType buffer, size_t size) {
+ static FileOperationResult Operate(int fd,
+ CharBufferType buffer,
+ size_t size) {
return read(fd, buffer, size);
}
};
@@ -36,21 +38,24 @@ struct ReadTraits {
struct WriteTraits {
using VoidBufferType = const void*;
using CharBufferType = const char*;
- static ssize_t Operate(int fd, CharBufferType buffer, size_t size) {
+ static FileOperationResult Operate(int fd,
+ CharBufferType buffer,
+ size_t size) {
return write(fd, buffer, size);
}
};
template <typename Traits>
-ssize_t ReadOrWrite(int fd,
- typename Traits::VoidBufferType buffer,
- size_t size) {
+FileOperationResult ReadOrWrite(int fd,
+ typename Traits::VoidBufferType buffer,
+ size_t size) {
typename Traits::CharBufferType buffer_c =
reinterpret_cast<typename Traits::CharBufferType>(buffer);
- ssize_t total_bytes = 0;
+ FileOperationResult total_bytes = 0;
while (size > 0) {
- ssize_t bytes = HANDLE_EINTR(Traits::Operate(fd, buffer_c, size));
+ FileOperationResult bytes =
+ HANDLE_EINTR(Traits::Operate(fd, buffer_c, size));
if (bytes < 0) {
return bytes;
} else if (bytes == 0) {
@@ -102,11 +107,13 @@ FileHandle OpenFileForOutput(int rdwr_or_wronly,
} // namespace
-ssize_t ReadFile(FileHandle file, void* buffer, size_t size) {
+FileOperationResult ReadFile(FileHandle file, void* buffer, size_t size) {
return ReadOrWrite<ReadTraits>(file, buffer, size);
}
-ssize_t WriteFile(FileHandle file, const void* buffer, size_t size) {
+FileOperationResult WriteFile(FileHandle file,
+ const void* buffer,
+ size_t size) {
return ReadOrWrite<WriteTraits>(file, buffer, size);
}
« no previous file with comments | « util/file/file_io.h ('k') | util/file/file_io_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698