mirror of
https://github.com/chromium/crashpad.git
synced 2024-12-29 00:32:35 +08:00
Fix Mac after FileOperationResult change
Oops, forgot to test Mac, sorry. R=mark@chromium.org Review URL: https://codereview.chromium.org/1409973004 .
This commit is contained in:
parent
a43323a1bf
commit
80f50467c3
@ -28,9 +28,9 @@ namespace {
|
|||||||
struct ReadTraits {
|
struct ReadTraits {
|
||||||
using VoidBufferType = void*;
|
using VoidBufferType = void*;
|
||||||
using CharBufferType = char*;
|
using CharBufferType = char*;
|
||||||
static FileOperationResult Operate(int fd,
|
static crashpad::FileOperationResult Operate(int fd,
|
||||||
CharBufferType buffer,
|
CharBufferType buffer,
|
||||||
size_t size) {
|
size_t size) {
|
||||||
return read(fd, buffer, size);
|
return read(fd, buffer, size);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -38,23 +38,22 @@ struct ReadTraits {
|
|||||||
struct WriteTraits {
|
struct WriteTraits {
|
||||||
using VoidBufferType = const void*;
|
using VoidBufferType = const void*;
|
||||||
using CharBufferType = const char*;
|
using CharBufferType = const char*;
|
||||||
static FileOperationResult Operate(int fd,
|
static crashpad::FileOperationResult Operate(int fd,
|
||||||
CharBufferType buffer,
|
CharBufferType buffer,
|
||||||
size_t size) {
|
size_t size) {
|
||||||
return write(fd, buffer, size);
|
return write(fd, buffer, size);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Traits>
|
template <typename Traits>
|
||||||
FileOperationResult ReadOrWrite(int fd,
|
crashpad::FileOperationResult
|
||||||
typename Traits::VoidBufferType buffer,
|
ReadOrWrite(int fd, typename Traits::VoidBufferType buffer, size_t size) {
|
||||||
size_t size) {
|
|
||||||
typename Traits::CharBufferType buffer_c =
|
typename Traits::CharBufferType buffer_c =
|
||||||
reinterpret_cast<typename Traits::CharBufferType>(buffer);
|
reinterpret_cast<typename Traits::CharBufferType>(buffer);
|
||||||
|
|
||||||
FileOperationResult total_bytes = 0;
|
crashpad::FileOperationResult total_bytes = 0;
|
||||||
while (size > 0) {
|
while (size > 0) {
|
||||||
FileOperationResult bytes =
|
crashpad::FileOperationResult bytes =
|
||||||
HANDLE_EINTR(Traits::Operate(fd, buffer_c, size));
|
HANDLE_EINTR(Traits::Operate(fd, buffer_c, size));
|
||||||
if (bytes < 0) {
|
if (bytes < 0) {
|
||||||
return bytes;
|
return bytes;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user